Subject: Re: pipe(2) and invalid fildes
To: None <tech-kern@netbsd.org, tech-userlevel@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 10/01/2001 04:04:55
>> The manpage states that EFAULT is returned by pipe(2) if fildes
>> buffer is in an invalid area of the process's address space.  That
>> is simply not true, and thus I think that sentense should be
>> removed.

> Let me translate:

> "Rather than having a static interface definition independent of the
> implementation, we could have a floating definition dependent on the
> current implementation."

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.

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.

/~\ 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