fcntl
Guy Harris
guy at auspex.auspex.com
Fri Mar 16 05:53:49 AEST 1990
>> I know what the entry point(s) to ioctl are (I've seen
>>enough drivers but where are the fcntl entry points?
>>There is sort of an overlap there. Will a fcntl cause
>>a call to dev_ioctl?
>
>Well, it's not supposed to -- fcntl() was introduced specifically
>to play with the file table entries, which is something the device
>driver is not supposed to know (or care) about.
Unfortunately, both Berkeley and AT&T fairly quickly extended "fcntl()"
to do stuff other than monkey with file table entries.
In most cases, "fcntl()" will not call a device driver routine; there is
no "fcntl" entry point for a driver.
However, Berkeley saw fit to make no-delay I/O a property of the device,
rather than of the file table entry (it really should be a property of
the file descriptor, not the file table entry, but...), and the way they
do asynchronous I/O also makes it a property of the device. This means
that in systems that support BSD-style no-delay and asynchronous I/O,
the "fcntl"s that turn on or off those modes cause FIONBIO and FIOASYNC
"ioctl"s, respectively, to be done.
AT&T hasn't done anything like that in System V; "fcntl()" only reaches
its grubby paws down through the file system switch, not the device
driver switch....
More information about the Comp.unix.questions
mailing list