| 199 | #endif |
| 200 | |
| 201 | void |
| 202 | unixpr(u_long count_off, u_long gencnt_off, u_long dhead_off, u_long shead_off, |
| 203 | u_long sphead_off, bool *first) |
| 204 | { |
| 205 | char *buf; |
| 206 | int ret, type; |
| 207 | struct xsocket *so; |
| 208 | struct xunpgen *xug, *oxug; |
| 209 | struct xunpcb *xunp; |
| 210 | #ifndef FSTACK |
| 211 | u_long head_off; |
| 212 | #endif |
| 213 | |
| 214 | buf = NULL; |
| 215 | for (type = SOCK_STREAM; type <= SOCK_SEQPACKET; type++) { |
| 216 | if (live) |
| 217 | ret = pcblist_sysctl(type, &buf); |
| 218 | else { |
| 219 | #ifndef FSTACK |
| 220 | head_off = 0; |
| 221 | switch (type) { |
| 222 | case SOCK_STREAM: |
| 223 | head_off = shead_off; |
| 224 | break; |
| 225 | |
| 226 | case SOCK_DGRAM: |
| 227 | head_off = dhead_off; |
| 228 | break; |
| 229 | |
| 230 | case SOCK_SEQPACKET: |
| 231 | head_off = sphead_off; |
| 232 | break; |
| 233 | } |
| 234 | ret = pcblist_kvm(count_off, gencnt_off, head_off, |
| 235 | &buf); |
| 236 | #endif |
| 237 | } |
| 238 | if (ret == -1) |
| 239 | continue; |
| 240 | if (ret < 0) |
| 241 | return; |
| 242 | |
| 243 | oxug = xug = (struct xunpgen *)buf; |
| 244 | for (xug = (struct xunpgen *)((char *)xug + xug->xug_len); |
| 245 | xug->xug_len > sizeof(struct xunpgen); |
| 246 | xug = (struct xunpgen *)((char *)xug + xug->xug_len)) { |
| 247 | xunp = (struct xunpcb *)xug; |
| 248 | so = &xunp->xu_socket; |
| 249 | |
| 250 | /* Ignore PCBs which were freed during copyout. */ |
| 251 | if (xunp->unp_gencnt > oxug->xug_gen) |
| 252 | continue; |
| 253 | if (*first) { |
| 254 | xo_open_list("socket"); |
| 255 | *first = false; |
| 256 | } |
| 257 | xo_open_instance("socket"); |
| 258 | unixdomainpr(xunp, so); |
no test coverage detected