From owner-freebsd-current@FreeBSD.ORG Sun Feb 19 18:29:58 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A95116A420; Sun, 19 Feb 2006 18:29:58 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 55DA843D53; Sun, 19 Feb 2006 18:29:57 +0000 (GMT) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id F3B6646BC8; Sun, 19 Feb 2006 13:29:41 -0500 (EST) Date: Sun, 19 Feb 2006 18:33:30 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Joseph Koshy In-Reply-To: <84dead720602191009p5fa3c317w254b13454dbc8cb8@mail.gmail.com> Message-ID: <20060219183128.K37014@fledge.watson.org> References: <200602101246.31666.root@solink.ru> <200602141023.35850.root@solink.ru> <84dead720602132054y6d114b1eo8126fca84ac8972a@mail.gmail.com> <200602141058.24366.root@solink.ru> <43F1656A.2050100@freebsd.org> <84dead720602132140p1cc2b471h5c25c877b7311791@mail.gmail.com> <43F16E2D.5010109@freebsd.org> <84dead720602191009p5fa3c317w254b13454dbc8cb8@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Bachilo Dmitry , freebsd-current@freebsd.org, David Xu Subject: Re: Bad system call (core dumped) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Feb 2006 18:29:58 -0000 On Sun, 19 Feb 2006, Joseph Koshy wrote: > jk> Userland code should be checking for kernel support for > jk> features before attempting to use them. > > dx> I don't think user code should check it before it can be > dx> used, actually, it is being used by thread libraries to > dx> implement named semaphore, it is requred by POSIX. > > Well, support for posix semaphores is not turned on in GENERIC, and so code > that calls sem_init(3) is rudely sent a SIGSYS today. > > How about the attached patch to make our libraries better behaved with > kernels that lack the P1003_1B_SEMAPHORES option? We generally have two different cases for ENOSYS: (1) ENOSYS when the supporting implementation isn't completed into the kernel, which generates SIGSYS. This terminates the application. (2) ENOSYS compiled in using a stub, which allows the application to check for ENOSYS. I prefer the second when we've simply compiled out a module, since it means applications can check for ENOSYS during probing for facilities, and I believe is what POSIX generally asks for -- features like Audit, etc, all return ENOSYS when they are compiled out so that things like login don't crash when it's compiled out :-). Robert N M Watson