Print this page
2602 mdb ::sockparams SEGV
2602 mdb ::sockparams SEGV


  49             sym.st_value) != 0) {
  50                 mdb_warn("can't walk %s", symname);
  51                 return (B_FALSE);
  52         }
  53 
  54         return (B_TRUE);
  55 }
  56 
  57 /*
  58  * dcmd to print sockparams info.
  59  *
  60  * If no address is given then the default is to print all sockparams on the
  61  * global list (i.e., installed with soconfig(1)). To also print the ephemeral
  62  * entries the '-e' flag should be used. Only ephemeral entries can be printed
  63  * by specifying the '-E' flag.
  64  */
  65 static int
  66 sockparams_prt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
  67 {
  68         struct sockparams sp;


  69 
  70         if ((flags & DCMD_ADDRSPEC) == 0) {
  71                 uint_t opt_e = 0;
  72                 uint_t opt_E = 0;
  73 
  74                 /*
  75                  * Determine what lists should be printed
  76                  */
  77                 if (mdb_getopts(argc, argv,
  78                     'e', MDB_OPT_SETBITS, 1, &opt_e,
  79                     'E', MDB_OPT_SETBITS, 1, &opt_E) != argc)
  80                         return (DCMD_USAGE);
  81 
  82                 if (!opt_E) {
  83                         if (!sockparams_walk_list("sphead", argc, argv))
  84                                 return (DCMD_ERR);
  85                 }
  86 
  87                 if (opt_e || opt_E) {
  88                         if (!sockparams_walk_list("sp_ephem_list", argc, argv))


  95         /*
  96          * If we are piping the output, then just print out the address,
  97          * otherwise summarize the sockparams info.
  98          */
  99         if ((flags & DCMD_PIPE_OUT) != 0) {
 100                 mdb_printf("%#lr\n", addr);
 101                 return (DCMD_OK);
 102         }
 103 
 104         if (DCMD_HDRSPEC(flags)) {
 105                 mdb_printf("%-?s %3s %3s %3s %15s %15s %6s %6s\n",
 106                     "ADDR", "FAM", "TYP", "PRO", "STRDEV", "SOCKMOD", "REFS",
 107                     "FLGS");
 108         }
 109 
 110         if (mdb_vread(&sp, sizeof (sp), addr) == -1) {
 111                 mdb_warn("failed to read sockparams at %0?p", addr);
 112                 return (DCMD_ERR);
 113         }
 114 








 115         mdb_printf("%0?p %3u %3u %3u %15s %15s %6u %#6x\n",
 116             addr,
 117             sp.sp_family, sp.sp_type, sp.sp_protocol,
 118             (sp.sp_sdev_info.sd_devpath != 0) ?
 119             sp.sp_sdev_info.sd_devpath : "-",
 120             sp.sp_smod_name, sp.sp_refcnt,
 121             sp.sp_flags);
 122 
 123 
 124         return (DCMD_OK);
 125 }
 126 
 127 /*
 128  * Help function
 129  */
 130 void
 131 sockparams_help(void)
 132 {
 133         mdb_printf("Print sockparams information for a give sockparams ptr.\n"
 134             "Without the address, list available sockparams. Default "
 135             "behavior is to list only entries that were installed by the "
 136             "admin (via soconfig(1M)).\n\n"
 137             "Options:\n"
 138             "   -e:\t\tlist ephemeral sockparams\n"
 139             "   -E:\t\tonly list ephemeral sockparams\n");
 140 }


  49             sym.st_value) != 0) {
  50                 mdb_warn("can't walk %s", symname);
  51                 return (B_FALSE);
  52         }
  53 
  54         return (B_TRUE);
  55 }
  56 
  57 /*
  58  * dcmd to print sockparams info.
  59  *
  60  * If no address is given then the default is to print all sockparams on the
  61  * global list (i.e., installed with soconfig(1)). To also print the ephemeral
  62  * entries the '-e' flag should be used. Only ephemeral entries can be printed
  63  * by specifying the '-E' flag.
  64  */
  65 static int
  66 sockparams_prt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
  67 {
  68         struct sockparams sp;
  69         char strdev[MAXPATHLEN];
  70         char sockmod[MODMAXNAMELEN];
  71 
  72         if ((flags & DCMD_ADDRSPEC) == 0) {
  73                 uint_t opt_e = 0;
  74                 uint_t opt_E = 0;
  75 
  76                 /*
  77                  * Determine what lists should be printed
  78                  */
  79                 if (mdb_getopts(argc, argv,
  80                     'e', MDB_OPT_SETBITS, 1, &opt_e,
  81                     'E', MDB_OPT_SETBITS, 1, &opt_E) != argc)
  82                         return (DCMD_USAGE);
  83 
  84                 if (!opt_E) {
  85                         if (!sockparams_walk_list("sphead", argc, argv))
  86                                 return (DCMD_ERR);
  87                 }
  88 
  89                 if (opt_e || opt_E) {
  90                         if (!sockparams_walk_list("sp_ephem_list", argc, argv))


  97         /*
  98          * If we are piping the output, then just print out the address,
  99          * otherwise summarize the sockparams info.
 100          */
 101         if ((flags & DCMD_PIPE_OUT) != 0) {
 102                 mdb_printf("%#lr\n", addr);
 103                 return (DCMD_OK);
 104         }
 105 
 106         if (DCMD_HDRSPEC(flags)) {
 107                 mdb_printf("%-?s %3s %3s %3s %15s %15s %6s %6s\n",
 108                     "ADDR", "FAM", "TYP", "PRO", "STRDEV", "SOCKMOD", "REFS",
 109                     "FLGS");
 110         }
 111 
 112         if (mdb_vread(&sp, sizeof (sp), addr) == -1) {
 113                 mdb_warn("failed to read sockparams at %0?p", addr);
 114                 return (DCMD_ERR);
 115         }
 116 
 117         if ((sp.sp_sdev_info.sd_devpath == NULL) || 
 118             (mdb_readstr(strdev, sizeof (strdev), 
 119              (uintptr_t)sp.sp_sdev_info.sd_devpath) <= 0))
 120                 strcpy(strdev, "-");
 121         if (mdb_readstr(sockmod, sizeof (sockmod), 
 122             (uintptr_t)sp.sp_smod_name) <= 0)
 123                 strcpy(sockmod, "");
 124 
 125         mdb_printf("%0?p %3u %3u %3u %15s %15s %6u %#6x\n",
 126             addr,
 127             sp.sp_family, sp.sp_type, sp.sp_protocol,
 128             strdev, sockmod, sp.sp_refcnt,


 129             sp.sp_flags);
 130 
 131 
 132         return (DCMD_OK);
 133 }
 134 
 135 /*
 136  * Help function
 137  */
 138 void
 139 sockparams_help(void)
 140 {
 141         mdb_printf("Print sockparams information for a give sockparams ptr.\n"
 142             "Without the address, list available sockparams. Default "
 143             "behavior is to list only entries that were installed by the "
 144             "admin (via soconfig(1M)).\n\n"
 145             "Options:\n"
 146             "   -e:\t\tlist ephemeral sockparams\n"
 147             "   -E:\t\tonly list ephemeral sockparams\n");
 148 }