FreeBSD kernel kern code
uipc_usrreq.c File Reference
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/domain.h>
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/eventhandler.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/queue.h>
#include <sys/resourcevar.h>
#include <sys/rwlock.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/signalvar.h>
#include <sys/stat.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/taskqueue.h>
#include <sys/un.h>
#include <sys/unpcb.h>
#include <sys/vnode.h>
#include <net/vnet.h>
#include <security/mac/mac_framework.h>
#include <vm/uma.h>
Include dependency graph for uipc_usrreq.c:

Go to the source code of this file.

Data Structures

struct  unp_defer
 

Macros

#define PIPSIZ   8192
 
#define UNP_LINK_LOCK_INIT()
 
#define UNP_LINK_LOCK_ASSERT()
 
#define UNP_LINK_UNLOCK_ASSERT()
 
#define UNP_LINK_RLOCK()   rw_rlock(&unp_link_rwlock)
 
#define UNP_LINK_RUNLOCK()   rw_runlock(&unp_link_rwlock)
 
#define UNP_LINK_WLOCK()   rw_wlock(&unp_link_rwlock)
 
#define UNP_LINK_WUNLOCK()   rw_wunlock(&unp_link_rwlock)
 
#define UNP_LINK_WLOCK_ASSERT()
 
#define UNP_LIST_LOCK_INIT()
 
#define UNP_LIST_LOCK()   mtx_lock(&unp_list_lock)
 
#define UNP_LIST_UNLOCK()   mtx_unlock(&unp_list_lock)
 
#define UNP_DEFERRED_LOCK_INIT()
 
#define UNP_DEFERRED_LOCK()   mtx_lock(&unp_defers_lock)
 
#define UNP_DEFERRED_UNLOCK()   mtx_unlock(&unp_defers_lock)
 
#define UNP_PCB_LOCK_INIT(unp)
 
#define UNP_PCB_LOCK_DESTROY(unp)   mtx_destroy(&(unp)->unp_mtx)
 
#define UNP_PCB_LOCK(unp)   mtx_lock(&(unp)->unp_mtx)
 
#define UNP_PCB_UNLOCK(unp)   mtx_unlock(&(unp)->unp_mtx)
 
#define UNP_PCB_LOCK_ASSERT(unp)   mtx_assert(&(unp)->unp_mtx, MA_OWNED)
 
#define OPTSET(bit)
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static SLIST_HEAD (unp_defer)
 
static SYSCTL_NODE (_net, PF_LOCAL, local, CTLFLAG_RW, 0,"Local domain")
 
static SYSCTL_NODE (_net_local, SOCK_STREAM, stream, CTLFLAG_RW, 0,"SOCK_STREAM")
 
static SYSCTL_NODE (_net_local, SOCK_DGRAM, dgram, CTLFLAG_RW, 0,"SOCK_DGRAM")
 
static SYSCTL_NODE (_net_local, SOCK_SEQPACKET, seqpacket, CTLFLAG_RW, 0,"SOCK_SEQPACKET")
 
 SYSCTL_ULONG (_net_local_stream, OID_AUTO, sendspace, CTLFLAG_RW,&unpst_sendspace, 0,"Default stream send space.")
 
 SYSCTL_ULONG (_net_local_stream, OID_AUTO, recvspace, CTLFLAG_RW,&unpst_recvspace, 0,"Default stream receive space.")
 
 SYSCTL_ULONG (_net_local_dgram, OID_AUTO, maxdgram, CTLFLAG_RW,&unpdg_sendspace, 0,"Default datagram send space.")
 
 SYSCTL_ULONG (_net_local_dgram, OID_AUTO, recvspace, CTLFLAG_RW,&unpdg_recvspace, 0,"Default datagram receive space.")
 
 SYSCTL_ULONG (_net_local_seqpacket, OID_AUTO, maxseqpacket, CTLFLAG_RW,&unpsp_sendspace, 0,"Default seqpacket send space.")
 
 SYSCTL_ULONG (_net_local_seqpacket, OID_AUTO, recvspace, CTLFLAG_RW,&unpsp_recvspace, 0,"Default seqpacket receive space.")
 
 SYSCTL_INT (_net_local, OID_AUTO, inflight, CTLFLAG_RD,&unp_rights, 0,"File descriptors in flight.")
 
 SYSCTL_INT (_net_local, OID_AUTO, deferred, CTLFLAG_RD,&unp_defers_count, 0,"File descriptors deferred to taskqueue for close.")
 
static int uipc_connect2 (struct socket *, struct socket *)
 
static int uipc_ctloutput (struct socket *, struct sockopt *)
 
static int unp_connect (struct socket *, struct sockaddr *, struct thread *)
 
static int unp_connect2 (struct socket *so, struct socket *so2, int)
 
static void unp_disconnect (struct unpcb *unp, struct unpcb *unp2)
 
static void unp_dispose (struct mbuf *)
 
static void unp_shutdown (struct unpcb *)
 
static void unp_drop (struct unpcb *, int)
 
static void unp_gc (__unused void *, int)
 
static void unp_scan (struct mbuf *, void(*)(struct file *))
 
