Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Feb 2006 18:33:30 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Joseph Koshy <joseph.koshy@gmail.com>
Cc:        Bachilo Dmitry <root@solink.ru>, freebsd-current@freebsd.org, David Xu <davidxu@freebsd.org>
Subject:   Re: Bad system call (core dumped)
Message-ID:  <20060219183128.K37014@fledge.watson.org>
In-Reply-To: <84dead720602191009p5fa3c317w254b13454dbc8cb8@mail.gmail.com>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060219183128.K37014>