fix return code for pipe(2) syscall

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

fix return code for pipe(2) syscall

Gleb Smirnoff
  Colleagues,

  sometimes pipe(2) can return ENFILE, which has nothing to do
with number of open files. It happens when we run out of kva.

However, pipe(2) can also return correct ENFILE, when falloc()
fails.

  The only way to distinguish between latter error and the
former one is looking into the 'dmesg' output, right after
failure. If your dmesg is later overwritten with some other
logging, then you will loose this information, and you won't
be able to tell why pipe(2) syscall yesterday returned ENFILE -
did it hit descriptor limit or kva?

Recently I've got some communication with people, who have
problems with mpd port. They have experienced ENFILE from
pipe(2). They have spent some time tuning descriptor limits
and I spent some time trying to help them, until we looked
into dmesg, and then into source, to discover alternative
meaning of ENFILES.

Any objection for the attached change? It should make return
ENOMEM in case of kva outage?

Yes, according to SUSv3 the only errors from pipe(2) are ENFILE
and EMFILE. I think that blindly following standard in this
case will lead to confusion (see above). And we already return
EFAULT from pipe(2), which is not described in standard.

--
Totus tuus, Glebius.
GLEBIUS-RIPN GLEB-RIPE

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"

sys_pipe.c.diff (668 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fix return code for pipe(2) syscall

Garrett Wollman
In article <[hidden email]> you write:

>Yes, according to SUSv3 the only errors from pipe(2) are ENFILE
>and EMFILE.

POSIX does not define an exhaustive enumeration of error conditions.
*Any* error return is permissible, provided only that *for those
conditions noted in the ERRORS section* the code identified for that
condition is returned.  It is perfectly permissible for every system
call to fail with [ENOTADUCK] unless the first five bytes of the
caller's address space contain the word "quack".

-GAWollman

_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: fix return code for pipe(2) syscall

Julian Elischer
Garrett Wollman wrote:

>In article <[hidden email]> you write:
>
>  
>
>>Yes, according to SUSv3 the only errors from pipe(2) are ENFILE
>>and EMFILE.
>>    
>>
>
>POSIX does not define an exhaustive enumeration of error conditions.
>*Any* error return is permissible, provided only that *for those
>conditions noted in the ERRORS section* the code identified for that
>condition is returned.  It is perfectly permissible for every system
>call to fail with [ENOTADUCK] unless the first five bytes of the
>caller's address space contain the word "quack".
>
>  
>

I like it.
We should implement this asap.

>-GAWollman
>
>_______________________________________________
>[hidden email] mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-arch
>To unsubscribe, send any mail to "[hidden email]"
>  
>
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: fix return code for pipe(2) syscall

Matthew D. Fuller
In reply to this post by Garrett Wollman
On Fri, Jan 27, 2006 at 12:24:30PM -0500 I heard the voice of
Garrett Wollman, and lo! it spake thus:
>
> It is perfectly permissible for every system call to fail with
> [ENOTADUCK] unless the first five bytes of the caller's address
> space contain the word "quack".

Ducks don't byte, they just nybble a lyttle.


--
Matthew Fuller     (MF4839)   |  [hidden email]
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.
_______________________________________________
[hidden email] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"