can you tell me what is this sysfs....its general system call? --- On Sat, 3/1/09, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:
From: Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> Subject: Re: ioctl() To: "Rohit Sharma" <imreckless@xxxxxxxxx> Cc: "rishi agrawal" <postrishi@xxxxxxxxx>, shariefbe@xxxxxxxxxxx, "Kernel newbies" <kernelnewbies@xxxxxxxxxxxx> Date: Saturday, 3 January, 2009, 8:42 PM
On Sat, 3 Jan 2009, Rohit Sharma wrote:
> ioctls are also known as generic system calls. Its a simple switch
> case implementation inside a device.
> you send command and argument through ioctls as parameters.
> Its a way you use to interact with the device itself.
>
> for using it just open the device and use its fd to invoke ioctls.
>
> for eg.
>
> fd = open("/dev/mydev", O_RDONLY);
>
> ioctl(fd, cmd, argument);
>
>
> its internal representation is something like:
>
> ioctl( struct file *, struct inode*, unsigned int cmd, unsigned long arg)
> {
> switch(cmd) {
> case 1: .......
> case 2: .........
> }
> }
>
> for more details refer Beginning Linux Programming.
> I hope that helps.
the last i heard, while ioctl's aren't going away any time soon,
they're deprecated in favour of ... uh, files under /sys? am i
remembering that correctly? in short, if you're already working with
an ioctl-based code base, keep doing that. but if you have the
opportunity to design some kernel code from scratch, use the sysfs.
or am i way off base here?
rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
Have classroom, will lecture.
http://crashcourse.ca Waterloo, Ontario, CANADA
========================================================================
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ
|
Add more friends to your messenger and enjoy!
Invite them now.