Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_socket.c
Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | * below, will not overflow. | ||||
*/ | */ | ||||
if (val < 1 || val > UINT_MAX / 3) | if (val < 1 || val > UINT_MAX / 3) | ||||
return (EINVAL); | return (EINVAL); | ||||
somaxconn = val; | somaxconn = val; | ||||
return (0); | return (0); | ||||
} | } | ||||
SYSCTL_PROC(_kern_ipc, OID_AUTO, soacceptqueue, CTLTYPE_UINT | CTLFLAG_RW, | SYSCTL_PROC(_kern_ipc, OID_AUTO, soacceptqueue, | ||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
0, sizeof(int), sysctl_somaxconn, "I", | 0, sizeof(int), sysctl_somaxconn, "I", | ||||
"Maximum listen socket pending connection accept queue size"); | "Maximum listen socket pending connection accept queue size"); | ||||
SYSCTL_PROC(_kern_ipc, KIPC_SOMAXCONN, somaxconn, | SYSCTL_PROC(_kern_ipc, KIPC_SOMAXCONN, somaxconn, | ||||
CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_SKIP, | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_NEEDGIANT, | ||||
0, sizeof(int), sysctl_somaxconn, "I", | 0, sizeof(int), sysctl_somaxconn, "I", | ||||
"Maximum listen socket pending connection accept queue size (compat)"); | "Maximum listen socket pending connection accept queue size (compat)"); | ||||
static int numopensockets; | static int numopensockets; | ||||
SYSCTL_INT(_kern_ipc, OID_AUTO, numopensockets, CTLFLAG_RD, | SYSCTL_INT(_kern_ipc, OID_AUTO, numopensockets, CTLFLAG_RD, | ||||
&numopensockets, 0, "Number of open sockets"); | &numopensockets, 0, "Number of open sockets"); | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | if (newmaxsockets > maxsockets && | ||||
newmaxsockets <= maxfiles) { | newmaxsockets <= maxfiles) { | ||||
maxsockets = newmaxsockets; | maxsockets = newmaxsockets; | ||||
EVENTHANDLER_INVOKE(maxsockets_change); | EVENTHANDLER_INVOKE(maxsockets_change); | ||||
} else | } else | ||||
error = EINVAL; | error = EINVAL; | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
SYSCTL_PROC(_kern_ipc, OID_AUTO, maxsockets, CTLTYPE_INT|CTLFLAG_RW, | SYSCTL_PROC(_kern_ipc, OID_AUTO, maxsockets, | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, | |||||
&maxsockets, 0, sysctl_maxsockets, "IU", | &maxsockets, 0, sysctl_maxsockets, "IU", | ||||
"Maximum number of sockets available"); | "Maximum number of sockets available"); | ||||
/* | /* | ||||
* Socket operation routines. These routines are called by the routines in | * Socket operation routines. These routines are called by the routines in | ||||
* sys_socket.c or from a system process, and implement the semantics of | * sys_socket.c or from a system process, and implement the semantics of | ||||
* socket operations by switching out to the protocol specific routines. | * socket operations by switching out to the protocol specific routines. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 3,872 Lines • Show Last 20 Lines |