Subject: Re: pipe(2) and invalid fildes
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: James Graham <greywolf@starwolf.com>
List: tech-userlevel
Date: 10/01/2001 07:36:00
On Mon, 1 Oct 2001, der Mouse wrote:
# If the manpage is the correct interface definition for pipe(2), then
# our implementation is imply *broken*, because if you pass an invalid
# pointer, you *don't* get EFAULT back - you get a VM signal in libc.
Aren't you supposed to get EFAULT back instead of a core signal on
system calls? I thought it was that way since it was the shortest path
to the return.
# However, it also seems to me that EFAULT is a kludge: such errors
# really *ought* to produce SIGBUS/SIGSEGV, and that they don't is a
# historical artifact. I would favor leaving it basically as it is,
# except with a little text added:
#
# [EFAULT] The fildes buffer is in an invalid area of the process's
# address space. (An appropriate signal, SIGBUS or
# SIGSEGV, may be generated instead of returning in this
# case.)
#
# Indeed, as I think someone already suggested, I would say that _all_
# EFAULT returns, with the possible exception of any that are actually
# overloading EFAULT to indicate some other error, should have similar
# language added, probably with a note in intro(2) as well.
...what else would you use EFAULT for?
...and if EFAULT is not used to indicate something that would, in
userland, generate a SIGBUS or SIGSEGV, do we need to keep the errno?
#
# /~\ The ASCII der Mouse
# \ / Ribbon Campaign
# X Against HTML mouse@rodents.montreal.qc.ca
# / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
#
--*greywolf;
--
NetBSD: priapic OS