n Sat, 29 Jul 2000, Hiroyuki Hanai wrote:
> Setting status flags using F_SETFL command of fcntl(2) on the file
> descriptor, which is returned by open(2)ing /dev/random, seems not to
> be supported. For example, when I run following code;
File flags should be handled at the file level, and mostly are, but
drivers still need dummy FIONBIO and FIOASYNC ioctls to prevent the
fo_ioctl()'s in kern_descrip.c:fcntl() from failing (there must be
dummy for FIOASYNC for setting O_NONBLOCK to work, even if the device
driver doesn't support async i/o :-(). Broken drivers use these ioctls
to make copies of the file flags in the wrong place. Non-broken
drivers use the flags passed to their i/o functions, so that the flags
are per-i/o.
> 3.4-RELEASE(and possibly 3.5 and 3.5.1) and 4.1-RELEASE/4.1-STABLE say
> `Inappropriate ioctl for device' and 5-current says `Operation not
> supported by device'.
This is a different bug. The random device in -current doesn't support
ioctls at all, so all ioctls on it return ENODEV instead of most ioctls
on it returning ENOTTY. See the patch by Brian Feldman.
> Actually, in BIND9, fd is already open(2)ed with `O_RDONLY | O_NONBLOCK'
> and setting O_NONBLOCK status with fcntl(2) is not needed, which means
> that fixing BIND9's code is very simple; just comment out the fcntl(2)ing line.
Except the random device doesn't actually support the O_NONBLOCK flag.
This makes no difference in the -current random device, since all i/o
is non-blocking. In 3.x and 4.x, O_NONBLOCK should have caused reads
on /dev/random to not block.
Bruce
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message