interview question how does application connects to device

Javier Martinez Canillas martinez.javier at gmail.com
Wed Jul 6 19:29:41 EDT 2011


2011/7/6 Mandeep Sandhu <mandeepsandhu.chd at gmail.com>:
>> How would using sysfs be useful if we were to talk about interacting with, let's say, a file system? ioctl's are quite versatile and rather easy to use when one wants to interact with a given FS.
>>
>> For instance, one can manage a Btrfs file system by using an user-level tool, which heavily uses ioctl's. Requiring it to interact with sysfs instead seems like complicating something simple with no apparent purpose.
>

Something that always has caught my attention is why netlink sockets
are so popular. I know that ioctl is deprecated and all new kernel
code that needs full-duplex communication between userspace and
kernelspace shoud use netlink as its interface.

But one of the arguments against ioctl is that you don't have type
checking which makes really hard to audit the parameters passed from
userspace. Also ioctl can be provided by third party as modules (that
can also be proprietary binary only ones) which even complicates more
to have a general security mechanism.

My question is, why netlink sockets are better than ioctls? It is not
yet another interface to use as a wildcard to pass any data you wan't
between the kernel and userpace with the only difference that you use
another paradigm? (network sockets with a specific protocol family
instead file operations over a device).

Sorry if my question is stupid but I just don't get the point.

Regards,

-- 
Javier Martínez Canillas
(+34) 682 39 81 69
PhD Student in High Performance Computing
Computer Architecture and Operating System Department (CAOS)
Universitat Autònoma de Barcelona
Barcelona, Spain



More information about the Kernelnewbies mailing list