Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Mar 2001 10:37:36 -0800 (PST)
From:      steve@bleazard.com
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/25511: ioctl(fd, FIONREAD, &c) on a FIFO (not PIPE) does not work
Message-ID:  <200103031837.f23IbaS06130@freefall.freebsd.org>

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

>Number:         25511
>Category:       kern
>Synopsis:       ioctl(fd, FIONREAD, &c) on a FIFO (not PIPE) does not work
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 03 10:40:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Steve Bleazard
>Release:        4.2
>Organization:
Home
>Environment:
FreeBSD fbsd42.pcug.co.uk 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Thu Feb  8 09:49:1
8 GMT 2001     root@fbsd42.pcug.co.uk:/usr/src/sys/compile/AMS  i386
>Description:
ioctl(fd, FIONREAD, &c) on a fifo file (created with mkfifo(2)) always
returns 0.
>How-To-Repeat:
call ioctl(fd, FIONREAD, &c) on a fifo which has data to read.
>Fix:
The problem appears to be with fifo_vnops.c in
/usr/src/sys/miscfs/fifofs.  The code to handle the ioctl calls
soo_ioctl for both read and write halves of the stream in that order.
This is because the a_fflag is set to FREAD|FWRITE. Special casing
FIONREAD to only call the read half fixes the problem.

I have no experience with the FreeBSD kernel so have no idea if this is
a correct fix.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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