|
FreeBSD kernel kern code
|
#include <sys/cdefs.h>#include "opt_capsicum.h"#include "opt_inet.h"#include "opt_inet6.h"#include "opt_sctp.h"#include "opt_compat.h"#include "opt_ktrace.h"#include <sys/param.h>#include <sys/systm.h>#include <sys/capability.h>#include <sys/kernel.h>#include <sys/lock.h>#include <sys/mutex.h>#include <sys/sysproto.h>#include <sys/malloc.h>#include <sys/filedesc.h>#include <sys/event.h>#include <sys/proc.h>#include <sys/fcntl.h>#include <sys/file.h>#include <sys/filio.h>#include <sys/jail.h>#include <sys/mount.h>#include <sys/mbuf.h>#include <sys/protosw.h>#include <sys/sf_buf.h>#include <sys/sysent.h>#include <sys/socket.h>#include <sys/socketvar.h>#include <sys/signalvar.h>#include <sys/syscallsubr.h>#include <sys/sysctl.h>#include <sys/uio.h>#include <sys/vnode.h>#include <net/vnet.h>#include <security/audit/audit.h>#include <security/mac/mac_framework.h>#include <vm/vm.h>#include <vm/vm_param.h>#include <vm/vm_object.h>#include <vm/vm_page.h>#include <vm/vm_pageout.h>#include <vm/vm_kern.h>#include <vm/vm_extern.h>#include <sys/condvar.h>
Go to the source code of this file.
Data Structures | |
| struct | sendfile_sync |
Macros | |
| #define | SOCK_CLOEXEC 0x10000000 |
| #define | SOCK_NONBLOCK 0x20000000 |
Functions | |
| __FBSDID ("$BSDSUniX$") | |
| static int | sendit (struct thread *td, int s, struct msghdr *mp, int flags) |
| static int | recvit (struct thread *td, int s, struct msghdr *mp, void *namelenp) |
| static int | accept1 (struct thread *td, struct accept_args *uap, int compat) |
| static int | do_sendfile (struct thread *td, struct sendfile_args *uap, int compat) |
| static int | getsockname1 (struct thread *td, struct getsockname_args *uap, int compat) |
| static int | getpeername1 (struct thread *td, struct getpeername_args *uap, int compat) |
| SYSCTL_INT (_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN,&nsfbufs, 0,"Maximum number of sendfile(2) sf_bufs available") | |
| SYSCTL_INT (_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD,&nsfbufspeak, 0,"Number of sendfile(2) sf_bufs at peak usage") | |
| SYSCTL_INT (_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD,&nsfbufsused, 0,"Number of sendfile(2) sf_bufs in use") | |
| static int | getsock_cap (struct filedesc *fdp, int fd, cap_rights_t rights, struct file **fpp, u_int *fflagp) |
| int | sys_socket (struct thread *td, struct socket_args *uap) |
| int | sys_bind (struct thread *td, struct bind_args *uap) |
| int | kern_bind (struct thread *td, int fd, struct sockaddr *sa) |
| int | sys_listen (struct thread *td, struct listen_args *uap) |
| int | kern_accept (struct thread *td, int s, struct sockaddr **name, socklen_t *namelen, struct file **fp) |
| int | sys_accept (struct thread *td, struct accept_args *uap) |
| int | sys_connect (struct thread *td, struct connect_args *uap) |
| int | kern_connect (struct thread *td, int fd, struct sockaddr *sa) |
| int | kern_socketpair (struct thread *td, int domain, int type, int protocol, int *rsv) |
| int | sys_socketpair (struct thread *td, struct socketpair_args *uap) |
| int | kern_sendit (struct thread *td, int s, struct msghdr *mp, int flags, struct mbuf *control, enum uio_seg segflg) |
| int | sys_sendto (struct thread *td, struct sendto_args *uap) |
| int | sys_sendmsg (struct thread *td, struct sendmsg_args *uap) |
| int | kern_recvit (struct thread *td, int s, struct msghdr *mp, enum uio_seg fromseg, struct mbuf **controlp) |
| int | sys_recvfrom (struct thread *td, struct recvfrom_args *uap) |
| int | sys_recvmsg (struct thread *td, struct recvmsg_args *uap) |
| int | sys_shutdown (struct thread *td, struct shutdown_args *uap) |
| int | sys_setsockopt (struct thread *td, struct setsockopt_args *uap) |
| int | kern_setsockopt (struct thread *td, int s, int level, int name, void *val, enum uio_seg valseg, socklen_t valsize) |
| int | sys_getsockopt (struct thread *td, struct getsockopt_args *uap) |
| int | kern_getsockopt (struct thread *td, int s, int level, int name, void *val, enum uio_seg valseg, socklen_t *valsize) |
| int | kern_getsockname (struct thread *td, int fd, struct sockaddr **sa, socklen_t *alen) |
| int | sys_getsockname (struct thread *td, struct getsockname_args *uap) |
| int | kern_getpeername (struct thread *td, int fd, struct sockaddr **sa, socklen_t *alen) |
| int | sys_getpeername (struct thread *td, struct getpeername_args *uap) |
| int | sockargs (struct mbuf **mp, caddr_t buf, int buflen, int type) |
| int | getsockaddr (struct sockaddr **namp, caddr_t uaddr, size_t len) |
| void | sf_buf_mext (void *addr, void *args) |
| int | sys_sendfile (struct thread *td, struct sendfile_args *uap) |
| int | kern_sendfile (struct thread *td, struct sendfile_args *uap, struct uio *hdr_uio, struct uio *trl_uio, int compat) |
| int | sys_sctp_peeloff (struct thread *td, struct sctp_peeloff_args *uap) |
| int | sys_sctp_generic_sendmsg (struct thread *td, struct sctp_generic_sendmsg_args *uap) |
| int | sys_sctp_generic_sendmsg_iov (struct thread *td, struct sctp_generic_sendmsg_iov_args *uap) |
| int | sys_sctp_generic_recvmsg (struct thread *td, struct sctp_generic_recvmsg_args *uap) |
Variables | |
| int | nsfbufs |
| int | nsfbufspeak |
| int | nsfbufsused |
| #define SOCK_CLOEXEC 0x10000000 |
Definition at line 103 of file uipc_syscalls.c.
Referenced by kern_socketpair(), and sys_socket().
| #define SOCK_NONBLOCK 0x20000000 |
Definition at line 104 of file uipc_syscalls.c.
Referenced by kern_socketpair(), and sys_socket().
| __FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 314 of file uipc_syscalls.c.
References fdclose(), free(), kern_accept(), and name.
Referenced by sys_accept().


