FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_kern_tls.h"
#include "opt_param.h"
#include <sys/param.h>
#include <sys/aio.h>
#include <sys/kernel.h>
#include <sys/ktls.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/resourcevar.h>
#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
Go to the source code of this file.
Macros | |
#define | SBLINKRECORD(sb, m0) |
Functions | |
__FBSDID ("$FreeBSD$") | |
static struct mbuf * | sbcut_internal (struct sockbuf *sb, int len) |
static void | sbflush_internal (struct sockbuf *sb) |
static void | sbm_clrprotoflags (struct mbuf *m, int flags) |
static void | sbready_compress (struct sockbuf *sb, struct mbuf *m0, struct mbuf *end) |
int | sbready (struct sockbuf *sb, struct mbuf *m0, int count) |
void | sballoc (struct sockbuf *sb, struct mbuf *m) |
void | sbfree (struct sockbuf *sb, struct mbuf *m) |
void | socantsendmore_locked (struct socket *so) |
void | socantsendmore (struct socket *so) |
void | socantrcvmore_locked (struct socket *so) |
void | socantrcvmore (struct socket *so) |
void | soroverflow_locked (struct socket *so) |
void | soroverflow (struct socket *so) |
int | sbwait (struct sockbuf *sb) |
void | sowakeup (struct socket *so, struct sockbuf *sb) |
int | soreserve (struct socket *so, u_long sndcc, u_long rcvcc) |
static int | sysctl_handle_sb_max (SYSCTL_HANDLER_ARGS) |
int | sbreserve_locked (struct sockbuf *sb, u_long cc, struct socket *so, struct thread *td) |
int | sbsetopt (struct socket *so, int cmd, u_long cc) |
void | sbrelease_internal (struct sockbuf *sb, struct socket *so) |
void | sbrelease_locked (struct sockbuf *sb, struct socket *so) |
void | sbrelease (struct sockbuf *sb, struct socket *so) |
void | sbdestroy (struct sockbuf *sb, struct socket *so) |
void | sbappend_locked (struct sockbuf *sb, struct mbuf *m, int flags) |
void | sbappend (struct sockbuf *sb, struct mbuf *m, int flags) |
void | sbappendstream_locked (struct sockbuf *sb, struct mbuf *m, int flags) |
void | sbappendstream (struct sockbuf *sb, struct mbuf *m, int flags) |
void | sbappendrecord_locked (struct sockbuf *sb, struct mbuf *m0) |
void | sbappendrecord (struct sockbuf *sb, struct mbuf *m0) |
static int | sbappendaddr_locked_internal (struct sockbuf *sb, const struct sockaddr *asa, struct mbuf *m0, struct mbuf *control, struct mbuf *ctrl_last) |
int | sbappendaddr_locked (struct sockbuf *sb, const struct sockaddr *asa, struct mbuf *m0, struct mbuf *control) |
int | sbappendaddr_nospacecheck_locked (struct sockbuf *sb, const struct sockaddr *asa, struct mbuf *m0, struct mbuf *control) |
int | sbappendaddr (struct sockbuf *sb, const struct sockaddr *asa, struct mbuf *m0, struct mbuf *control) |
void | sbappendcontrol_locked (struct sockbuf *sb, struct mbuf *m0, struct mbuf *control, int flags) |
void | sbappendcontrol (struct sockbuf *sb, struct mbuf *m0, struct mbuf *control, int flags) |
void | sbcompress (struct sockbuf *sb, struct mbuf *m, struct mbuf *n) |
void | sbflush_locked (struct sockbuf *sb) |
void | sbflush (struct sockbuf *sb) |
void | sbdrop_locked (struct sockbuf *sb, int len) |
struct mbuf * | sbcut_locked (struct sockbuf *sb, int len) |
void | sbdrop (struct sockbuf *sb, int len) |
struct mbuf * | sbsndptr_noadv (struct sockbuf *sb, uint32_t off, uint32_t *moff) |
void | sbsndptr_adv (struct sockbuf *sb, struct mbuf *mb, uint32_t len) |
struct mbuf * | sbsndmbuf (struct sockbuf *sb, u_int off, u_int *moff) |
void | sbdroprecord_locked (struct sockbuf *sb) |
void | sbdroprecord (struct sockbuf *sb) |
struct mbuf * | sbcreatecontrol_how (void *p, int size, int type, int level, int wait) |
struct mbuf * | sbcreatecontrol (caddr_t p, int size, int type, int level) |
void | sbtoxsockbuf (struct sockbuf *sb, struct xsockbuf *xsb) |
SYSCTL_INT (_kern, KERN_DUMMY, dummy, CTLFLAG_RW|CTLFLAG_SKIP, &dummy, 0, "") | |
SYSCTL_OID (_kern_ipc, KIPC_MAXSOCKBUF, maxsockbuf, CTLTYPE_ULONG|CTLFLAG_RW|CTLFLAG_MPSAFE, &sb_max, 0, sysctl_handle_sb_max, "LU", "Maximum socket buffer size") | |
SYSCTL_ULONG (_kern_ipc, KIPC_SOCKBUF_WASTE, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency, 0, "Socket buffer size waste factor") | |
Variables | |
void(* | aio_swake )(struct socket *, struct sockbuf *) |
u_long | sb_max = SB_MAX |
u_long | sb_max_adj |
static u_long | sb_efficiency = 8 |
static int | dummy |
#define SBLINKRECORD | ( | sb, | |
m0 | |||
) |
Definition at line 843 of file uipc_sockbuf.c.
__FBSDID | ( | "$FreeBSD$" | ) |
void sballoc | ( | struct sockbuf * | sb, |
struct mbuf * | m | ||
) |
Definition at line 265 of file uipc_sockbuf.c.
Referenced by sbappendaddr_locked_internal(), sbappendcontrol_locked(), sbappendrecord_locked(), and sbcompress().
void sbappend | ( | struct sockbuf * | sb, |
struct mbuf * | m, | ||
int | flags | ||
) |
Definition at line 909 of file uipc_sockbuf.c.
References flags, and sbappend_locked().
void sbappend_locked | ( | struct sockbuf * | sb, |
struct mbuf * | m, | ||
int | flags | ||
) |
Definition at line 858 of file uipc_sockbuf.c.
References flags, sbappendrecord_locked(), sbcompress(), and sbm_clrprotoflags().
Referenced by sbappend(), and uipc_send().
int sbappendaddr | ( | struct sockbuf * | sb, |
const struct sockaddr * | asa, | ||
struct mbuf * | m0, | ||
struct mbuf * | control | ||
) |
Definition at line 1230 of file uipc_sockbuf.c.
References sbappendaddr_locked().
int sbappendaddr_locked | ( | struct sockbuf * | sb, |
const struct sockaddr * | asa, | ||
struct mbuf * | m0, | ||
struct mbuf * | control | ||
) |
Definition at line 1186 of file uipc_sockbuf.c.
References m_length(), panic(), and sbappendaddr_locked_internal().
Referenced by sbappendaddr(), and uipc_send().
|
static |
Definition at line 1133 of file uipc_sockbuf.c.
References m_tag_delete_chain(), sballoc(), and SBLINKRECORD.
Referenced by sbappendaddr_locked(), and sbappendaddr_nospacecheck_locked().
int sbappendaddr_nospacecheck_locked | ( | struct sockbuf * | sb, |
const struct sockaddr * | asa, | ||
struct mbuf * | m0, | ||
struct mbuf * | control | ||
) |
Definition at line 1212 of file uipc_sockbuf.c.
References sbappendaddr_locked_internal().
Referenced by uipc_send().
void sbappendcontrol | ( | struct sockbuf * | sb, |
struct mbuf * | m0, | ||
struct mbuf * | control, | ||
int | flags | ||
) |
Definition at line 1265 of file uipc_sockbuf.c.
References flags, and sbappendcontrol_locked().
void sbappendcontrol_locked | ( | struct sockbuf * | sb, |
struct mbuf * | m0, | ||
struct mbuf * | control, | ||
int | flags | ||
) |
Definition at line 1242 of file uipc_sockbuf.c.
References flags, sballoc(), SBLINKRECORD, and sbm_clrprotoflags().
Referenced by ktls_decrypt(), sbappendcontrol(), and uipc_send().
void sbappendrecord | ( | struct sockbuf * | sb, |
struct mbuf * | m0 | ||
) |
Definition at line 1123 of file uipc_sockbuf.c.
References sbappendrecord_locked().
void sbappendrecord_locked | ( | struct sockbuf * | sb, |
struct mbuf * | m0 | ||
) |
Definition at line 1092 of file uipc_sockbuf.c.
References sballoc(), sbcompress(), and SBLINKRECORD.
Referenced by sbappend_locked(), and sbappendrecord().
void sbappendstream | ( | struct sockbuf * | sb, |
struct mbuf * | m, | ||
int | flags | ||
) |
Definition at line 988 of file uipc_sockbuf.c.
References flags, and sbappendstream_locked().
void sbappendstream_locked | ( | struct sockbuf * | sb, |
struct mbuf * | m, | ||
int | flags | ||
) |
Definition at line 946 of file uipc_sockbuf.c.
References flags, ktls_seq(), m_demote(), and sbcompress().
Referenced by sbappendstream().
void sbcompress | ( | struct sockbuf * | sb, |
struct mbuf * | m, | ||
struct mbuf * | n | ||
) |
Definition at line 1295 of file uipc_sockbuf.c.
References m_copydata(), mb_unmapped_compress(), and sballoc().
Referenced by sbappend_locked(), sbappendrecord_locked(), and sbappendstream_locked().
struct mbuf * sbcreatecontrol | ( | caddr_t | p, |
int | size, | ||
int | type, | ||
int | level | ||
) |
Definition at line 1756 of file uipc_sockbuf.c.
References level, sbcreatecontrol_how(), and type.
Referenced by unp_addsockcred(), unp_externalize(), and unp_internalize().
struct mbuf * sbcreatecontrol_how | ( | void * | p, |
int | size, | ||
int | type, | ||
int | level, | ||
int | wait | ||
) |
Definition at line 1723 of file uipc_sockbuf.c.
Referenced by ktls_decrypt(), and sbcreatecontrol().
|
static |
Definition at line 1456 of file uipc_sockbuf.c.
References sbfree().
Referenced by sbcut_locked(), sbdrop(), sbdrop_locked(), and sbflush_internal().
struct mbuf * sbcut_locked | ( | struct sockbuf * | sb, |
int | len | ||
) |
Definition at line 1584 of file uipc_sockbuf.c.
References sbcut_internal().
Referenced by soreceive_generic().
void sbdestroy | ( | struct sockbuf * | sb, |
struct socket * | so | ||
) |
Definition at line 742 of file uipc_sockbuf.c.
References sbrelease_internal().
Referenced by sofree(), and solisten_proto().
void sbdrop | ( | struct sockbuf * | sb, |
int | len | ||
) |
Definition at line 1592 of file uipc_sockbuf.c.
References m_freem(), and sbcut_internal().
void sbdrop_locked | ( | struct sockbuf * | sb, |
int | len | ||
) |
Definition at line 1572 of file uipc_sockbuf.c.
References m_freem(), and sbcut_internal().
Referenced by soisdisconnected(), and soreceive_stream().
void sbdroprecord | ( | struct sockbuf * | sb | ) |
Definition at line 1710 of file uipc_sockbuf.c.
References sbdroprecord_locked().
void sbdroprecord_locked | ( | struct sockbuf * | sb | ) |
Definition at line 1688 of file uipc_sockbuf.c.
References sbfree().
Referenced by sbdroprecord(), and soreceive_generic().
void sbflush | ( | struct sockbuf * | sb | ) |
Definition at line 1444 of file uipc_sockbuf.c.
References sbflush_locked().
|
static |
Definition at line 1418 of file uipc_sockbuf.c.
References m_freem(), and sbcut_internal().
Referenced by sbflush_locked(), and sbrelease_internal().
void sbflush_locked | ( | struct sockbuf * | sb | ) |
Definition at line 1436 of file uipc_sockbuf.c.
References sbflush_internal().
Referenced by sbflush().
void sbfree | ( | struct sockbuf * | sb, |
struct mbuf * | m | ||
) |
Definition at line 296 of file uipc_sockbuf.c.
Referenced by sbcut_internal(), sbdroprecord_locked(), soreceive_dgram(), soreceive_generic(), and soreceive_stream().
|
static |
Definition at line 84 of file uipc_sockbuf.c.
Referenced by sbappend_locked(), and sbappendcontrol_locked().
int sbready | ( | struct sockbuf * | sb, |
struct mbuf * | m0, | ||
int | count | ||
) |
Definition at line 200 of file uipc_sockbuf.c.
References count, and sbready_compress().
Referenced by uipc_ready(), and uipc_ready_scan().
|
static |
Definition at line 107 of file uipc_sockbuf.c.
References m_copydata(), and mb_unmapped_compress().
Referenced by sbready().
void sbrelease | ( | struct sockbuf * | sb, |
struct socket * | so | ||
) |
Definition at line 733 of file uipc_sockbuf.c.
References sbrelease_locked().
Referenced by uipc_detach().
void sbrelease_internal | ( | struct sockbuf * | sb, |
struct socket * | so | ||
) |
Definition at line 714 of file uipc_sockbuf.c.
References chgsbsize(), and sbflush_internal().
Referenced by sbdestroy(), sbrelease_locked(), and sorflush().
void sbrelease_locked | ( | struct sockbuf * | sb, |
struct socket * | so | ||
) |
Definition at line 724 of file uipc_sockbuf.c.
References sbrelease_internal().
Referenced by sbrelease(), and soreserve().
int sbreserve_locked | ( | struct sockbuf * | sb, |
u_long | cc, | ||
struct socket * | so, | ||
struct thread * | td | ||
) |
Definition at line 604 of file uipc_sockbuf.c.
References chgsbsize(), lim_cur(), sb_efficiency, sb_max, and sb_max_adj.
Referenced by sbsetopt(), and soreserve().
int sbsetopt | ( | struct socket * | so, |
int | cmd, | ||
u_long | cc | ||
) |
Definition at line 634 of file uipc_sockbuf.c.
References flags, sb_max_adj, and sbreserve_locked().
Referenced by sosetopt().
struct mbuf * sbsndmbuf | ( | struct sockbuf * | sb, |
u_int | off, | ||
u_int * | moff | ||
) |
Definition at line 1657 of file uipc_sockbuf.c.
void sbsndptr_adv | ( | struct sockbuf * | sb, |
struct mbuf * | mb, | ||
uint32_t | len | ||
) |
Definition at line 1625 of file uipc_sockbuf.c.
struct mbuf * sbsndptr_noadv | ( | struct sockbuf * | sb, |
uint32_t | off, | ||
uint32_t * | moff | ||
) |
Definition at line 1604 of file uipc_sockbuf.c.
void sbtoxsockbuf | ( | struct sockbuf * | sb, |
struct xsockbuf * | xsb | ||
) |
Definition at line 1770 of file uipc_sockbuf.c.
Referenced by sotoxsocket().
int sbwait | ( | struct sockbuf * | sb | ) |
Definition at line 467 of file uipc_sockbuf.c.
Referenced by soreceive_dgram(), soreceive_generic(), soreceive_stream(), sosend_generic(), and vn_sendfile().
void socantrcvmore | ( | struct socket * | so | ) |
Definition at line 431 of file uipc_sockbuf.c.
References socantrcvmore_locked().
Referenced by sorflush(), and unp_shutdown().
void socantrcvmore_locked | ( | struct socket * | so | ) |
Definition at line 416 of file uipc_sockbuf.c.
References ktls_check_rx().
Referenced by socantrcvmore(), soisdisconnected(), and soisdisconnecting().
void socantsendmore | ( | struct socket * | so | ) |
Definition at line 407 of file uipc_sockbuf.c.
References socantsendmore_locked().
Referenced by uipc_send(), and uipc_shutdown().
void socantsendmore_locked | ( | struct socket * | so | ) |
Definition at line 396 of file uipc_sockbuf.c.
Referenced by socantsendmore(), soisdisconnected(), and soisdisconnecting().
int soreserve | ( | struct socket * | so, |
u_long | sndcc, | ||
u_long | rcvcc | ||
) |
Definition at line 556 of file uipc_sockbuf.c.
References sbrelease_locked(), and sbreserve_locked().
Referenced by sonewconn(), and uipc_attach().
void soroverflow | ( | struct socket * | so | ) |
Definition at line 455 of file uipc_sockbuf.c.
References soroverflow_locked().
void soroverflow_locked | ( | struct socket * | so | ) |
Definition at line 440 of file uipc_sockbuf.c.
Referenced by soroverflow(), and uipc_send().
void sowakeup | ( | struct socket * | so, |
struct sockbuf * | sb | ||
) |
Definition at line 491 of file uipc_sockbuf.c.
References pgsigio(), selwakeuppri(), soisconnected(), soupcall_clear(), sowakeup_aio(), and wakeup().
|
static |
Definition at line 584 of file uipc_sockbuf.c.
References sb_max, sb_max_adj, and sysctl_handle_long().
SYSCTL_INT | ( | _kern | , |
KERN_DUMMY | , | ||
dummy | , | ||
CTLFLAG_RW| | CTLFLAG_SKIP, | ||
& | dummy, | ||
0 | , | ||
"" | |||
) |
SYSCTL_OID | ( | _kern_ipc | , |
KIPC_MAXSOCKBUF | , | ||
maxsockbuf | , | ||
CTLTYPE_ULONG|CTLFLAG_RW| | CTLFLAG_MPSAFE, | ||
& | sb_max, | ||
0 | , | ||
sysctl_handle_sb_max | , | ||
"LU" | , | ||
"Maximum socket buffer size" | |||
) |
SYSCTL_ULONG | ( | _kern_ipc | , |
KIPC_SOCKBUF_WASTE | , | ||
sockbuf_waste_factor | , | ||
CTLFLAG_RW | , | ||
& | sb_efficiency, | ||
0 | , | ||
"Socket buffer size waste factor" | |||
) |
void(* aio_swake) (struct socket *, struct sockbuf *) | ( | struct socket * | , |
struct sockbuf * | |||
) |
Definition at line 61 of file uipc_sockbuf.c.
|
static |
Definition at line 1785 of file uipc_sockbuf.c.
|
static |
Definition at line 71 of file uipc_sockbuf.c.
Referenced by sbreserve_locked().
u_long sb_max = SB_MAX |
Definition at line 67 of file uipc_sockbuf.c.
Referenced by sbreserve_locked(), and sysctl_handle_sb_max().
u_long sb_max_adj |
Definition at line 68 of file uipc_sockbuf.c.
Referenced by sbreserve_locked(), sbsetopt(), and sysctl_handle_sb_max().