Date: Mon, 22 Jan 2007 16:05:47 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113346 for review Message-ID: <200701221605.l0MG5lMK027464@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113346 Change 113346 by millert@millert_macbook on 2007/01/22 16:05:42 Back out some changes to the vendor code that made soalloc() take M_WAIT or M_WAITOK instead of a boolean. There's no good reason to deviate like this and the conversion has been a source of several bugs. This does mean we need to be careful and convert waitok to M_WAITOK/M_NOWAIT when we call in to the framework but this is as simple as passing in !waitok instead. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_socket.c#8 edit .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_socket2.c#8 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_socket.c#8 (text+ko) ==== @@ -282,7 +282,7 @@ lck_mtx_unlock(so_cache_mtx); - if (waitok == M_WAITOK) + if (waitok) *so = (struct socket *) zalloc(so_cache_zone); else *so = (struct socket *) zalloc_noblock(so_cache_zone); @@ -432,7 +432,8 @@ so->so_gencnt = ++so_gencnt; so->so_zone = socket_zone; #ifdef MAC - if (mac_socket_label_init(so, waitok) != 0) { + /* Convert waitok to M_WAITOK/M_NOWAIT for MAC Framework. */ + if (mac_socket_label_init(so, !waitok) != 0) { sodealloc(so); return (NULL); } @@ -475,7 +476,7 @@ #endif if (prp->pr_type != type) return (EPROTOTYPE); - so = soalloc(M_WAITOK, dom, type); + so = soalloc(p != 0, dom, type); if (so == 0) return (ENOBUFS); ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_socket2.c#8 (text+ko) ==== @@ -286,7 +286,7 @@ if (head->so_qlen > 3 * head->so_qlimit / 2) return ((struct socket *)0); - so = soalloc(M_NOWAIT, head->so_proto->pr_domain->dom_family, head->so_type); + so = soalloc(1, head->so_proto->pr_domain->dom_family, head->so_type); if (so == NULL) return ((struct socket *)0); /* check if head was closed during the soalloc */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701221605.l0MG5lMK027464>