|
static |
Definition at line 1814 of file uipc_syscalls.c.
References copyinuio(), free(), and kern_sendfile().
Referenced by sys_sendfile().


|
static |
Definition at line 1586 of file uipc_syscalls.c.
References free(), and kern_getpeername().
Referenced by sys_getpeername().


|
static |
Definition at line 136 of file uipc_syscalls.c.
References cap_funwrap(), and fget_unlocked().
Referenced by kern_accept(), kern_bind(), kern_connect(), kern_getpeername(), kern_getsockname(), kern_getsockopt(), kern_recvit(), kern_sendfile(), kern_sendit(), kern_setsockopt(), sys_listen(), sys_sctp_generic_recvmsg(), sys_sctp_generic_sendmsg(), sys_sctp_generic_sendmsg_iov(), and sys_shutdown().


| int getsockaddr | ( | struct sockaddr ** | namp, |
| caddr_t | uaddr, | ||
| size_t | len | ||
| ) |
Definition at line 1729 of file uipc_syscalls.c.
References free(), and malloc().
Referenced by sendit(), sys_bind(), sys_connect(), sys_sctp_generic_sendmsg(), and sys_sctp_generic_sendmsg_iov().


|
static |
Definition at line 1486 of file uipc_syscalls.c.
References free(), and kern_getsockname().
Referenced by sys_getsockname().


| int kern_accept | ( | struct thread * | td, |
| int | s, | ||
| struct sockaddr ** | name, | ||
| socklen_t * | namelen, | ||
| struct file ** | fp | ||
| ) |
Definition at line 366 of file uipc_syscalls.c.
References accept_mtx, falloc(), fd, fdclose(), fgetown(), finit(), free(), fsetown(), getsock_cap(), soaccept(), and socketops.
Referenced by accept1().


| int kern_bind | ( | struct thread * | td, |
| int | fd, | ||
| struct sockaddr * | sa | ||
| ) |
Definition at line 256 of file uipc_syscalls.c.
References getsock_cap(), and sobind().
Referenced by sys_bind().


| int kern_connect | ( | struct thread * | td, |
| int | fd, | ||
| struct sockaddr * | sa | ||
| ) |
Definition at line 564 of file uipc_syscalls.c.
References getsock_cap(), and soconnect().
Referenced by sys_connect().


| int kern_getpeername | ( | struct thread * | td, |
| int | fd, | ||
| struct sockaddr ** | sa, | ||
| socklen_t * | alen | ||
| ) |
Definition at line 1621 of file uipc_syscalls.c.
References free(), and getsock_cap().
Referenced by getpeername1().


| int kern_getsockname | ( | struct thread * | td, |
| int | fd, | ||
| struct sockaddr ** | sa, | ||
| socklen_t * | alen | ||
| ) |
Definition at line 1521 of file uipc_syscalls.c.
References free(), and getsock_cap().
Referenced by getsockname1().


