Re: fcntl v/s ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/29/07, Rick Brown <rick.brown.3@xxxxxxxxx> wrote:
Hi,

Could some one please explain me the differences and similarities
between fcntl and ioctl?
Is one built upon the other?
No

AFAIK, both are used for handling of very
device specific commands by the driver.

not both,
this goes well with ioctl

as ioctl is customizable, there is an ioctl method in the
struct file_operations.
so a driver writer can define some device specific tasks
& hook her own method to execute them via an ioctl

http://lxr.linux.no/source/fs/ioctl.c#L159

fcntl is not customizable by a driver
there are some fixed task which it performs

like
setting the close on exec flag
duplicate fd
set/get owner
etc
have a look at

sys_fcntl
http://lxr.linux.no/source/fs/fcntl.c#L385

& its worker
do_fcntl
http://lxr.linux.no/source/fs/fcntl.c#L315


we can say that fcntl dosen't bother if its a regular file
or a device specific file

where as ioctl changes its color in these case

--
Milind Arun Choudhary
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux