On Tue, 25 Jun 2002, Carsten Langgaard wrote:
> > Linux platforms do it this way, e.g. Alpha and IA-64. A SIGSEGV is a
> > valid response for an invalid address. Remember you test pipe(3) and not
> > pipe(2).
> I'm not sure that you mean by pipe(2) and pipe(3), but according to my man
> page, pipe should return with EFAULT in this case.
pipe(2) is a syscall, while pipe(3) is a library call (see `man 2 intro'
and `man 3 intro', respectively). You rarely access syscalls directly --
the system library usually does this for you. Depending on a system
certain library functions may be trivial syscall wrappers, invoke a number
of syscalls (see e.g. the stat() family) or be implemented entirely in the
> EMFILE Too many file descriptors are in use by the pro
> ENFILE The system file table is full.
> EFAULT filedes is not valid.
Yep, this denotes such an error is possible and under what conditions. I
don't think it actually mandates it, at least it's not expressed
explicitly. Anyway, it's valid for i386 and possibly nothing else. Look
at the system version it refers to -- my version is: "Linux 0.99.11 23
A brief search of the web for "EFAULT pipe" reveals confirms others agree
with me -- the error is not mandatory (the EFAULT vs SIGSEGV issue was
discussed a few times at least in various contexts -- go search the web).
I believe a SIGSEGV is saner, too -- this way it's harder for an error
resulting from passing an invalid pointer to remain unnoticed (consider
some code that passes a pointer to read-only memory and fails to check a
result of pipe()).
If still in doubt, you may try to discuss the LTP result at
<firstname.lastname@example.org>. I don't think anybody wants to rewrite
pipe(2) for all the platforms that handle it our way.
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+ e-mail: email@example.com, PGP key available +