fcntl() versus ioctl() - yes!

Doug Gwyn gwyn at smoke.ARPA
Mon Sep 19 12:46:52 AEST 1988


In article <7039 at ki4pv.uucp> tanner at ki4pv.uucp (Dr. T. Andrews) writes:
>In article <1407 at solo12.cs.vu.nl>, maart at cs.vu.nl (Maarten Litmaath) writes:
>) Aha! And where's the expected next statement: why has fcntl() been
>) invented in the first place?
>My suspicion is that it seemed to someone like a good idea at the
>time.

It IS a good idea.  If you check out the internals of the kernel,
you'll find that ioctl is really supposed to be a hook into I/O
device drivers for things that don't fit the open/read/write/close
model.  fnctl on the other hand is for manipulating file table
entries and other similar actions that should not involve the
device driver at all.  Since both of them enter the kernel, either
COULD do anything at all, but a clean partitioning of function is
desirable.



More information about the Comp.unix.questions mailing list