| int kern_getsockopt | ( | struct thread * | td, |
| int | s, | ||
| int | level, | ||
| int | name, | ||
| void * | val, | ||
| enum uio_seg | valseg, | ||
| socklen_t * | valsize | ||
| ) |
Definition at line 1435 of file uipc_syscalls.c.
References getsock_cap(), level, name, panic(), and sogetopt().
Referenced by sys_getsockopt().


| int kern_recvit | ( | struct thread * | td, |
| int | s, | ||
| struct msghdr * | mp, | ||
| enum uio_seg | fromseg, | ||
| struct mbuf ** | controlp | ||
| ) |
Definition at line 989 of file uipc_syscalls.c.
References cloneuio(), free(), getsock_cap(), m_freem(), and soreceive().
Referenced by recvit().


| int kern_sendfile | ( | struct thread * | td, |
| struct sendfile_args * | uap, | ||
| struct uio * | hdr_uio, | ||
| struct uio * | trl_uio, | ||
| int | compat | ||
| ) |
Definition at line 1867 of file uipc_syscalls.c.
References sendfile_sync::count, sendfile_sync::cv, cv_destroy(), cv_init(), fgetvp_read(), free(), getsock_cap(), kern_writev(), m_freem(), m_length(), m_uiotombuf(), malloc(), mbstat, sendfile_sync::mtx, mtx_destroy(), mtx_init(), sblock(), sbunlock(), sbwait(), sf_buf_mext(), vn_rdwr(), and vrele().
Referenced by do_sendfile().


| int kern_sendit | ( | struct thread * | td, |
| int | s, | ||
| struct msghdr * | mp, | ||
| int | flags, | ||
| struct mbuf * | control, | ||
| enum uio_seg | segflg | ||
| ) |
Definition at line 787 of file uipc_syscalls.c.
References cloneuio(), getsock_cap(), sosend(), and tdsignal().
Referenced by sendit().


| int kern_setsockopt | ( | struct thread * | td, |
| int | s, | ||
| int | level, | ||
| int | name, | ||
| void * | val, | ||
| enum uio_seg | valseg, | ||
| socklen_t | valsize | ||
| ) |
Definition at line 1356 of file uipc_syscalls.c.
References getsock_cap(), level, name, panic(), and sosetopt().
Referenced by sys_setsockopt().


| int kern_socketpair | ( | struct thread * | td, |
| int | domain, | ||
| int | type, | ||
| int | protocol, | ||
| int * | rsv | ||
| ) |
Definition at line 625 of file uipc_syscalls.c.
References falloc(), fd, fdclose(), finit(), SOCK_CLOEXEC, SOCK_NONBLOCK, socketops, soclose(), soconnect2(), and socreate().
Referenced by sys_socketpair().


|
static |
Definition at line 1149 of file uipc_syscalls.c.
References kern_recvit().
Referenced by sys_recvfrom(), and sys_recvmsg().


|
static |
Definition at line 724 of file uipc_syscalls.c.
References free(), getsockaddr(), kern_sendit(), and sockargs().
Referenced by sys_sendmsg(), and sys_sendto().


| void sf_buf_mext | ( | void * | addr, |
| void * | args | ||
| ) |
Definition at line 1768 of file uipc_syscalls.c.
References sendfile_sync::count, sendfile_sync::cv, cv_signal(), and sendfile_sync::mtx.
Referenced by kern_sendfile().


| int sockargs | ( | struct mbuf ** | mp, |
| caddr_t | buf, | ||
| int | buflen, | ||
| int | type | ||
| ) |
Definition at line 1688 of file uipc_syscalls.c.
Referenced by sendit().

| int sys_accept | ( | struct thread * | td, |
| struct accept_args * | uap | ||
| ) |
Definition at line 521 of file uipc_syscalls.c.
References accept1().

| int sys_bind | ( | struct thread * | td, |
| struct bind_args * | uap | ||
| ) |
Definition at line 236 of file uipc_syscalls.c.
References free(), getsockaddr(), and kern_bind().

| int sys_connect | ( | struct thread * | td, |
| struct connect_args * | uap | ||
| ) |
Definition at line 542 of file uipc_syscalls.c.
References free(), getsockaddr(), and kern_connect().

| int sys_getpeername | ( | struct thread * | td, |
| struct getpeername_args * | uap | ||
| ) |
Definition at line 1667 of file uipc_syscalls.c.
References getpeername1().

| int sys_getsockname | ( | struct thread * | td, |
| struct getsockname_args * | uap | ||
| ) |
Definition at line 1562 of file uipc_syscalls.c.
References getsockname1().

