Project

General

Profile

Bug #2602 » sockfs.c.diff

Aleksey Ivanov, 2012-04-09 08:54 PM

View differences:

61 61
 * global list (i.e., installed with soconfig(1)). To also print the ephemeral
62 62
 * entries the '-e' flag should be used. Only ephemeral entries can be printed
63 63
 * by specifying the '-E' flag.
64 64
 */
65 65
static int
66 66
sockparams_prt(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
67 67
{
68 68
	struct sockparams sp;
69
	char strdev[16];
70
	char sockmod[16];
69 71

  
70 72
	if ((flags & DCMD_ADDRSPEC) == 0) {
71 73
		uint_t opt_e = 0;
72 74
		uint_t opt_E = 0;
73 75

  
74 76
		/*
75 77
		 * Determine what lists should be printed
76 78
		 */
......
107 109
		    "FLGS");
108 110
	}
109 111

  
110 112
	if (mdb_vread(&sp, sizeof (sp), addr) == -1) {
111 113
		mdb_warn("failed to read sockparams at %0?p", addr);
112 114
		return (DCMD_ERR);
113 115
	}
114 116

  
117
	if ((sp.sp_sdev_info.sd_devpath == 0) || (mdb_readstr(strdev, sizeof (strdev), (uintptr_t)sp.sp_sdev_info.sd_devpath) <= 0))
118
		strcpy(strdev, "-");
119
	if (mdb_readstr(sockmod, sizeof (sockmod), (uintptr_t)sp.sp_smod_name) <= 0)
120
		strcpy(sockmod, "");
121

  
115 122
	mdb_printf("%0?p %3u %3u %3u %15s %15s %6u %#6x\n",
116 123
	    addr,
117 124
	    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,
125
	    strdev, sockmod, sp.sp_refcnt,
121 126
	    sp.sp_flags);
122 127

  
123 128

  
124 129
	return (DCMD_OK);
125 130
}
126 131

  
127 132
/*
128 133
 * Help function
(1-1/2)