Old 43BSD and netstat output

On old 43BSD…

netstat -f unix
Active UNIX domain sockets
Address  Type   Recv-Q Send-Q    Inode     Conn     Refs  Nextref Addr
801ca38c dgram       0      0 8008b5c0        0        0        0 /dev/log
801cc10c stream      0      0 8008e690        0        0        0 /dev/printer

Address                 #socket address
type                    #type: stream or dgram
Inode                   #Inode?
Conn                    #sockets connections
Refs                    #?
Nextref                 #?
Addr                    #socket file

Anyone know what does it mean "Refs" and "Nextref".
As I know Refs is referred to routing, but in sockets there is no routing as I know.

Asked By: elbarna


According to netstat/unix.c those fields are coming from unp->unp_refs and unp->unp_nextref as defined in sys/unpcb.h:

 * A socket may be referenced by a number of sockets (e.g. several
 * sockets may be connected to a datagram socket.)  These sockets
 * are in a linked list starting with unp_refs, linked through
 * unp_nextref and null-terminated.  Note that a socket may be referenced
 * by a number of other sockets and may also reference a socket (not
 * necessarily one which is referencing it).  This generates
 * the need for unp_refs and unp_nextref to be separate fields.
        struct  unpcb *unp_refs;        /* referencing socket linked list */
        struct  unpcb *unp_nextref;     /* link in unp_refs list */
Answered By: kirjosieppo
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.