static void unp_discard (struct file *)
 
static void unp_freerights (struct file **, int)
 
static void unp_init (void)
 
static int unp_internalize (struct mbuf **, struct thread *)
 
static void unp_internalize_fp (struct file *)
 
static int unp_externalize (struct mbuf *, struct mbuf **)
 
static int unp_externalize_fp (struct file *)
 
static struct mbuf * unp_addsockcred (struct thread *, struct mbuf *)
 
static void unp_process_defers (void *__unused, int)
 
 DOMAIN_SET (local)
 
static void uipc_abort (struct socket *so)
 
static int uipc_accept (struct socket *so, struct sockaddr **nam)
 
static int uipc_attach (struct socket *so, int proto, struct thread *td)
 
static int uipc_bind (struct socket *so, struct sockaddr *nam, struct thread *td)
 
static int uipc_connect (struct socket *so, struct sockaddr *nam, struct thread *td)
 
static void uipc_close (struct socket *so)
 
static void uipc_detach (struct socket *so)
 
static int uipc_disconnect (struct socket *so)
 
static int uipc_listen (struct socket *so, int backlog, struct thread *td)
 
static int uipc_peeraddr (struct socket *so, struct sockaddr **nam)
 
static int uipc_rcvd (struct socket *so, int flags)
 
static int uipc_send (struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td)
 
static int uipc_sense (struct socket *so, struct stat *sb)
 
static int uipc_shutdown (struct socket *so)
 
static int uipc_sockaddr (struct socket *so, struct sockaddr **nam)
 
static int unp_pcblist (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_net_local_dgram, OID_AUTO, pcblist, CTLTYPE_OPAQUE|CTLFLAG_RD,(void *)(intptr_t) SOCK_DGRAM, 0, unp_pcblist,"S,xunpcb","List of active local datagram sockets")
 
 SYSCTL_PROC (_net_local_stream, OID_AUTO, pcblist, CTLTYPE_OPAQUE|CTLFLAG_RD,(void *)(intptr_t) SOCK_STREAM, 0, unp_pcblist,"S,xunpcb","List of active local stream sockets")
 
 SYSCTL_PROC (_net_local_seqpacket, OID_AUTO, pcblist, CTLTYPE_OPAQUE|CTLFLAG_RD,(void *)(intptr_t) SOCK_SEQPACKET, 0, unp_pcblist,"S,xunpcb","List of active local seqpacket sockets")
 
static void unp_zone_change (void *tag)
 
static struct unpcb * fptounp (struct file *fp)
 
static void unp_process_defers (void *arg __unused, int pending)
 
static void unp_accessable (struct file *fp)
 
static void unp_gc_process (struct unpcb *unp)
 
 SYSCTL_INT (_net_local, OID_AUTO, recycled, CTLFLAG_RD,&unp_recycled, 0,"Number of unreachable sockets claimed by the garbage collector.")
 
 SYSCTL_INT (_net_local, OID_AUTO, taskcount, CTLFLAG_RD,&unp_taskcount, 0,"Number of times the garbage collector has run.")
 
void vfs_unp_reclaim (struct vnode *vp)
 

Variables

static uma_zone_t unp_zone
 
static unp_gen_t unp_gencnt
 
static u_int unp_count
 
static ino_t unp_ino
 
static int unp_rights
 
static struct unp_head unp_shead
 
static struct unp_head unp_dhead
 
static struct unp_head unp_sphead
 
static struct timeout_task unp_gc_task
 
static struct task unp_defer_task
 
static u_long unpst_sendspace = PIPSIZ
 
static u_long unpst_recvspace = PIPSIZ
 
static u_long unpdg_sendspace = 2*1024
 
static u_long unpdg_recvspace = 4*1024
 
static u_long unpsp_sendspace = PIPSIZ
 
static u_long unpsp_recvspace = PIPSIZ
 
static struct rwlock unp_link_rwlock
 
static struct mtx unp_list_lock
 
static struct mtx unp_defers_lock
 
static struct domain localdomain
 
static struct pr_usrreqs uipc_usrreqs_dgram uipc_usrreqs_stream
 
static struct pr_usrreqs uipc_usrreqs_seqpacket
 
static struct protosw localsw []
 
static struct pr_usrreqs uipc_usrreqs_dgram
 
static int unp_marked
 
static int unp_unreachable
 
static int unp_recycled
 
static int unp_taskcount
 

Macro Definition Documentation

#define OPTSET (   bit)
Value:
do { \
if (optval) \
unp->unp_flags |= bit; \
else \
unp->unp_flags &= ~bit; \
} while (0)
#define UNP_PCB_LOCK(unp)
Definition: uipc_usrreq.c:266
#define UNP_PCB_UNLOCK(unp)
Definition: uipc_usrreq.c:267

Referenced by uipc_ctloutput().

#define PIPSIZ   8192

Definition at line 153 of file uipc_usrreq.c.

#define UNP_DEFERRED_LOCK ( )    mtx_lock(&unp_defers_lock)

Definition at line 259 of file uipc_usrreq.c.

Referenced by unp_discard(), and unp_process_defers().

