git: uipc: Port Unix socket domain GC from FreeBSD.

Sepherosa Ziehau sephe at
Fri Nov 13 18:58:05 PST 2015

commit 2d6931c546dd00e9e952d241de832ccb3a4926c0
Author: Sepherosa Ziehau <sephe at>
Date:   Fri Nov 6 15:24:22 2015 +0800

    uipc: Port Unix socket domain GC from FreeBSD.
    The new GC code records struct file in unpcb when the unpcb
    is used as one of the rights.  And GC only scans all unpcbs,
    instead of all files, and GC only takes unpcbs used as rights
    as targets.  Unlike FreeBSD:
    - We don't scan sockets on so_comp, since they are on unpcb
      global lists.
    - We don't allocate a temporary array for all unreachable
      Unix domain sockets, since it could be pretty large.
      Instead, the unreachable Unix domain sockets are processed
      chunk by chunk (in the same style as our original GC code).
    The original GC code is still kept around for reference
    (under UNP_GC_ALLFILES).
    And optimize unp_discard() a little bit by calling fdrop()
    directly, if the right is not a Unix domain socket.  This is
    also taken from FreeBSD.
    While I'm here, reorder unpcb fields (moving most commonly
    used fields to the beginning of unpcb) and add more comment.

Summary of changes:
 sys/kern/uipc_usrreq.c | 393 ++++++++++++++++++++++++++++++++++++++++++++-----
 sys/sys/unpcb.h        |  28 ++--
 2 files changed, 370 insertions(+), 51 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list