unix.c (175061) | unix.c (186644) |
---|---|
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 --- 24 unchanged lines hidden (view full) --- 33 34#if 0 35#ifndef lint 36static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93"; 37#endif /* not lint */ 38#endif 39 40#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 --- 24 unchanged lines hidden (view full) --- 33 34#if 0 35#ifndef lint 36static char sccsid[] = "@(#)unix.c 8.1 (Berkeley) 6/6/93"; 37#endif /* not lint */ 38#endif 39 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/usr.bin/netstat/unix.c 175061 2008-01-02 23:26:11Z obrien $"); | 41__FBSDID("$FreeBSD: head/usr.bin/netstat/unix.c 186644 2008-12-31 08:56:49Z maxim $"); |
42 43/* 44 * Display protocol blocks in the unix domain. 45 */ 46#include <sys/param.h> 47#include <sys/queue.h> 48#include <sys/protosw.h> 49#include <sys/socket.h> --- 192 unchanged lines hidden (view full) --- 242} 243 244static void 245unixdomainpr(struct xunpcb *xunp, struct xsocket *so) 246{ 247 struct unpcb *unp; 248 struct sockaddr_un *sa; 249 static int first = 1; | 42 43/* 44 * Display protocol blocks in the unix domain. 45 */ 46#include <sys/param.h> 47#include <sys/queue.h> 48#include <sys/protosw.h> 49#include <sys/socket.h> --- 192 unchanged lines hidden (view full) --- 242} 243 244static void 245unixdomainpr(struct xunpcb *xunp, struct xsocket *so) 246{ 247 struct unpcb *unp; 248 struct sockaddr_un *sa; 249 static int first = 1; |
250 char buf1[15]; |
|
250 251 unp = &xunp->xu_unp; 252 if (unp->unp_addr) 253 sa = &xunp->xu_addr; 254 else 255 sa = (struct sockaddr_un *)0; 256 | 251 252 unp = &xunp->xu_unp; 253 if (unp->unp_addr) 254 sa = &xunp->xu_addr; 255 else 256 sa = (struct sockaddr_un *)0; 257 |
257 if (first) { | 258 if (first && !Lflag) { |
258 printf("Active UNIX domain sockets\n"); 259 printf( 260"%-8.8s %-6.6s %-6.6s %-6.6s %8.8s %8.8s %8.8s %8.8s Addr\n", 261 "Address", "Type", "Recv-Q", "Send-Q", 262 "Inode", "Conn", "Refs", "Nextref"); 263 first = 0; 264 } | 259 printf("Active UNIX domain sockets\n"); 260 printf( 261"%-8.8s %-6.6s %-6.6s %-6.6s %8.8s %8.8s %8.8s %8.8s Addr\n", 262 "Address", "Type", "Recv-Q", "Send-Q", 263 "Inode", "Conn", "Refs", "Nextref"); 264 first = 0; 265 } |
265 printf("%8lx %-6.6s %6u %6u %8lx %8lx %8lx %8lx", 266 (long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc, 267 so->so_snd.sb_cc, 268 (long)unp->unp_vnode, (long)unp->unp_conn, 269 (long)LIST_FIRST(&unp->unp_refs), (long)LIST_NEXT(unp, unp_reflink)); | 266 267 if (Lflag && so->so_qlimit == 0) 268 return; 269 270 if (Lflag) { 271 snprintf(buf1, 15, "%d/%d/%d", so->so_qlen, 272 so->so_incqlen, so->so_qlimit); 273 printf("unix %-14.14s", buf1); 274 } else { 275 printf("%8lx %-6.6s %6u %6u %8lx %8lx %8lx %8lx", 276 (long)so->so_pcb, socktype[so->so_type], so->so_rcv.sb_cc, 277 so->so_snd.sb_cc, (long)unp->unp_vnode, (long)unp->unp_conn, 278 (long)LIST_FIRST(&unp->unp_refs), 279 (long)LIST_NEXT(unp, unp_reflink)); 280 } |
270 if (sa) 271 printf(" %.*s", 272 (int)(sa->sun_len - offsetof(struct sockaddr_un, sun_path)), 273 sa->sun_path); 274 putchar('\n'); 275} | 281 if (sa) 282 printf(" %.*s", 283 (int)(sa->sun_len - offsetof(struct sockaddr_un, sun_path)), 284 sa->sun_path); 285 putchar('\n'); 286} |