#define UNP_DEFERRED_LOCK_INIT ( )
Value:
"unp_defer", NULL, MTX_DEF)
static struct mtx unp_defers_lock
Definition: uipc_usrreq.c:235
void mtx_init(struct mtx *m, const char *name, const char *type, int opts)
Definition: kern_mutex.c:837

Definition at line 257 of file uipc_usrreq.c.

Referenced by unp_init().

#define UNP_DEFERRED_UNLOCK ( )    mtx_unlock(&unp_defers_lock)

Definition at line 260 of file uipc_usrreq.c.

Referenced by unp_discard(), and unp_process_defers().

#define UNP_LINK_LOCK_ASSERT ( )
Value:
rw_assert(&unp_link_rwlock, \
RA_LOCKED)
static struct rwlock unp_link_rwlock
Definition: uipc_usrreq.c:233

Definition at line 240 of file uipc_usrreq.c.

#define UNP_LINK_LOCK_INIT ( )
Value:
rw_init(&unp_link_rwlock, \
"unp_link_rwlock")
static struct rwlock unp_link_rwlock
Definition: uipc_usrreq.c:233

Definition at line 237 of file uipc_usrreq.c.

Referenced by unp_init().

#define UNP_LINK_RLOCK ( )    rw_rlock(&unp_link_rwlock)

Definition at line 245 of file uipc_usrreq.c.

Referenced by uipc_accept(), uipc_peeraddr(), uipc_send(), uipc_sense(), and unp_gc().

#define UNP_LINK_RUNLOCK ( )    rw_runlock(&unp_link_rwlock)

Definition at line 246 of file uipc_usrreq.c.

Referenced by uipc_accept(), uipc_peeraddr(), uipc_send(), uipc_sense(), and unp_gc().

#define UNP_LINK_UNLOCK_ASSERT ( )
Value:
rw_assert(&unp_link_rwlock, \
RA_UNLOCKED)
static struct rwlock unp_link_rwlock
Definition: uipc_usrreq.c:233

Definition at line 242 of file uipc_usrreq.c.

Referenced by unp_externalize(), and unp_internalize().

#define UNP_LINK_WLOCK_ASSERT ( )
Value:
rw_assert(&unp_link_rwlock, \
RA_WLOCKED)
static struct rwlock unp_link_rwlock
Definition: uipc_usrreq.c:233

Definition at line 249 of file uipc_usrreq.c.

Referenced by uipc_send(), unp_connect(), unp_connect2(), unp_disconnect(), unp_drop(), and unp_shutdown().

#define UNP_LIST_LOCK ( )    mtx_lock(&unp_list_lock)

Definition at line 254 of file uipc_usrreq.c.

Referenced by uipc_attach(), uipc_detach(), unp_gc(), and unp_pcblist().

#define UNP_LIST_LOCK_INIT ( )
Value:
"unp_list_lock", NULL, MTX_DEF)
void mtx_init(struct mtx *m, const char *name, const char *type, int opts)
Definition: kern_mutex.c:837
static struct mtx unp_list_lock
Definition: uipc_usrreq.c:234

Definition at line 252 of file uipc_usrreq.c.

Referenced by unp_init().

#define UNP_LIST_UNLOCK ( )    mtx_unlock(&unp_list_lock)

Definition at line 255 of file uipc_usrreq.c.

Referenced by uipc_attach(), uipc_detach(), unp_gc(), and unp_pcblist().

#define UNP_PCB_LOCK_ASSERT (   unp)    mtx_assert(&(unp)->unp_mtx, MA_OWNED)

Definition at line 268 of file uipc_usrreq.c.

Referenced by unp_connect2(), unp_disconnect(), unp_drop(), and unp_shutdown().

#define UNP_PCB_LOCK_DESTROY (   unp)    mtx_destroy(&(unp)->unp_mtx)

Definition at line 265 of file uipc_usrreq.c.

Referenced by uipc_detach(), and unp_pcblist().

#define UNP_PCB_LOCK_INIT (   unp)
Value:
mtx_init(&(unp)->unp_mtx, \
"unp_mtx", "unp_mtx", \
MTX_DUPOK|MTX_DEF|MTX_RECURSE)
void mtx_init(struct mtx *m, const char *name, const char *type, int opts)
Definition: kern_mutex.c:837

Definition at line 262 of file uipc_usrreq.c.

Referenced by uipc_attach().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
DOMAIN_SET ( local  )
static struct unpcb* fptounp ( struct file *  fp)
static

Definition at line 2015 of file uipc_usrreq.c.

Referenced by unp_accessable(), unp_externalize_fp(), and unp_internalize_fp().

Here is the caller graph for this function:

static SLIST_HEAD ( unp_defer  )
static

Definition at line 123 of file uipc_usrreq.c.

Referenced by unp_process_defers().

Here is the caller graph for this function:

