Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Sep 2009 10:01:26 GMT
From:      Petr Salinger <Petr.Salinger@seznam.cz>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/138526: /dev/null does not support nonblocking operation, fcntl(0, F_SETFL, O_NONBLOCK) fails
Message-ID:  <200909041001.n84A1QA1089795@www.freebsd.org>
Resent-Message-ID: <200909041010.n84AA5Bu043855@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909041001.n84A1QA1089795>