kern/188952: read after revoke giving error not eof

Bruce Evans brde at optusnet.com.au
Thu Apr 24 16:50:01 UTC 2014


The following reply was made to PR kern/188952; it has been noted by GNATS.

From: Bruce Evans <brde at optusnet.com.au>
To: Justin Cormack <justin at specialbusservice.com>
Cc: freebsd-gnats-submit at freebsd.org, freebsd-bugs at freebsd.org
Subject: Re: kern/188952: read after revoke giving error not eof
Date: Fri, 25 Apr 2014 02:46:26 +1000 (EST)

 On Thu, 24 Apr 2014, Justin Cormack wrote:
 
 >> Description:
 > I have this ktrace of revoking a pty device:
 > ...
 > 43214 luajit-2.0.2 CALL  revoke(0xfebc8)
 > 43214 luajit-2.0.2 NAMI  "/dev/pts/1"
 > 43214 luajit-2.0.2 RET   revoke 0
 > 43214 luajit-2.0.2 CALL  read(0x4,0xa4170,0x1000)
 > 43214 luajit-2.0.2 RET   read -1 errno 6 Device not configured
 >
 > As you can see the revoke succeeds but the read is an error. The man page says:
 >
 >     The revoke() system call invalidates all current open file descriptors in
 >     the system for the file named by path.  Subsequent operations on any such
 >     descriptors fail, with the exceptions that a read() from a character
 >     device file which has been revoked returns a count of zero (end of file),
 >     ...
 >
 > So the read should be giving a count of zero not an error according to the docs (this happens eg in NetBSD), although maybe the sentence after is trying to tell me something else.
 
 deadfs and devfs still try to return EOF for dead ttys, though devfs
 still has a comment saying that this is redundant for it (it is
 obviously not redundant for devfs, since devfs is the only place that
 sets the flag VV_ISTTY used by deadfs).
 
 Bruce


More information about the freebsd-bugs mailing list