ccing list. 

----- Forwarded Message ----
From: Manoj Awasthi <[EMAIL PROTECTED]>
To: Mayank Kaushik <[EMAIL PROTECTED]>
Sent: Friday, 8 February, 2008 3:02:29 PM
Subject: Re: Basic question about IOCTL

----- Original Message ----
From: Mayank Kaushik <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, 8 February, 2008 7:02:07 AM
Subject: Basic question about IOCTL

.... 
I am puzzled about what IOCTLs are and what they are used for. I could not 
understand much from the the man page for ioctl. 
.... 

ioctls are a way of communication between user space and kernel space. From an 
article - 

Even though ioctl is one of
 the system calls, its usefulness tempts
me to talk about it separately. Sometimes referred to as Swiss army
knife, ioctl stands for input/output control and is used to manipulate
a character device via a file descriptor. ioctl is a catch-all function
that takes a device, a request and a variable number of other
parameters. The devices, requests and other parameters are then defined
in header files.

Pros: Provides hardware level access to programmers.

Cons: device and requests are poorly documented and platform specific.

[source: http://www.nirendra.net/cms/communicate_kernel ] 


Normally, you open a driver (using open system call), do some ioctl (i.e. call 
ioctl system call with some message which the driver can understand) which in 
effect does something in kernel and once you are done, you can close the driver 
(using close system call).



A description of what ioctls are used for (alongwith an example usage) would be 
very helpful.


e.g. suppose you have a driver installed which write protects a file. When the 
driver gets loaded, this file gets write protected. Now you want a command line 
interface, say a command which can remove this write protection. so in the 
implementation of this command, you open the driver and send it a ioctl message 
like _REM_WPROTECTION and close the driver. Handling of the message is inside 
your driver (that will do the needful). 

Thanks in advance,
Mayank

Also read http://catb.org/~esr/faqs/smart-questions.html



thanks 
-Manoj 






       Bring your gang together - do your thing.  Start your group.





      Save all your chat conversations. Find them online at 
http://in.messenger.yahoo.com/webmessengerpromo.php

Reply via email to