SYSCTL_INT ( _net_local  ,
OID_AUTO  ,
inflight  ,
CTLFLAG_RD  ,
unp_rights,
,
"File descriptors in flight."   
)
SYSCTL_INT ( _net_local  ,
OID_AUTO  ,
deferred  ,
CTLFLAG_RD  ,
unp_defers_count,
,
"File descriptors deferred to taskqueue for close."   
)
SYSCTL_INT ( _net_local  ,
OID_AUTO  ,
recycled  ,
CTLFLAG_RD  ,
unp_recycled,
,
"Number of unreachable sockets claimed by the garbage collector."   
)
SYSCTL_INT ( _net_local  ,
OID_AUTO  ,
taskcount  ,
CTLFLAG_RD  ,
unp_taskcount,
,
"Number of times the garbage collector has run."   
)
static SYSCTL_NODE ( _net  ,
PF_LOCAL  ,
local  ,
CTLFLAG_RW  ,
,
"Local domain"   
)
static
static SYSCTL_NODE ( _net_local  ,
SOCK_STREAM  ,
stream  ,
CTLFLAG_RW  ,
,
"SOCK_STREAM"   
)
static
static SYSCTL_NODE ( _net_local  ,
SOCK_DGRAM  ,
dgram  ,
CTLFLAG_RW  ,
,
"SOCK_DGRAM"   
)
static
static SYSCTL_NODE ( _net_local  ,
SOCK_SEQPACKET  ,
seqpacket  ,
CTLFLAG_RW  ,
,
"SOCK_SEQPACKET"   
)
static
SYSCTL_PROC ( _net_local_dgram  ,
OID_AUTO  ,
pcblist  ,
CTLTYPE_OPAQUE|  CTLFLAG_RD,
(void *)(intptr_t)  SOCK_DGRAM,
,
unp_pcblist  ,
S,
xunpcb"  ,
"List of active local datagram sockets"   
)
SYSCTL_PROC ( _net_local_stream  ,
OID_AUTO  ,
pcblist  ,
CTLTYPE_OPAQUE|  CTLFLAG_RD,
(void *)(intptr_t)  SOCK_STREAM,
,
unp_pcblist  ,
S,
xunpcb"  ,
"List of active local stream sockets"   
)
SYSCTL_PROC ( _net_local_seqpacket  ,
OID_AUTO  ,
pcblist  ,
CTLTYPE_OPAQUE|  CTLFLAG_RD,
(void *)(intptr_t)  SOCK_SEQPACKET,
,
unp_pcblist  ,
S,
xunpcb"  ,
"List of active local seqpacket sockets"   
)
SYSCTL_ULONG ( _net_local_stream  ,
OID_AUTO  ,
sendspace  ,
CTLFLAG_RW  ,
unpst_sendspace,
,
"Default stream send space."   
)
SYSCTL_ULONG ( _net_local_stream  ,
OID_AUTO  ,
recvspace  ,
CTLFLAG_RW  ,
unpst_recvspace,
,
"Default stream receive space."   
)
SYSCTL_ULONG ( _net_local_dgram  ,
OID_AUTO  ,
maxdgram  ,
CTLFLAG_RW  ,
unpdg_sendspace,
,
"Default datagram send space."   
)
SYSCTL_ULONG ( _net_local_dgram  ,
OID_AUTO  ,
recvspace  ,
CTLFLAG_RW  ,
unpdg_recvspace,
,
"Default datagram receive space."   
)
SYSCTL_ULONG ( _net_local_seqpacket  ,
OID_AUTO  ,
maxseqpacket  ,
CTLFLAG_RW  ,
unpsp_sendspace,
,
"Default seqpacket send space."   
)
SYSCTL_ULONG ( _net_local_seqpacket  ,
OID_AUTO  ,
recvspace  ,
CTLFLAG_RW  ,
unpsp_recvspace,
,
"Default seqpacket receive space."   
)
static void uipc_abort ( struct socket *  so)
static

Definition at line 340 of file uipc_usrreq.c.

References unp_drop(), UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static int uipc_accept ( struct socket *  so,
struct sockaddr **  nam 
)
static

Definition at line 360 of file uipc_usrreq.c.

References malloc(), UNP_LINK_RLOCK, UNP_LINK_RUNLOCK, UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static int uipc_attach ( struct socket *  so,
int  proto,
struct thread *  td 
)
static
static int uipc_bind ( struct socket *  so,
struct sockaddr *  nam,
struct thread *  td 
)
static

Definition at line 454 of file uipc_usrreq.c.

References buf, free(), malloc(), namei(), NDFREE(), sodupsockaddr(), UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, UNP_PCB_LOCK, UNP_PCB_UNLOCK, vn_finished_write(), vn_start_write(), vput(), and vrele().

Here is the call graph for this function:

static void uipc_close ( struct socket *  so)
static

Definition at line 581 of file uipc_usrreq.c.

References unp_disconnect(), UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static int uipc_connect ( struct socket *  so,
struct sockaddr *  nam,
struct thread *  td 
)
static

Definition at line 569 of file uipc_usrreq.c.

References unp_connect(), UNP_LINK_WLOCK, and UNP_LINK_WUNLOCK.

Here is the call graph for this function:

static int uipc_connect2 ( struct socket *  so1,
struct socket *  so2 
)
static

Definition at line 601 of file uipc_usrreq.c.

