lkml.org 
[lkml]   [2015]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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


\
 
 \ /
  Last update: 2015-01-21 19:01    [W:0.082 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site