| int sys_getsockopt | ( | struct thread * | td, |
| struct getsockopt_args * | uap | ||
| ) |
Definition at line 1403 of file uipc_syscalls.c.
References kern_getsockopt().

| int sys_listen | ( | struct thread * | td, |
| struct listen_args * | uap | ||
| ) |
Definition at line 285 of file uipc_syscalls.c.
References getsock_cap(), and solisten().

| int sys_recvfrom | ( | struct thread * | td, |
| struct recvfrom_args * | uap | ||
| ) |
Definition at line 1171 of file uipc_syscalls.c.
References recvit().

| int sys_recvmsg | ( | struct thread * | td, |
| struct recvmsg_args * | uap | ||
| ) |
Definition at line 1281 of file uipc_syscalls.c.
References copyiniov(), free(), and recvit().

| int sys_sctp_generic_recvmsg | ( | struct thread * | td, |
| struct sctp_generic_recvmsg_args * | uap | ||
| ) |
Definition at line 2697 of file uipc_syscalls.c.
References cloneuio(), copyiniov(), free(), and getsock_cap().

| int sys_sctp_generic_sendmsg | ( | struct thread * | td, |
| struct sctp_generic_sendmsg_args * | uap | ||
| ) |
Definition at line 2459 of file uipc_syscalls.c.
References free(), getsock_cap(), getsockaddr(), and tdsignal().

| int sys_sctp_generic_sendmsg_iov | ( | struct thread * | td, |
| struct sctp_generic_sendmsg_iov_args * | uap | ||
| ) |
Definition at line 2570 of file uipc_syscalls.c.
References copyiniov(), free(), getsock_cap(), getsockaddr(), and tdsignal().

| int sys_sctp_peeloff | ( | struct thread * | td, |
| struct sctp_peeloff_args * | uap | ||
| ) |
Definition at line 2366 of file uipc_syscalls.c.
References falloc(), fd, fdclose(), fgetown(), fgetsock(), finit(), fputsock(), fsetown(), socketops, and sonewconn().

| int sys_sendfile | ( | struct thread * | td, |
| struct sendfile_args * | uap | ||
| ) |
Definition at line 1807 of file uipc_syscalls.c.
References do_sendfile().

| int sys_sendmsg | ( | struct thread * | td, |
| struct sendmsg_args * | uap | ||
| ) |
Definition at line 961 of file uipc_syscalls.c.
References copyiniov(), free(), and sendit().

| int sys_sendto | ( | struct thread * | td, |
| struct sendto_args * | uap | ||
| ) |
Definition at line 877 of file uipc_syscalls.c.
References sendit().

| int sys_setsockopt | ( | struct thread * | td, |
| struct setsockopt_args * | uap | ||
| ) |
Definition at line 1340 of file uipc_syscalls.c.
References kern_setsockopt().

| int sys_shutdown | ( | struct thread * | td, |
| struct shutdown_args * | uap | ||
| ) |
Definition at line 1316 of file uipc_syscalls.c.
References getsock_cap(), and soshutdown().

| int sys_socket | ( | struct thread * | td, |
| struct socket_args * | uap | ||
| ) |
Definition at line 182 of file uipc_syscalls.c.
References falloc(), fd, fdclose(), finit(), SOCK_CLOEXEC, SOCK_NONBLOCK, socketops, socreate(), and type.

| int sys_socketpair | ( | struct thread * | td, |
| struct socketpair_args * | uap | ||
| ) |
Definition at line 707 of file uipc_syscalls.c.
References kern_close(), and kern_socketpair().

| SYSCTL_INT | ( | _kern_ipc | , |
| OID_AUTO | , | ||
| nsfbufs | , | ||
| CTLFLAG_RDTUN | , | ||
| & | nsfbufs, | ||
| 0 | , | ||
| "Maximum number of sendfile(2) sf_bufs available" | |||
| ) |
| SYSCTL_INT | ( | _kern_ipc | , |
| OID_AUTO | , | ||
| nsfbufspeak | , | ||
| CTLFLAG_RD | , | ||
| & | nsfbufspeak, | ||
| 0 | , | ||
| "Number of sendfile(2) sf_bufs at peak usage" | |||
| ) |
| SYSCTL_INT | ( | _kern_ipc | , |
| OID_AUTO | , | ||
| nsfbufsused | , | ||
| CTLFLAG_RD | , | ||
| & | nsfbufsused, | ||
| 0 | , | ||
| "Number of sendfile(2) sf_bufs in use" | |||
| ) |
| int nsfbufs |
Definition at line 119 of file uipc_syscalls.c.
| int nsfbufspeak |
Definition at line 120 of file uipc_syscalls.c.
| int nsfbufsused |
Definition at line 121 of file uipc_syscalls.c.