diff options
author | ru <ru@FreeBSD.org> | 2007-02-26 10:45:21 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2007-02-26 10:45:21 +0000 |
commit | 56c88fa187ea72314142cb0eadc01042db0031e6 (patch) | |
tree | d898d9ec565518178ef02634f4397e0b72663f21 | |
parent | 5023c1b4ee8a7f34e51ecae1be77e1409258af96 (diff) | |
download | FreeBSD-src-56c88fa187ea72314142cb0eadc01042db0031e6.zip FreeBSD-src-56c88fa187ea72314142cb0eadc01042db0031e6.tar.gz |
Don't block on the socket zone limit during the socket()
call which can easily lock up a system otherwise; instead,
return ENOBUFS as documented in a manpage, thus reverting
us to the FreeBSD 4.x behavior.
Reviewed by: rwatson
MFC after: 2 weeks
-rw-r--r-- | sys/kern/uipc_socket.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index a8d2736..eaf45a01 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -257,15 +257,15 @@ SYSINIT(param, SI_SUB_TUNABLES, SI_ORDER_ANY, init_maxsockets, NULL); * soalloc() returns a socket with a ref count of 0. */ static struct socket * -soalloc(int mflags) +soalloc(void) { struct socket *so; - so = uma_zalloc(socket_zone, mflags | M_ZERO); + so = uma_zalloc(socket_zone, M_NOWAIT | M_ZERO); if (so == NULL) return (NULL); #ifdef MAC - if (mac_init_socket(so, mflags) != 0) { + if (mac_init_socket(so, M_NOWAIT) != 0) { uma_zfree(socket_zone, so); return (NULL); } @@ -351,7 +351,7 @@ socreate(dom, aso, type, proto, cred, td) if (prp->pr_type != type) return (EPROTOTYPE); - so = soalloc(M_WAITOK); + so = soalloc(); if (so == NULL) return (ENOBUFS); @@ -416,7 +416,7 @@ sonewconn(head, connstatus) if (over) #endif return (NULL); - so = soalloc(M_NOWAIT); + so = soalloc(); if (so == NULL) return (NULL); if ((head->so_options & SO_ACCEPTFILTER) != 0) |