FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_kern_tls.h"
#include "opt_sctp.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/capsicum.h>
#include <sys/fcntl.h>
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mutex.h>
#include <sys/domain.h>
#include <sys/file.h>
#include <sys/hhook.h>
#include <sys/kernel.h>
#include <sys/khelp.h>
#include <sys/ktls.h>
#include <sys/event.h>
#include <sys/eventhandler.h>
#include <sys/poll.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/sbuf.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/resourcevar.h>
#include <net/route.h>
#include <sys/signalvar.h>
#include <sys/stat.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <sys/unpcb.h>
#include <sys/jail.h>
#include <sys/syslog.h>
#include <netinet/in.h>
#include <netinet/in_pcb.h>
#include <netinet/tcp.h>
#include <net/vnet.h>
#include <security/mac/mac_framework.h>
#include <vm/uma.h>
Go to the source code of this file.
Macros | |
#define | VNET_SO_ASSERT(so) |
#define | V_socket_hhh VNET(socket_hhh) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | soreceive_rcvoob (struct socket *so, struct uio *uio, int flags) |
static void | so_rdknl_lock (void *) |
static void | so_rdknl_unlock (void *) |
static void | so_rdknl_assert_lock (void *, int) |
static void | so_wrknl_lock (void *) |
static void | so_wrknl_unlock (void *) |
static void | so_wrknl_assert_lock (void *, int) |
static void | filt_sordetach (struct knote *kn) |
static int | filt_soread (struct knote *kn, long hint) |
static void | filt_sowdetach (struct knote *kn) |
static int | filt_sowrite (struct knote *kn, long hint) |
static int | filt_soempty (struct knote *kn, long hint) |
static int | hhook_run_socket (struct socket *so, void *hctx, int32_t h_id) |
MALLOC_DEFINE (M_SONAME, "soname", "socket name") | |
MALLOC_DEFINE (M_PCB, "pcb", "protocol control block") | |
VNET_DEFINE (struct hhook_head *, socket_hhh[HHOOK_SOCKET_LAST+1]) | |
static int | sysctl_somaxconn (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_kern_ipc, OID_AUTO, soacceptqueue, CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_MPSAFE, 0, sizeof(int), sysctl_somaxconn, "I", "Maximum listen socket pending connection accept queue size") | |
SYSCTL_PROC (_kern_ipc, KIPC_SOMAXCONN, somaxconn, CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_SKIP|CTLFLAG_MPSAFE, 0, sizeof(int), sysctl_somaxconn, "I", "Maximum listen socket pending connection accept queue size (compat)") | |
SYSCTL_INT (_kern_ipc, OID_AUTO, numopensockets, CTLFLAG_RD, &numopensockets, 0, "Number of open sockets") | |
MTX_SYSINIT (accept_mtx, &accept_mtx, "accept", MTX_DEF) | |
MTX_SYSINIT (so_global_mtx, &so_global_mtx, "so_glabel", MTX_DEF) | |
SYSCTL_NODE (_kern, KERN_IPC, ipc, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "IPC") | |
static void | socket_zone_change (void *tag) |
static void | socket_hhook_register (int subtype) |
static void | socket_hhook_deregister (int subtype) |
static void | socket_init (void *tag) |
SYSINIT (socket, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, socket_init, NULL) | |
static void | socket_vnet_init (const void *unused __unused) |
VNET_SYSINIT (socket_vnet_init, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, socket_vnet_init, NULL) | |
static void | socket_vnet_uninit (const void *unused __unused) |
VNET_SYSUNINIT (socket_vnet_uninit, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, socket_vnet_uninit, NULL) | |
static void | init_maxsockets (void *ignored) |
SYSINIT (param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL) | |
static int | sysctl_maxsockets (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_kern_ipc, OID_AUTO, maxsockets, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, &maxsockets, 0, sysctl_maxsockets, "IU", "Maximum number of sockets available") | |
static struct socket * | soalloc (struct vnet *vnet) |
static void | sodealloc (struct socket *so) |
int | socreate (int dom, struct socket **aso, int type, int proto, struct ucred *cred, struct thread *td) |
SYSCTL_TIMEVAL_SEC (_kern_ipc, OID_AUTO, sooverinterval, CTLFLAG_RW, &overinterval, "Delay in seconds between warnings for listen socket overflows") | |
struct socket * | sonewconn (struct socket *head, int connstatus) |
int | sobind (struct socket *so, struct sockaddr *nam, struct thread *td) |
int | sobindat (int fd, struct socket *so, struct sockaddr *nam, struct thread *td) |
int | solisten (struct socket *so, int backlog, struct thread *td) |
int | solisten_proto_check (struct socket *so) |
void | solisten_proto_abort (struct socket *so) |
void | solisten_proto (struct socket *so, int backlog) |
void | solisten_wakeup (struct socket *sol) |
int | solisten_dequeue (struct socket *head, struct socket **ret, int flags) |
void | sofree (struct socket *so) |
void | sorele_locked (struct socket *so) |
int | soclose (struct socket *so) |
void | soabort (struct socket *so) |
int | soaccept (struct socket *so, struct sockaddr **nam) |
int | soconnect (struct socket *so, struct sockaddr *nam, struct thread *td) |
int | soconnectat (int fd, struct socket *so, struct sockaddr *nam, struct thread *td) |
int | soconnect2 (struct socket *so1, struct socket *so2) |
int | sodisconnect (struct socket *so) |
int | sosend_dgram (struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) |
int | sosend_generic (struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) |
int | sosend (struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) |
static __inline void | sockbuf_pushsync (struct sockbuf *sb, struct mbuf *nextrecord) |
int | soreceive_generic (struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp) |
int | soreceive_stream (struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp) |
int | soreceive_dgram (struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp) |
int | soreceive (struct socket *so, struct sockaddr **psa, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp) |
int | soshutdown (struct socket *so, int how) |
void | sorflush (struct socket *so) |
int | sooptcopyin (struct sockopt *sopt, void *buf, size_t len, size_t minlen) |
int | so_setsockopt (struct socket *so, int level, int optname, void *optval, size_t optlen) |
int | sosetopt (struct socket *so, struct sockopt *sopt) |
int | sooptcopyout (struct sockopt *sopt, const void *buf, size_t len) |
int | sogetopt (struct socket *so, struct sockopt *sopt) |
int | soopt_getm (struct sockopt *sopt, struct mbuf **mp) |
int | soopt_mcopyin (struct sockopt *sopt, struct mbuf *m) |
int | soopt_mcopyout (struct sockopt *sopt, struct mbuf *m) |
void | sohasoutofband (struct socket *so) |
int | sopoll (struct socket *so, int events, struct ucred *active_cred, struct thread *td) |
int | sopoll_generic (struct socket *so, int events, struct ucred *active_cred, struct thread *td) |
int | soo_kqfilter (struct file *fp, struct knote *kn) |
int | pru_accept_notsupp (struct socket *so, struct sockaddr **nam) |
int | pru_aio_queue_notsupp (struct socket *so, struct kaiocb *job) |
int | pru_attach_notsupp (struct socket *so, int proto, struct thread *td) |
int | pru_bind_notsupp (struct socket *so, struct sockaddr *nam, struct thread *td) |
int | pru_bindat_notsupp (int fd, struct socket *so, struct sockaddr *nam, struct thread *td) |
int | pru_connect_notsupp (struct socket *so, struct sockaddr *nam, struct thread *td) |
int | pru_connectat_notsupp (int fd, struct socket *so, struct sockaddr *nam, struct thread *td) |
int | pru_connect2_notsupp (struct socket *so1, struct socket *so2) |
int | pru_control_notsupp (struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td) |
int | pru_disconnect_notsupp (struct socket *so) |
int | pru_listen_notsupp (struct socket *so, int backlog, struct thread *td) |
int | pru_peeraddr_notsupp (struct socket *so, struct sockaddr **nam) |
int | pru_rcvd_notsupp (struct socket *so, int flags) |
int | pru_rcvoob_notsupp (struct socket *so, struct mbuf *m, int flags) |
int | pru_send_notsupp (struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, struct mbuf *control, struct thread *td) |
int | pru_ready_notsupp (struct socket *so, struct mbuf *m, int count) |
int | pru_sense_null (struct socket *so, struct stat *sb) |
int | pru_shutdown_notsupp (struct socket *so) |
int | pru_sockaddr_notsupp (struct socket *so, struct sockaddr **nam) |
int | pru_sosend_notsupp (struct socket *so, struct sockaddr *addr, struct uio *uio, struct mbuf *top, struct mbuf *control, int flags, struct thread *td) |
int | pru_soreceive_notsupp (struct socket *so, struct sockaddr **paddr, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp) |
int | pru_sopoll_notsupp (struct socket *so, int events, struct ucred *cred, struct thread *td) |
int | socheckuid (struct socket *so, uid_t uid) |
void | soisconnecting (struct socket *so) |
void | soisconnected (struct socket *so) |
void | soisdisconnecting (struct socket *so) |
void | soisdisconnected (struct socket *so) |
int | soiolock (struct socket *so, struct sx *sx, int flags) |
void | soiounlock (struct sx *sx) |
struct sockaddr * | sodupsockaddr (const struct sockaddr *sa, int mflags) |
void | sodtor_set (struct socket *so, so_dtor_t *func) |
void | soupcall_set (struct socket *so, int which, so_upcall_t func, void *arg) |
void | soupcall_clear (struct socket *so, int which) |
void | solisten_upcall_set (struct socket *so, so_upcall_t func, void *arg) |
void | sotoxsocket (struct socket *so, struct xsocket *xso) |
struct sockbuf * | so_sockbuf_rcv (struct socket *so) |
struct sockbuf * | so_sockbuf_snd (struct socket *so) |
int | so_state_get (const struct socket *so) |
void | so_state_set (struct socket *so, int val) |
int | so_options_get (const struct socket *so) |
void | so_options_set (struct socket *so, int val) |
int | so_error_get (const struct socket *so) |
void | so_error_set (struct socket *so, int val) |
int | so_linger_get (const struct socket *so) |
void | so_linger_set (struct socket *so, int val) |
struct protosw * | so_protosw_get (const struct socket *so) |
void | so_protosw_set (struct socket *so, struct protosw *val) |
void | so_sorwakeup (struct socket *so) |
void | so_sowwakeup (struct socket *so) |
void | so_sorwakeup_locked (struct socket *so) |
void | so_sowwakeup_locked (struct socket *so) |
void | so_lock (struct socket *so) |
void | so_unlock (struct socket *so) |
Variables | |
fo_kqfilter_t | soo_kqfilter |
static struct filterops | soread_filtops |
static struct filterops | sowrite_filtops |
static struct filterops | soempty_filtops |
so_gen_t | so_gencnt |
static u_int | somaxconn = SOMAXCONN |
static int | numopensockets |
struct mtx | accept_mtx |
static struct mtx | so_global_mtx |
static uma_zone_t | socket_zone |
int | maxsockets |
static struct timeval | overinterval = { 60, 0 } |
#define V_socket_hhh VNET(socket_hhh) |
Definition at line 208 of file uipc_socket.c.
#define VNET_SO_ASSERT | ( | so | ) |
Definition at line 203 of file uipc_socket.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 3977 of file uipc_socket.c.
|
static |
Definition at line 3883 of file uipc_socket.c.
References knlist_empty(), knlist_remove(), so_rdknl_lock(), and so_rdknl_unlock().
|
static |
Definition at line 3896 of file uipc_socket.c.
References hhook_run_socket().
|
static |
Definition at line 3934 of file uipc_socket.c.
References knlist_empty(), knlist_remove(), so_wrknl_lock(), and so_wrknl_unlock().
|
static |
Definition at line 3947 of file uipc_socket.c.
References hhook_run_socket().
|
inlinestatic |
Definition at line 2990 of file uipc_socket.c.
References V_socket_hhh.
Referenced by filt_soread(), filt_sowrite(), soalloc(), sodealloc(), sogetopt(), and sosetopt().
|
static |
Definition at line 348 of file uipc_socket.c.
References maxfiles, and maxsockets.
MALLOC_DEFINE | ( | M_PCB | , |
"pcb" | , | ||
"protocol control block" | |||
) |
MALLOC_DEFINE | ( | M_SONAME | , |
"soname" | , | ||
"socket name" | |||
) |
MTX_SYSINIT | ( | accept_mtx | , |
& | accept_mtx, | ||
"accept" | , | ||
MTX_DEF | |||
) |
MTX_SYSINIT | ( | so_global_mtx | , |
& | so_global_mtx, | ||
"so_glabel" | , | ||
MTX_DEF | |||
) |
int pru_accept_notsupp | ( | struct socket * | so, |
struct sockaddr ** | nam | ||
) |
Definition at line 3713 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_aio_queue_notsupp | ( | struct socket * | so, |
struct kaiocb * | job | ||
) |
Definition at line 3720 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_attach_notsupp | ( | struct socket * | so, |
int | proto, | ||
struct thread * | td | ||
) |
Definition at line 3727 of file uipc_socket.c.
Referenced by socreate().
int pru_bind_notsupp | ( | struct socket * | so, |
struct sockaddr * | nam, | ||
struct thread * | td | ||
) |
Definition at line 3734 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_bindat_notsupp | ( | int | fd, |
struct socket * | so, | ||
struct sockaddr * | nam, | ||
struct thread * | td | ||
) |
Definition at line 3741 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_connect2_notsupp | ( | struct socket * | so1, |
struct socket * | so2 | ||
) |
Definition at line 3764 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_connect_notsupp | ( | struct socket * | so, |
struct sockaddr * | nam, | ||
struct thread * | td | ||
) |
Definition at line 3749 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_connectat_notsupp | ( | int | fd, |
struct socket * | so, | ||
struct sockaddr * | nam, | ||
struct thread * | td | ||
) |
Definition at line 3756 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_control_notsupp | ( | struct socket * | so, |
u_long | cmd, | ||
caddr_t | data, | ||
struct ifnet * | ifp, | ||
struct thread * | td | ||
) |
Definition at line 3771 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_disconnect_notsupp | ( | struct socket * | so | ) |
Definition at line 3779 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_listen_notsupp | ( | struct socket * | so, |
int | backlog, | ||
struct thread * | td | ||
) |
Definition at line 3786 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_peeraddr_notsupp | ( | struct socket * | so, |
struct sockaddr ** | nam | ||
) |
Definition at line 3793 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_rcvd_notsupp | ( | struct socket * | so, |
int | flags | ||
) |
Definition at line 3800 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_rcvoob_notsupp | ( | struct socket * | so, |
struct mbuf * | m, | ||
int | flags | ||
) |
Definition at line 3807 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_ready_notsupp | ( | struct socket * | so, |
struct mbuf * | m, | ||
int | count | ||
) |
Definition at line 3826 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_send_notsupp | ( | struct socket * | so, |
int | flags, | ||
struct mbuf * | m, | ||
struct sockaddr * | addr, | ||
struct mbuf * | control, | ||
struct thread * | td | ||
) |
Definition at line 3814 of file uipc_socket.c.
References flags, and m_freem().
int pru_sense_null | ( | struct socket * | so, |
struct stat * | sb | ||
) |
Definition at line 3837 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_shutdown_notsupp | ( | struct socket * | so | ) |
Definition at line 3845 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_sockaddr_notsupp | ( | struct socket * | so, |
struct sockaddr ** | nam | ||
) |
Definition at line 3852 of file uipc_socket.c.
Referenced by pr_usrreqs_init().
int pru_sopoll_notsupp | ( | struct socket * | so, |
int | events, | ||
struct ucred * | cred, | ||
struct thread * | td | ||
) |
Definition at line 3875 of file uipc_socket.c.
int pru_soreceive_notsupp | ( | struct socket * | so, |
struct sockaddr ** | paddr, | ||
struct uio * | uio, | ||
struct mbuf ** | mp0, | ||
struct mbuf ** | controlp, | ||
int * | flagsp | ||
) |
Definition at line 3867 of file uipc_socket.c.
int pru_sosend_notsupp | ( | struct socket * | so, |
struct sockaddr * | addr, | ||
struct uio * | uio, | ||
struct mbuf * | top, | ||
struct mbuf * | control, | ||
int | flags, | ||
struct thread * | td | ||
) |
Definition at line 3859 of file uipc_socket.c.
int so_error_get | ( | const struct socket * | so | ) |
Definition at line 4450 of file uipc_socket.c.
void so_error_set | ( | struct socket * | so, |
int | val | ||
) |
Definition at line 4457 of file uipc_socket.c.
int so_linger_get | ( | const struct socket * | so | ) |
Definition at line 4464 of file uipc_socket.c.
void so_linger_set | ( | struct socket * | so, |
int | val | ||
) |
Definition at line 4471 of file uipc_socket.c.
References hz.
void so_lock | ( | struct socket * | so | ) |
Definition at line 4523 of file uipc_socket.c.
int so_options_get | ( | const struct socket * | so | ) |
Definition at line 4436 of file uipc_socket.c.
void so_options_set | ( | struct socket * | so, |
int | val | ||
) |
Definition at line 4443 of file uipc_socket.c.
struct protosw * so_protosw_get | ( | const struct socket * | so | ) |
Definition at line 4481 of file uipc_socket.c.
void so_protosw_set | ( | struct socket * | so, |
struct protosw * | val | ||
) |
Definition at line 4488 of file uipc_socket.c.
|
static |
Definition at line 4310 of file uipc_socket.c.
Referenced by socreate(), and sonewconn().
|
static |
Definition at line 4288 of file uipc_socket.c.
Referenced by filt_sordetach(), socreate(), and sonewconn().
|
static |
Definition at line 4299 of file uipc_socket.c.
Referenced by filt_sordetach(), socreate(), and sonewconn().
int so_setsockopt | ( | struct socket * | so, |
int | level, | ||
int | optname, | ||
void * | optval, | ||
size_t | optlen | ||
) |
Definition at line 3043 of file uipc_socket.c.
References level, and sosetopt().
struct sockbuf * so_sockbuf_rcv | ( | struct socket * | so | ) |
Definition at line 4408 of file uipc_socket.c.
struct sockbuf * so_sockbuf_snd | ( | struct socket * | so | ) |
Definition at line 4415 of file uipc_socket.c.
void so_sorwakeup | ( | struct socket * | so | ) |
Definition at line 4495 of file uipc_socket.c.
void so_sorwakeup_locked | ( | struct socket * | so | ) |
Definition at line 4509 of file uipc_socket.c.
void so_sowwakeup | ( | struct socket * | so | ) |
Definition at line 4502 of file uipc_socket.c.
void so_sowwakeup_locked | ( | struct socket * | so | ) |
Definition at line 4516 of file uipc_socket.c.
int so_state_get | ( | const struct socket * | so | ) |
Definition at line 4422 of file uipc_socket.c.
void so_state_set | ( | struct socket * | so, |
int | val | ||
) |
Definition at line 4429 of file uipc_socket.c.
void so_unlock | ( | struct socket * | so | ) |
Definition at line 4530 of file uipc_socket.c.
|
static |
Definition at line 4350 of file uipc_socket.c.
Referenced by socreate(), and sonewconn().
|
static |
Definition at line 4328 of file uipc_socket.c.
Referenced by filt_sowdetach(), socreate(), and sonewconn().
|
static |
Definition at line 4339 of file uipc_socket.c.
Referenced by filt_sowdetach(), socreate(), and sonewconn().
void soabort | ( | struct socket * | so | ) |
Definition at line 1334 of file uipc_socket.c.
References sofree(), and VNET_SO_ASSERT.
Referenced by soclose(), and sonewconn().
int soaccept | ( | struct socket * | so, |
struct sockaddr ** | nam | ||
) |
Definition at line 1355 of file uipc_socket.c.
Referenced by kern_accept4().
|
static |
Definition at line 397 of file uipc_socket.c.
References hhook_run_socket(), khelp_init_osd(), numopensockets, so_gencnt, so_global_mtx, soaio_rcv(), soaio_snd(), and socket_zone.
Referenced by socreate(), and sonewconn().
int sobind | ( | struct socket * | so, |
struct sockaddr * | nam, | ||
struct thread * | td | ||
) |
Definition at line 860 of file uipc_socket.c.
Referenced by kern_bindat().
int sobindat | ( | int | fd, |
struct socket * | so, | ||
struct sockaddr * | nam, | ||
struct thread * | td | ||
) |
Definition at line 871 of file uipc_socket.c.
References fd.
Referenced by kern_bindat().
int socheckuid | ( | struct socket * | so, |
uid_t | uid | ||
) |
Definition at line 3996 of file uipc_socket.c.
|
static |
Definition at line 1918 of file uipc_socket.c.
Referenced by soreceive_dgram(), and soreceive_generic().
|
static |
Definition at line 300 of file uipc_socket.c.
References hhook_head_deregister(), printf(), and V_socket_hhh.
Referenced by socket_vnet_uninit().
|
static |
Definition at line 290 of file uipc_socket.c.
References hhook_head_register(), printf(), and V_socket_hhh.
Referenced by socket_vnet_init().
|
static |
Definition at line 308 of file uipc_socket.c.
References maxsockets, socket_zone, and socket_zone_change().
|
static |
Definition at line 321 of file uipc_socket.c.
References socket_hhook_register().
|
static |
Definition at line 333 of file uipc_socket.c.
References socket_hhook_deregister().
|
static |
Definition at line 283 of file uipc_socket.c.
References maxsockets, and socket_zone.
Referenced by socket_init().
int soclose | ( | struct socket * | so | ) |
Definition at line 1239 of file uipc_socket.c.
References funsetown(), hz, soabort(), sodisconnect(), and sorele_locked().
Referenced by kern_socketpair(), and soo_close().
int soconnect | ( | struct socket * | so, |
struct sockaddr * | nam, | ||
struct thread * | td | ||
) |
Definition at line 1371 of file uipc_socket.c.
References soconnectat().
int soconnect2 | ( | struct socket * | so1, |
struct socket * | so2 | ||
) |
Definition at line 1412 of file uipc_socket.c.
Referenced by kern_socketpair().
int soconnectat | ( | int | fd, |
struct socket * | so, | ||
struct sockaddr * | nam, | ||
struct thread * | td | ||
) |
Definition at line 1378 of file uipc_socket.c.
References fd, and sodisconnect().
Referenced by kern_connectat(), and soconnect().
int socreate | ( | int | dom, |
struct socket ** | aso, | ||
int | type, | ||
int | proto, | ||
struct ucred * | cred, | ||
struct thread * | td | ||
) |
Definition at line 507 of file uipc_socket.c.
References crhold(), knlist_init(), pffinddomain(), pffindproto(), pffindtype(), prison_check_af(), pru_attach_notsupp(), so_rdknl_assert_lock(), so_rdknl_lock(), so_rdknl_unlock(), so_wrknl_assert_lock(), so_wrknl_lock(), so_wrknl_unlock(), soalloc(), sodealloc(), and type.
Referenced by kern_socket(), and kern_socketpair().
|
static |
Definition at line 461 of file uipc_socket.c.
References accept_filt_setopt(), chgsbsize(), crfree(), hhook_run_socket(), khelp_destroy_osd(), numopensockets, so_gencnt, so_global_mtx, socket_zone, and sx_destroy().
Referenced by socreate(), sofree(), and sonewconn().
int sodisconnect | ( | struct socket * | so | ) |
Definition at line 1423 of file uipc_socket.c.
References VNET_SO_ASSERT.
Referenced by soclose(), and soconnectat().
void sodtor_set | ( | struct socket * | so, |
so_dtor_t * | func | ||
) |
Definition at line 4220 of file uipc_socket.c.
struct sockaddr * sodupsockaddr | ( | const struct sockaddr * | sa, |
int | mflags | ||
) |
Definition at line 4206 of file uipc_socket.c.
References malloc().
Referenced by soreceive_dgram(), soreceive_generic(), and uipc_bindat().
void sofree | ( | struct socket * | so | ) |
Definition at line 1120 of file uipc_socket.c.
References knlist_destroy(), pr, sbdestroy(), seldrain(), sodealloc(), sorele_locked(), and VNET_SO_ASSERT.
Referenced by soabort(), and sorele_locked().
int sogetopt | ( | struct socket * | so, |
struct sockopt * | sopt | ||
) |
Definition at line 3292 of file uipc_socket.c.
References accept_filt_getopt(), hhook_run_socket(), sooptcopyin(), sooptcopyout(), and V_socket_hhh.
Referenced by kern_getsockopt().
void sohasoutofband | ( | struct socket * | so | ) |
Definition at line 3588 of file uipc_socket.c.
References pgsigio(), and selwakeuppri().
int soiolock | ( | struct socket * | so, |
struct sx * | sx, | ||
int | flags | ||
) |
Definition at line 4170 of file uipc_socket.c.
References flags.
void soiounlock | ( | struct sx * | sx | ) |
Definition at line 4197 of file uipc_socket.c.
void soisconnected | ( | struct socket * | so | ) |
Definition at line 4049 of file uipc_socket.c.
References solisten_wakeup(), sorele_locked(), soupcall_clear(), soupcall_set(), and wakeup().
Referenced by sowakeup(), and unp_connect2().
void soisconnecting | ( | struct socket * | so | ) |
Definition at line 4039 of file uipc_socket.c.
Referenced by unp_connect2().
void soisdisconnected | ( | struct socket * | so | ) |
Definition at line 4141 of file uipc_socket.c.
References sbdrop_locked(), socantrcvmore_locked(), socantsendmore_locked(), and wakeup().
Referenced by unp_disconnect().
void soisdisconnecting | ( | struct socket * | so | ) |
Definition at line 4123 of file uipc_socket.c.
References socantrcvmore_locked(), socantsendmore_locked(), and wakeup().
int solisten | ( | struct socket * | so, |
int | backlog, | ||
struct thread * | td | ||
) |
Definition at line 894 of file uipc_socket.c.
Referenced by kern_listen().
int solisten_dequeue | ( | struct socket * | head, |
struct socket ** | ret, | ||
int | flags | ||
) |
Definition at line 1052 of file uipc_socket.c.
References flags, and sorele_locked().
Referenced by kern_accept4().
void solisten_proto | ( | struct socket * | so, |
int | backlog | ||
) |
Definition at line 954 of file uipc_socket.c.
References sbdestroy(), and somaxconn.
Referenced by uipc_listen().
void solisten_proto_abort | ( | struct socket * | so | ) |
Definition at line 945 of file uipc_socket.c.
Referenced by solisten_proto_check().
int solisten_proto_check | ( | struct socket * | so | ) |
Definition at line 909 of file uipc_socket.c.
References solisten_proto_abort().
Referenced by uipc_listen().
void solisten_upcall_set | ( | struct socket * | so, |
so_upcall_t | func, | ||
void * | arg | ||
) |
Definition at line 4279 of file uipc_socket.c.
void solisten_wakeup | ( | struct socket * | sol | ) |
Definition at line 1027 of file uipc_socket.c.
References pgsigio(), selwakeuppri(), and wakeup_one().
Referenced by accept_filt_setopt(), soisconnected(), sonewconn(), and soshutdown().
struct socket * sonewconn | ( | struct socket * | head, |
int | connstatus | ||
) |
Definition at line 597 of file uipc_socket.c.
References crhold(), knlist_init(), log(), overinterval, ratecheck(), sbuf_bcat(), sbuf_cat(), sbuf_clear(), sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_printf(), so_rdknl_assert_lock(), so_rdknl_lock(), so_rdknl_unlock(), so_wrknl_assert_lock(), so_wrknl_lock(), so_wrknl_unlock(), soabort(), soalloc(), sodealloc(), solisten_wakeup(), sorele_locked(), soreserve(), and VNET_SO_ASSERT.
Referenced by unp_connectat().
int soo_kqfilter | ( | struct file * | fp, |
struct knote * | kn | ||
) |
Definition at line 3669 of file uipc_socket.c.
References knlist_add(), soempty_filtops, soread_filtops, and sowrite_filtops.
int soopt_getm | ( | struct sockopt * | sopt, |
struct mbuf ** | mp | ||
) |
Definition at line 3474 of file uipc_socket.c.
References m_freem().
int soopt_mcopyin | ( | struct sockopt * | sopt, |
struct mbuf * | m | ||
) |
Definition at line 3522 of file uipc_socket.c.
References m_freem(), and panic().
int soopt_mcopyout | ( | struct sockopt * | sopt, |
struct mbuf * | m | ||
) |
Definition at line 3550 of file uipc_socket.c.
References m_freem().
int sooptcopyin | ( | struct sockopt * | sopt, |
void * | buf, | ||
size_t | len, | ||
size_t | minlen | ||
) |
Definition at line 3015 of file uipc_socket.c.
References buf.
Referenced by accept_filt_setopt(), sogetopt(), sosetopt(), and uipc_ctloutput().
int sooptcopyout | ( | struct sockopt * | sopt, |
const void * | buf, | ||
size_t | len | ||
) |
Definition at line 3265 of file uipc_socket.c.
References buf.
Referenced by accept_filt_getopt(), sogetopt(), and uipc_ctloutput().
int sopoll | ( | struct socket * | so, |
int | events, | ||
struct ucred * | active_cred, | ||
struct thread * | td | ||
) |
Definition at line 3597 of file uipc_socket.c.
Referenced by selsocket(), and soo_poll().
int sopoll_generic | ( | struct socket * | so, |
int | events, | ||
struct ucred * | active_cred, | ||
struct thread * | td | ||
) |
Definition at line 3610 of file uipc_socket.c.
References selrecord().
Referenced by pr_usrreqs_init().
int soreceive | ( | struct socket * | so, |
struct sockaddr ** | psa, | ||
struct uio * | uio, | ||
struct mbuf ** | mp0, | ||
struct mbuf ** | controlp, | ||
int * | flagsp | ||
) |
Definition at line 2859 of file uipc_socket.c.
Referenced by kern_recvit(), soaio_process_job(), and soo_read().
int soreceive_dgram | ( | struct socket * | so, |
struct sockaddr ** | psa, | ||
struct uio * | uio, | ||
struct mbuf ** | mp0, | ||
struct mbuf ** | controlp, | ||
int * | flagsp | ||
) |
Definition at line 2677 of file uipc_socket.c.
References flags, m_freem(), pr, sbfree(), sbwait(), sockbuf_pushsync(), sodupsockaddr(), soreceive_generic(), and uiomove().
int soreceive_generic | ( | struct socket * | so, |
struct sockaddr ** | psa, | ||
struct uio * | uio, | ||
struct mbuf ** | mp0, | ||
struct mbuf ** | controlp, | ||
int * | flagsp | ||
) |
Definition at line 1961 of file uipc_socket.c.
References flags, m_copym(), m_freem(), m_unmapped_uiomove(), pr, sbcut_locked(), sbdroprecord_locked(), sbfree(), sbwait(), sockbuf_pushsync(), sodupsockaddr(), soreceive_rcvoob(), type, uiomove(), and VNET_SO_ASSERT.
Referenced by pr_usrreqs_init(), soreceive_dgram(), and soreceive_stream().
|
static |
Definition at line 1885 of file uipc_socket.c.
References flags, m_freem(), pr, uiomove(), and VNET_SO_ASSERT.
Referenced by soreceive_generic(), and soreceive_stream().
int soreceive_stream | ( | struct socket * | so, |
struct sockaddr ** | psa, | ||
struct uio * | uio, | ||
struct mbuf ** | mp0, | ||
struct mbuf ** | controlp, | ||
int * | flagsp | ||
) |
Definition at line 2453 of file uipc_socket.c.
References flags, m_cat(), m_copym(), m_mbuftouio(), sbdrop_locked(), sbfree(), sbwait(), soreceive_generic(), soreceive_rcvoob(), and VNET_SO_ASSERT.
void sorele_locked | ( | struct socket * | so | ) |
Definition at line 1221 of file uipc_socket.c.
References sofree().
Referenced by soclose(), sofree(), soisconnected(), solisten_dequeue(), and sonewconn().
void sorflush | ( | struct socket * | so | ) |
Definition at line 2931 of file uipc_socket.c.
References pr, sbrelease_internal(), socantrcvmore(), and VNET_SO_ASSERT.
Referenced by soshutdown(), and unp_gc().
int sosend | ( | struct socket * | so, |
struct sockaddr * | addr, | ||
struct uio * | uio, | ||
struct mbuf * | top, | ||
struct mbuf * | control, | ||
int | flags, | ||
struct thread * | td | ||
) |
Definition at line 1864 of file uipc_socket.c.
Referenced by kern_sendit(), soaio_process_job(), and soo_write().
int sosend_dgram | ( | struct socket * | so, |
struct sockaddr * | addr, | ||
struct uio * | uio, | ||
struct mbuf * | top, | ||
struct mbuf * | control, | ||
int | flags, | ||
struct thread * | td | ||
) |
Definition at line 1437 of file uipc_socket.c.
References addr, flags, m_freem(), m_uiotombuf(), max_hdr, and VNET_SO_ASSERT.
int sosend_generic | ( | struct socket * | so, |
struct sockaddr * | addr, | ||
struct uio * | uio, | ||
struct mbuf * | top, | ||
struct mbuf * | control, | ||
int | flags, | ||
struct thread * | td | ||
) |
Definition at line 1602 of file uipc_socket.c.
References addr, flags, ktls_enqueue(), ktls_frame(), ktls_permit_empty_frames(), m_freem(), m_length(), m_uiotombuf(), max_hdr, sbwait(), and VNET_SO_ASSERT.
Referenced by pr_usrreqs_init().
int sosetopt | ( | struct socket * | so, |
struct sockopt * | sopt | ||
) |
Definition at line 3058 of file uipc_socket.c.
References accept_filt_setopt(), hhook_run_socket(), hz, sbsetopt(), sooptcopyin(), and V_socket_hhh.
Referenced by kern_setsockopt(), and so_setsockopt().
int soshutdown | ( | struct socket * | so, |
int | how | ||
) |
Definition at line 2872 of file uipc_socket.c.
References pr, solisten_wakeup(), sorflush(), and wakeup().
Referenced by kern_shutdown().
void sotoxsocket | ( | struct socket * | so, |
struct xsocket * | xso | ||
) |
Definition at line 4376 of file uipc_socket.c.
References sbtoxsockbuf().
Referenced by unp_pcblist().
void soupcall_clear | ( | struct socket * | so, |
int | which | ||
) |
Definition at line 4254 of file uipc_socket.c.
References panic().
Referenced by soisconnected(), and sowakeup().
void soupcall_set | ( | struct socket * | so, |
int | which, | ||
so_upcall_t | func, | ||
void * | arg | ||
) |
Definition at line 4231 of file uipc_socket.c.
References panic().
Referenced by soisconnected().
SYSCTL_INT | ( | _kern_ipc | , |
OID_AUTO | , | ||
numopensockets | , | ||
CTLFLAG_RD | , | ||
& | numopensockets, | ||
0 | , | ||
"Number of open sockets" | |||
) |
|
static |
Definition at line 361 of file uipc_socket.c.
References maxfiles, maxsockets, and sysctl_handle_int().
SYSCTL_NODE | ( | _kern | , |
KERN_IPC | , | ||
ipc | , | ||
CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
"IPC" | |||
) |
SYSCTL_PROC | ( | _kern_ipc | , |
KIPC_SOMAXCONN | , | ||
somaxconn | , | ||
CTLTYPE_UINT|CTLFLAG_RW|CTLFLAG_SKIP| | CTLFLAG_MPSAFE, | ||
0 | , | ||
sizeof(int) | , | ||
sysctl_somaxconn | , | ||
"I" | , | ||
"Maximum listen socket pending connection accept queue size (compat)" | |||
) |
SYSCTL_PROC | ( | _kern_ipc | , |
OID_AUTO | , | ||
maxsockets | , | ||
CTLTYPE_INT|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
& | maxsockets, | ||
0 | , | ||
sysctl_maxsockets | , | ||
"IU" | , | ||
"Maximum number of sockets available" | |||
) |
SYSCTL_PROC | ( | _kern_ipc | , |
OID_AUTO | , | ||
soacceptqueue | , | ||
CTLTYPE_UINT|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
0 | , | ||
sizeof(int) | , | ||
sysctl_somaxconn | , | ||
"I" | , | ||
"Maximum listen socket pending connection accept queue size" | |||
) |
|
static |
Definition at line 219 of file uipc_socket.c.
References somaxconn, and sysctl_handle_int().
SYSCTL_TIMEVAL_SEC | ( | _kern_ipc | , |
OID_AUTO | , | ||
sooverinterval | , | ||
CTLFLAG_RW | , | ||
& | overinterval, | ||
"Delay in seconds between warnings for listen socket overflows" | |||
) |
SYSINIT | ( | param | , |
SI_SUB_TUNABLES | , | ||
SI_ORDER_ANY | , | ||
init_maxsockets | , | ||
NULL | |||
) |
SYSINIT | ( | socket | , |
SI_SUB_PROTO_DOMAININIT | , | ||
SI_ORDER_ANY | , | ||
socket_init | , | ||
NULL | |||
) |
VNET_DEFINE | ( | struct hhook_head * | , |
socket_hhh | [HHOOK_SOCKET_LAST+1] | ||
) |
VNET_SYSINIT | ( | socket_vnet_init | , |
SI_SUB_PROTO_DOMAININIT | , | ||
SI_ORDER_ANY | , | ||
socket_vnet_init | , | ||
NULL | |||
) |
VNET_SYSUNINIT | ( | socket_vnet_uninit | , |
SI_SUB_PROTO_DOMAININIT | , | ||
SI_ORDER_ANY | , | ||
socket_vnet_uninit | , | ||
NULL | |||
) |
struct mtx accept_mtx |
Definition at line 258 of file uipc_socket.c.
int maxsockets |
Definition at line 280 of file uipc_socket.c.
Referenced by init_maxsockets(), socket_init(), socket_zone_change(), sysctl_maxsockets(), unp_init(), and unp_zone_change().
|
static |
Definition at line 250 of file uipc_socket.c.
Referenced by soalloc(), and sodealloc().
|
static |
Definition at line 582 of file uipc_socket.c.
Referenced by sonewconn().
so_gen_t so_gencnt |
Definition at line 198 of file uipc_socket.c.
Referenced by soalloc(), sodealloc(), and unp_pcblist().
|
static |
Definition at line 265 of file uipc_socket.c.
Referenced by soalloc(), and sodealloc().
|
static |
Definition at line 279 of file uipc_socket.c.
Referenced by soalloc(), socket_init(), socket_zone_change(), and sodealloc().
|
static |
Definition at line 192 of file uipc_socket.c.
Referenced by soo_kqfilter().
|
static |
Definition at line 216 of file uipc_socket.c.
Referenced by solisten_proto(), and sysctl_somaxconn().
fo_kqfilter_t soo_kqfilter |
Definition at line 180 of file uipc_socket.c.
|
static |
Definition at line 182 of file uipc_socket.c.
Referenced by soo_kqfilter().
|
static |
Definition at line 187 of file uipc_socket.c.
Referenced by soo_kqfilter().