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 an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux