Re: Bad system call (core dumped)

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Sun, 19 Feb 2006 18:33:30 +0000 (GMT)
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
Received on Sun Feb 19 2006 - 17:29:58 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:52 UTC