From owner-cvs-src@FreeBSD.ORG Fri Feb 25 19:10:51 2005 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8DB616A4CE; Fri, 25 Feb 2005 19:10:51 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9407543D1F; Fri, 25 Feb 2005 19:10:51 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j1PJApIt001200; Fri, 25 Feb 2005 19:10:51 GMT (envelope-from rwatson@repoman.freebsd.org) Received: (from rwatson@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j1PJAp2d001199; Fri, 25 Feb 2005 19:10:51 GMT (envelope-from rwatson) Message-Id: <200502251910.j1PJAp2d001199@repoman.freebsd.org> From: Robert Watson Date: Fri, 25 Feb 2005 19:10:51 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/kern uipc_sem.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Feb 2005 19:10:51 -0000 rwatson 2005-02-25 19:10:51 UTC FreeBSD src repository Modified files: sys/kern uipc_sem.c Log: Add an exit hook, sem_forkhook(), which walks the list of POSIX semaphores owned by a process when it forks, and creates a matching set of references for the child process, as prescribed by POSIX. In order to avoid races with other threads in the parent process during fork(), it is necessary to allocate a temporary reference list while holding the sem_lock, then transfer those references to the new process once the sem_lock is released. The implementation is inefficient but appears functional; in order to improve the efficiency, it will be necessary to modify the existing structures and logic, which generally rely on O(n) operations over the global set of semaphores. Revision Changes Path 1.16 +113 -1 src/sys/kern/uipc_sem.c