misc/138526: /dev/null does not support nonblocking operation, fcntl(0, F_SETFL, O_NONBLOCK) fails

Petr Salinger Petr.Salinger at seznam.cz
Fri Sep 4 10:10:06 UTC 2009


>Number:         138526
>Category:       misc
>Synopsis:       /dev/null does not support nonblocking operation, fcntl(0,F_SETFL,O_NONBLOCK) fails
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 04 10:10:05 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Petr Salinger
>Release:        7.2
>Organization:
>Environment:
>Description:
/dev/null does not support nonblocking operation, 
fcntl(0,F_SETFL,O_NONBLOCK) fails

The testsuite of coreutils 7.5 fails due to this.

It is related also to 
http://www.freebsd.org/cgi/query-pr.cgi?pr=standards/94729

I see no reason, why /dev/null and /dev/zero should operate differently
in blocking and non-blocking mode, it should be sufficient to just ignore
corresponding ioctl/fcntl in kernel.
>How-To-Repeat:

>Fix:
In src/sys/dev/null/null.c
add #include <sys/filio.h>

and into begining of null_ioctl() function

+       if (cmd == FIONBIO)
+               return 0;
+       if ((cmd == FIOASYNC) && ((*(int *)data) == 0))
+               return 0;

May be even 

+       if (cmd == FIONBIO)
+               return 0;
+       if (cmd == FIOASYNC)
+               return 0;

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list