Deleted Added
full compact
unix.c (279122) unix.c (295136)
1/*-
2 * Copyright (c) 1983, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 20 unchanged lines hidden (view full) ---

29
30#if 0
31#ifndef lint
32static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93";
33#endif /* not lint */
34#endif
35
36#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1983, 1988, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 20 unchanged lines hidden (view full) ---

29
30#if 0
31#ifndef lint
32static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93";
33#endif /* not lint */
34#endif
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/usr.bin/netstat/unix.c 279122 2015-02-21 23:47:20Z marcel $");
37__FBSDID("$FreeBSD: head/usr.bin/netstat/unix.c 295136 2016-02-02 05:57:59Z alfred $");
38
39/*
40 * Display protocol blocks in the unix domain.
41 */
42#include <sys/param.h>
43#include <sys/queue.h>
44#include <sys/protosw.h>
45#include <sys/socket.h>

--- 220 unchanged lines hidden (view full) ---

266}
267
268static void
269unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
270{
271 struct unpcb *unp;
272 struct sockaddr_un *sa;
273 static int first = 1;
38
39/*
40 * Display protocol blocks in the unix domain.
41 */
42#include <sys/param.h>
43#include <sys/queue.h>
44#include <sys/protosw.h>
45#include <sys/socket.h>

--- 220 unchanged lines hidden (view full) ---

266}
267
268static void
269unixdomainpr(struct xunpcb *xunp, struct xsocket *so)
270{
271 struct unpcb *unp;
272 struct sockaddr_un *sa;
273 static int first = 1;
274 char buf1[15];
274 char buf1[33];
275 static const char *titles[2] = {
276 "{T:/%-8.8s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%8.8s} "
277 "{T:/%8.8s} {T:/%8.8s} {T:/%8.8s} {T:Addr}\n",
278 "{T:/%-16.16s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%16.16s} "
279 "{T:/%16.16s} {T:/%16.16s} {T:/%16.16s} {T:Addr}\n"
280 };
281 static const char *format[2] = {
282 "{q:address/%8lx} {t:type/%-6.6s} "

--- 22 unchanged lines hidden (view full) ---

305 "Inode", "Conn", "Refs", "Nextref");
306 first = 0;
307 }
308
309 if (Lflag && so->so_qlimit == 0)
310 return;
311
312 if (Lflag) {
275 static const char *titles[2] = {
276 "{T:/%-8.8s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%8.8s} "
277 "{T:/%8.8s} {T:/%8.8s} {T:/%8.8s} {T:Addr}\n",
278 "{T:/%-16.16s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%16.16s} "
279 "{T:/%16.16s} {T:/%16.16s} {T:/%16.16s} {T:Addr}\n"
280 };
281 static const char *format[2] = {
282 "{q:address/%8lx} {t:type/%-6.6s} "

--- 22 unchanged lines hidden (view full) ---

305 "Inode", "Conn", "Refs", "Nextref");
306 first = 0;
307 }
308
309 if (Lflag && so->so_qlimit == 0)
310 return;
311
312 if (Lflag) {
313 snprintf(buf1, 15, "%d/%d/%d", so->so_qlen,
313 snprintf(buf1, sizeof buf1, "%u/%u/%u", so->so_qlen,
314 so->so_incqlen, so->so_qlimit);
314 so->so_incqlen, so->so_qlimit);
315 xo_emit("unix {d:socket/%-14.14s}{e:queue-length/%d}"
316 "{e:incomplete-queue-length/%d}{e:queue-limit/%d}",
315 xo_emit("unix {d:socket/%-32.32s}{e:queue-length/%u}"
316 "{e:incomplete-queue-length/%u}{e:queue-limit/%u}",
317 buf1, so->so_qlen, so->so_incqlen, so->so_qlimit);
318 } else {
319 xo_emit(format[fmt],
320 (long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc,
321 so->so_snd.sb_cc, (long)unp->unp_vnode,
322 (long)unp->unp_conn,
323 (long)LIST_FIRST(&unp->unp_refs),
324 (long)LIST_NEXT(unp, unp_reflink));
325 }
326 if (sa)
327 xo_emit(" {:path/%.*s}",
328 (int)(sa->sun_len - offsetof(struct sockaddr_un, sun_path)),
329 sa->sun_path);
330 xo_emit("\n");
331}
317 buf1, so->so_qlen, so->so_incqlen, so->so_qlimit);
318 } else {
319 xo_emit(format[fmt],
320 (long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc,
321 so->so_snd.sb_cc, (long)unp->unp_vnode,
322 (long)unp->unp_conn,
323 (long)LIST_FIRST(&unp->unp_refs),
324 (long)LIST_NEXT(unp, unp_reflink));
325 }
326 if (sa)
327 xo_emit(" {:path/%.*s}",
328 (int)(sa->sun_len - offsetof(struct sockaddr_un, sun_path)),
329 sa->sun_path);
330 xo_emit("\n");
331}