From f3500695899f1d9bea97953b3c47061bbe7ac1e7 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 20 Mar 2002 21:23:26 +0000 Subject: UMA permited us to utilize the 'waitok' flag to soalloc. --- sys/kern/uipc_socket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index f578dcd..3c1adf8 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -106,7 +106,6 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, numopensockets, CTLFLAG_RD, /* * Get a socket structure from our zone, and initialize it. - * We don't implement `waitok' yet (see comments in uipc_domain.c). * Note that it would probably be better to allocate socket * and PCB at the same time, but I'm not convinced that all * the protocols can be easily modified to do this. @@ -118,8 +117,14 @@ soalloc(waitok) int waitok; { struct socket *so; + int flag; - so = uma_zalloc(socket_zone, waitok); + if (waitok == 1) + flag = M_WAITOK; + else + flag = M_NOWAIT; + + so = uma_zalloc(socket_zone, flag); if (so) { /* XXX race condition for reentrant kernel */ bzero(so, sizeof *so); -- cgit v1.1