Messages in this thread | | | Date | Wed, 21 Jan 2015 17:44:22 +0000 | From | One Thousand Gnomes <> | Subject | Re: Question about kernel interfaces |
| |
On Sun, 18 Jan 2015 15:03:55 +0530 > Let's say you need to call an ioctl from a shell script ( I know its a > very rare use case but please bear with me ... :) ) > > So the current way of doing it is probably to write a C program which > actually calls the ioctl and then call the C program from the shell > script ...
That's how Unix is designed yes. It means that the ioctl internals are hidden from the scripts and the tools provided can be used instead.
> and the IOCTL_EJECT ioctl would get called on /dev/cdrom > that is ioctl ( &handle_to_/dev/cdrom , IOCTL_EJECT , &some_buffer ) > would get called ( by our translator running as a separate program or > as a service daemon )
You can just run "eject". It knows about all the details of doing an eject.
The equivalent of a "library" in shell scripts is a program. Small, simple tools that do one job and do it right, or at least before GNU got hold of them 8)
Alan
| |