References unp_connect2(), UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static int uipc_ctloutput ( struct socket *  so,
struct sockopt *  sopt 
)
static

Definition at line 1158 of file uipc_usrreq.c.

References OPTSET, sooptcopyin(), sooptcopyout(), UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static void uipc_detach ( struct socket *  so)
static
static int uipc_disconnect ( struct socket *  so)
static

Definition at line 690 of file uipc_usrreq.c.

References unp_disconnect(), UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static int uipc_listen ( struct socket *  so,
int  backlog,
struct thread *  td 
)
static

Definition at line 711 of file uipc_usrreq.c.

References cru2x(), solisten_proto(), solisten_proto_check(), UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static int uipc_peeraddr ( struct socket *  so,
struct sockaddr **  nam 
)
static

Definition at line 738 of file uipc_usrreq.c.

References malloc(), UNP_LINK_RLOCK, UNP_LINK_RUNLOCK, UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static int uipc_rcvd ( struct socket *  so,
int  flags 
)
static

Definition at line 771 of file uipc_usrreq.c.

References chgsbsize(), panic(), UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static int uipc_send ( struct socket *  so,
int  flags,
struct mbuf *  m,
struct sockaddr *  nam,
struct mbuf *  control,
struct thread *  td 
)
static
static int uipc_sense ( struct socket *  so,
struct stat *  sb 
)
static

Definition at line 1034 of file uipc_usrreq.c.

References unp_ino, UNP_LINK_RLOCK, UNP_LINK_RUNLOCK, UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

static int uipc_shutdown ( struct socket *  so)
static

Definition at line 1061 of file uipc_usrreq.c.

References socantsendmore(), UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, UNP_PCB_LOCK, UNP_PCB_UNLOCK, and unp_shutdown().

Here is the call graph for this function:

static int uipc_sockaddr ( struct socket *  so,
struct sockaddr **  nam 
)
static

Definition at line 1078 of file uipc_usrreq.c.

References malloc(), UNP_PCB_LOCK, and UNP_PCB_UNLOCK.

Here is the call graph for this function:

static void unp_accessable ( struct file *  fp)
static

Definition at line 2113 of file uipc_usrreq.c.

References fptounp().

Referenced by unp_gc_process().

Here is the call graph for this function:

Here is the caller graph for this function:

static struct mbuf * unp_addsockcred ( struct thread *  td,
struct mbuf *  control 
)
static

Definition at line 1966 of file uipc_usrreq.c.

References sbcreatecontrol().

Referenced by uipc_send().

Here is the call graph for this function:

Here is the caller graph for this function:

static int unp_connect ( struct socket *  so,
struct sockaddr *  nam,
struct thread *  td 
)
static

Definition at line 1252 of file uipc_usrreq.c.

References buf, cru2x(), free(), Giant, malloc(), namei(), NDFREE(), sonewconn(), unp_connect2(), UNP_LINK_WLOCK, UNP_LINK_WLOCK_ASSERT, UNP_LINK_WUNLOCK, UNP_PCB_LOCK, UNP_PCB_UNLOCK, and vput().

Referenced by uipc_connect(), and uipc_send().

Here is the call graph for this function:

Here is the caller graph for this function:

static int unp_connect2 ( struct socket *  so,
struct socket *  so2,
int  req 
)
static

Definition at line 1413 of file uipc_usrreq.c.

References panic(), soisconnected(), soisconnecting(), UNP_LINK_WLOCK_ASSERT, and UNP_PCB_LOCK_ASSERT.

Referenced by uipc_connect2(), and unp_connect().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_discard ( struct file *  fp)
static

Definition at line 2029 of file uipc_usrreq.c.

References closef(), malloc(), taskqueue_enqueue(), unp_defer_task, UNP_DEFERRED_LOCK, UNP_DEFERRED_UNLOCK, and unp_externalize_fp().

Referenced by unp_dispose(), and unp_freerights().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_disconnect ( struct unpcb *  unp,
struct unpcb *  unp2 
)
static

Definition at line 1455 of file uipc_usrreq.c.

References soisdisconnected(), UNP_LINK_WLOCK_ASSERT, and UNP_PCB_LOCK_ASSERT.

Referenced by uipc_close(), uipc_detach(), uipc_disconnect(), uipc_send(), and unp_drop().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_dispose ( struct mbuf *  m)
static

Definition at line 2266 of file uipc_usrreq.c.

References unp_discard(), and unp_scan().

Referenced by uipc_send().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_drop ( struct unpcb *  unp,
int  errno 
)
static

Definition at line 1654 of file uipc_usrreq.c.

References unp_disconnect(), UNP_LINK_WLOCK_ASSERT, UNP_PCB_LOCK, UNP_PCB_LOCK_ASSERT, and UNP_PCB_UNLOCK.

Referenced by uipc_abort(), and uipc_detach().

Here is the call graph for this function:

Here is the caller graph for this function:

static int unp_externalize ( struct mbuf *  control,
struct mbuf **  controlp 
)
static

Definition at line 1685 of file uipc_usrreq.c.

References fdallocn(), m_freem(), sbcreatecontrol(), unp_externalize_fp(), unp_freerights(), and UNP_LINK_UNLOCK_ASSERT.

