Reputation: 2047
I was playing with ioctl
and this question occurred to me.
Background
0x80
in case of Linux), but accept extra arguments to deliver different functionalities on demand.ioctl
.Hence my question. Why don't OSes just offer enough system calls and get rid of ioctl
? (Or is it just merely to create a hierarchical structure to offer better scalability?)
Upvotes: 0
Views: 230
Reputation: 697
My opinion about this is that system calls can be viewed as a set of services provided by the operating system kernel to user applications, whereas ioctl
is just one of these services that allows you to send a custom command to specific device (or driver).
When developing a driver, you may write a handler for incomming ioctl
requests. Managing the same thing by implementing your own system calls has several disadvantages:
You can view ioctl
as a generalization for read
and write
. Both input and output buffers can be provided, together with a control code defining the action requred from the target (usually a kernel driver).
Upvotes: 1