From owner-cvs-all@FreeBSD.ORG Fri Jul 21 20:40:14 2006 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F3E416A4E0; Fri, 21 Jul 2006 20:40:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B7C8D43D45; Fri, 21 Jul 2006 20:40:13 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6LKeDYd004440; Fri, 21 Jul 2006 20:40:13 GMT (envelope-from jhb@repoman.freebsd.org) Received: (from jhb@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6LKeDZZ004439; Fri, 21 Jul 2006 20:40:13 GMT (envelope-from jhb) Message-Id: <200607212040.k6LKeDZZ004439@repoman.freebsd.org> From: John Baldwin Date: Fri, 21 Jul 2006 20:40:13 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/compat/svr4 svr4_socket.c svr4_socket.h svr4_stream.c svr4_sysvec.c src/sys/dev/streams streams.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Jul 2006 20:40:14 -0000 jhb 2006-07-21 20:40:13 UTC FreeBSD src repository Modified files: sys/compat/svr4 svr4_socket.c svr4_socket.h svr4_stream.c svr4_sysvec.c sys/dev/streams streams.c Log: Clean up the svr4 socket cache and streams code some to make it more easily locked. - Move all the svr4 socket cache code into svr4_socket.c, specifically move svr4_delete_socket() over from streams.c. Make the socket cache entry structure and svr4_head private to svr4_socket.c as a result. - Add a mutex to protect the svr4 socket cache. - Change svr4_find_socket() to copy the sockaddr_un struct into a caller-supplied sockaddr_un rather than giving the caller a pointer to our internal one. This removes the one case where code outside of svr4_socket.c could access data in the cache. - Add an eventhandler for process_exit and process_exec to purge the cache of any entries for the exiting or execing process. - Add methods to init and destroy the socket cache and call them from the svr4 ABI module's event handler. - Conditionally grab Giant around socreate() in streamsopen(). - Use fdclose() instead of inlining it in streamsopen() when handling socreate() failure. - Only allocate a stream structure and attach it to a socket in streamsopen(). Previously, if a svr4 program performed a stream operation on an arbitrary socket not opened via the streams device, we would attach streams state data to it and change f_ops of the associated struct file while it was in use. The latter was especially not safe, and if a program wants a stream object it should open it via the streams device anyway. - Don't bother locking so_emuldata in the streams code now that we only touch it right after creating a socket (in streamsopen()) or when tearing it down when the file is closed. - Remove D_NEEDGIANT from the streams device as it is no longer needed. Revision Changes Path 1.27 +90 -13 src/sys/compat/svr4/svr4_socket.c 1.10 +6 -17 src/sys/compat/svr4/svr4_socket.h 1.59 +2 -4 src/sys/compat/svr4/svr4_stream.c 1.42 +12 -6 src/sys/compat/svr4/svr4_sysvec.c 1.54 +29 -75 src/sys/dev/streams/streams.c