Here is the call graph for this function:

static int unp_externalize_fp ( struct file *  fp)
static

Definition at line 2088 of file uipc_usrreq.c.

References fptounp(), UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, and unp_rights.

Referenced by unp_discard(), and unp_externalize().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_freerights ( struct file **  rp,
int  fdcount 
)
static

Definition at line 1672 of file uipc_usrreq.c.

References unp_discard().

Referenced by unp_externalize().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_gc ( __unused void *  arg,
int  pending 
)
static

Definition at line 2180 of file uipc_usrreq.c.

References free(), malloc(), sorflush(), unp_dhead, unp_gc_process(), UNP_LINK_RLOCK, UNP_LINK_RUNLOCK, UNP_LIST_LOCK, UNP_LIST_UNLOCK, unp_shead, and unp_sphead.

Referenced by unp_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_gc_process ( struct unpcb *  unp)
static

Definition at line 2127 of file uipc_usrreq.c.

References unp_accessable(), and unp_scan().

Referenced by unp_gc().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_init ( void  )
static
static int unp_internalize ( struct mbuf **  controlp,
struct thread *  td 
)
static

Definition at line 1818 of file uipc_usrreq.c.

References bintime(), fd, m_freem(), microtime(), sbcreatecontrol(), unp_internalize_fp(), and UNP_LINK_UNLOCK_ASSERT.

Referenced by uipc_send().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_internalize_fp ( struct file *  fp)
static

Definition at line 2073 of file uipc_usrreq.c.

References fptounp(), UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, and unp_rights.

Referenced by unp_internalize().

Here is the call graph for this function:

Here is the caller graph for this function:

static int unp_pcblist ( SYSCTL_HANDLER_ARGS  )
static
static void unp_process_defers ( void *  __unused,
int   
)
static

Referenced by unp_init().

Here is the caller graph for this function:

static void unp_process_defers ( void *arg  __unused,
int  pending 
)
static

Definition at line 2046 of file uipc_usrreq.c.

References closef(), count, free(), SLIST_HEAD(), UNP_DEFERRED_LOCK, and UNP_DEFERRED_UNLOCK.

Here is the call graph for this function:

static void unp_scan ( struct mbuf *  m0,
void(*)(struct file *)  op 
)
static

Definition at line 2274 of file uipc_usrreq.c.

Referenced by unp_dispose(), and unp_gc_process().

Here is the caller graph for this function:

static void unp_shutdown ( struct unpcb *  unp)
static

Definition at line 1636 of file uipc_usrreq.c.

References socantrcvmore(), UNP_LINK_WLOCK_ASSERT, and UNP_PCB_LOCK_ASSERT.

Referenced by uipc_send(), and uipc_shutdown().

Here is the call graph for this function:

Here is the caller graph for this function:

static void unp_zone_change ( void *  tag)
static

Definition at line 1785 of file uipc_usrreq.c.

References maxsockets, and unp_zone.

Referenced by unp_init().

Here is the caller graph for this function:

void vfs_unp_reclaim ( struct vnode *  vp)

Definition at line 2328 of file uipc_usrreq.c.

References UNP_LINK_WLOCK, UNP_LINK_WUNLOCK, UNP_PCB_LOCK, UNP_PCB_UNLOCK, and vunref().

Referenced by vgonel().

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

static struct domain localdomain
static
Initial value:
= {
.dom_family = AF_LOCAL,
.dom_name = "local",
.dom_init = unp_init,
.dom_externalize = unp_externalize,
.dom_dispose = unp_dispose,
.dom_protosw = localsw,
.dom_protoswNPROTOSW = &localsw[sizeof(localsw)/sizeof(localsw[0])]
}
static struct protosw localsw[]
Definition: uipc_usrreq.c:297
static void unp_init(void)
Definition: uipc_usrreq.c:1792
static void unp_dispose(struct mbuf *)
Definition: uipc_usrreq.c:2266
static int unp_externalize(struct mbuf *, struct mbuf **)
Definition: uipc_usrreq.c:1685

Definition at line 294 of file uipc_usrreq.c.

struct protosw localsw[]
static
Initial value:
= {
{
.pr_type = SOCK_STREAM,
.pr_domain = &localdomain,
.pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS,
.pr_ctloutput = &uipc_ctloutput,
.pr_usrreqs = &uipc_usrreqs_stream
},
{
.pr_type = SOCK_DGRAM,
.pr_domain = &localdomain,
.pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS,
.pr_ctloutput = &uipc_ctloutput,
.pr_usrreqs = &uipc_usrreqs_dgram
},
{
.pr_type = SOCK_SEQPACKET,
.pr_domain = &localdomain,
.pr_flags = PR_ADDR|PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD|
PR_RIGHTS,
.pr_ctloutput = &uipc_ctloutput,
.pr_usrreqs = &uipc_usrreqs_seqpacket,
},
}
static struct pr_usrreqs uipc_usrreqs_seqpacket
Definition: uipc_usrreq.c:296
static struct domain localdomain
Definition: uipc_usrreq.c:294
static int uipc_ctloutput(struct socket *, struct sockopt *)
Definition: uipc_usrreq.c:1158
static struct pr_usrreqs uipc_usrreqs_dgram uipc_usrreqs_stream
Definition: uipc_usrreq.c:295
static struct pr_usrreqs uipc_usrreqs_dgram
Definition: uipc_usrreq.c:1097

Definition at line 297 of file uipc_usrreq.c.

struct pr_usrreqs uipc_usrreqs_dgram
static
Initial value:
= {
.pru_abort = uipc_abort,
.pru_accept = uipc_accept,
.pru_attach = uipc_attach,
.pru_bind = uipc_bind,
.pru_connect = uipc_connect,
.pru_connect2 = uipc_connect2,
.pru_detach = uipc_detach,
.pru_disconnect = uipc_disconnect,
.pru_listen = uipc_listen,
.pru_peeraddr = uipc_peeraddr,
.pru_rcvd = uipc_rcvd,
.pru_send = uipc_send,
.pru_sense = uipc_sense,
.pru_shutdown = uipc_shutdown,
.pru_sockaddr = uipc_sockaddr,
.pru_soreceive = soreceive_dgram,
.pru_close = uipc_close,
}
static int uipc_attach(struct socket *so, int proto, struct thread *td)
Definition: uipc_usrreq.c:389
static int uipc_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
Definition: uipc_usrreq.c:454
int soreceive_dgram(struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
Definition: uipc_socket.c:2191
static int uipc_disconnect(struct socket *so)
Definition: uipc_usrreq.c:690
static int uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td)
Definition: uipc_usrreq.c:818
static int uipc_shutdown(struct socket *so)
Definition: uipc_usrreq.c:1061
static int uipc_sense(struct socket *so, struct stat *sb)
Definition: uipc_usrreq.c:1034
static int uipc_sockaddr(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:1078
static void uipc_close(struct socket *so)
Definition: uipc_usrreq.c:581
static int uipc_peeraddr(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:738
static int uipc_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
Definition: uipc_usrreq.c:569
static void uipc_detach(struct socket *so)
Definition: uipc_usrreq.c:621
static int uipc_listen(struct socket *so, int backlog, struct thread *td)
Definition: uipc_usrreq.c:711
static int uipc_connect2(struct socket *, struct socket *)
Definition: uipc_usrreq.c:601
static int uipc_accept(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:360
static void uipc_abort(struct socket *so)
Definition: uipc_usrreq.c:340
static int uipc_rcvd(struct socket *so, int flags)
Definition: uipc_usrreq.c:771

Definition at line 1097 of file uipc_usrreq.c.

static struct pr_usrreqs uipc_usrreqs_seqpacket
static
Initial value:
= {
.pru_abort = uipc_abort,
.pru_accept = uipc_accept,
.pru_attach = uipc_attach,
.pru_bind = uipc_bind,
.pru_connect = uipc_connect,
.pru_connect2 = uipc_connect2,
.pru_detach = uipc_detach,
.pru_disconnect = uipc_disconnect,
.pru_listen = uipc_listen,
.pru_peeraddr = uipc_peeraddr,
.pru_rcvd = uipc_rcvd,
.pru_send = uipc_send,
.pru_sense = uipc_sense,
.pru_shutdown = uipc_shutdown,
.pru_sockaddr = uipc_sockaddr,
.pru_soreceive = soreceive_generic,
.pru_close = uipc_close,
}
static int uipc_attach(struct socket *so, int proto, struct thread *td)
Definition: uipc_usrreq.c:389
static int uipc_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
Definition: uipc_usrreq.c:454
static int uipc_disconnect(struct socket *so)
Definition: uipc_usrreq.c:690
static int uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td)
Definition: uipc_usrreq.c:818
int soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
Definition: uipc_socket.c:1527
static int uipc_shutdown(struct socket *so)
Definition: uipc_usrreq.c:1061
static int uipc_sense(struct socket *so, struct stat *sb)
Definition: uipc_usrreq.c:1034
static int uipc_sockaddr(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:1078
static void uipc_close(struct socket *so)
Definition: uipc_usrreq.c:581
static int uipc_peeraddr(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:738
static int uipc_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
Definition: uipc_usrreq.c:569
static void uipc_detach(struct socket *so)
Definition: uipc_usrreq.c:621
static int uipc_listen(struct socket *so, int backlog, struct thread *td)
Definition: uipc_usrreq.c:711
static int uipc_connect2(struct socket *, struct socket *)
Definition: uipc_usrreq.c:601
static int uipc_accept(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:360
static void uipc_abort(struct socket *so)
Definition: uipc_usrreq.c:340
static int uipc_rcvd(struct socket *so, int flags)
Definition: uipc_usrreq.c:771

Definition at line 296 of file uipc_usrreq.c.

static struct pr_usrreqs uipc_usrreqs_stream
static
Initial value:
= {
.pru_abort = uipc_abort,
.pru_accept = uipc_accept,
.pru_attach = uipc_attach,
.pru_bind = uipc_bind,
.pru_connect = uipc_connect,
.pru_connect2 = uipc_connect2,
.pru_detach = uipc_detach,
.pru_disconnect = uipc_disconnect,
.pru_listen = uipc_listen,
.pru_peeraddr = uipc_peeraddr,
.pru_rcvd = uipc_rcvd,
.pru_send = uipc_send,
.pru_sense = uipc_sense,
.pru_shutdown = uipc_shutdown,
.pru_sockaddr = uipc_sockaddr,
.pru_soreceive = soreceive_generic,
.pru_close = uipc_close,
}
static int uipc_attach(struct socket *so, int proto, struct thread *td)
Definition: uipc_usrreq.c:389
static int uipc_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
Definition: uipc_usrreq.c:454
static int uipc_disconnect(struct socket *so)
Definition: uipc_usrreq.c:690
static int uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, struct mbuf *control, struct thread *td)
Definition: uipc_usrreq.c:818
int soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
Definition: uipc_socket.c:1527
static int uipc_shutdown(struct socket *so)
Definition: uipc_usrreq.c:1061
static int uipc_sense(struct socket *so, struct stat *sb)
Definition: uipc_usrreq.c:1034
static int uipc_sockaddr(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:1078
static void uipc_close(struct socket *so)
Definition: uipc_usrreq.c:581
static int uipc_peeraddr(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:738
static int uipc_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
Definition: uipc_usrreq.c:569
static void uipc_detach(struct socket *so)
Definition: uipc_usrreq.c:621
static int uipc_listen(struct socket *so, int backlog, struct thread *td)
Definition: uipc_usrreq.c:711
static int uipc_connect2(struct socket *, struct socket *)
Definition: uipc_usrreq.c:601
static int uipc_accept(struct socket *so, struct sockaddr **nam)
Definition: uipc_usrreq.c:360
static void uipc_abort(struct socket *so)
Definition: uipc_usrreq.c:340
static int uipc_rcvd(struct socket *so, int flags)
Definition: uipc_usrreq.c:771

Definition at line 295 of file uipc_usrreq.c.

u_int unp_count
static

Definition at line 112 of file uipc_usrreq.c.

Referenced by uipc_attach(), uipc_detach(), and unp_pcblist().

struct task unp_defer_task
static

Definition at line 141 of file uipc_usrreq.c.

Referenced by unp_discard(), and unp_init().

struct mtx unp_defers_lock
static

Definition at line 235 of file uipc_usrreq.c.

struct unp_head unp_dhead
static

Definition at line 116 of file uipc_usrreq.c.

Referenced by uipc_attach(), unp_gc(), unp_init(), and unp_pcblist().

struct timeout_task unp_gc_task
static

Definition at line 134 of file uipc_usrreq.c.

Referenced by uipc_detach(), and unp_init().

unp_gen_t unp_gencnt
static

Definition at line 111 of file uipc_usrreq.c.

Referenced by uipc_attach(), uipc_detach(), and unp_pcblist().

ino_t unp_ino
static

Definition at line 113 of file uipc_usrreq.c.

Referenced by uipc_sense().

struct rwlock unp_link_rwlock
static

Definition at line 233 of file uipc_usrreq.c.

struct mtx unp_list_lock
static

Definition at line 234 of file uipc_usrreq.c.

int unp_marked
static

Definition at line 2109 of file uipc_usrreq.c.

int unp_recycled
static

Definition at line 2171 of file uipc_usrreq.c.

int unp_rights
static

Definition at line 114 of file uipc_usrreq.c.

Referenced by uipc_detach(), unp_externalize_fp(), and unp_internalize_fp().

struct unp_head unp_shead
static

Definition at line 115 of file uipc_usrreq.c.

Referenced by uipc_attach(), unp_gc(), unp_init(), and unp_pcblist().

struct unp_head unp_sphead
static

Definition at line 117 of file uipc_usrreq.c.

Referenced by uipc_attach(), unp_gc(), unp_init(), and unp_pcblist().

int unp_taskcount
static

Definition at line 2175 of file uipc_usrreq.c.

int unp_unreachable
static

Definition at line 2110 of file uipc_usrreq.c.

uma_zone_t unp_zone
static

Definition at line 110 of file uipc_usrreq.c.

Referenced by uipc_attach(), uipc_detach(), unp_init(), unp_pcblist(), and unp_zone_change().

u_long unpdg_recvspace = 4*1024
static

Definition at line 158 of file uipc_usrreq.c.

Referenced by uipc_attach().

u_long unpdg_sendspace = 2*1024
static

Definition at line 157 of file uipc_usrreq.c.

Referenced by uipc_attach().

u_long unpsp_recvspace = PIPSIZ
static

Definition at line 160 of file uipc_usrreq.c.

Referenced by uipc_attach().

u_long unpsp_sendspace = PIPSIZ
static

Definition at line 159 of file uipc_usrreq.c.

Referenced by uipc_attach().

u_long unpst_recvspace = PIPSIZ
static

Definition at line 156 of file uipc_usrreq.c.

Referenced by uipc_attach().

u_long unpst_sendspace = PIPSIZ
static

Definition at line 155 of file uipc_usrreq.c.

Referenced by uipc_attach().