Question about kernel interfaces
Valdis.Kletnieks at vt.edu
Valdis.Kletnieks at vt.edu
Sun Jan 18 17:03:51 EST 2015
On Sun, 18 Jan 2015 15:03:55 +0530, Siddhartha De said:
> 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 ... :) )
There's a *reason* it's very rare...
> 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 ...
>
> However if we exposed the IOCTL as a web url we could easily call its
> services by using a simple utility like curl . So in our shell script
> we would probably write :-
>
> curl http://localhost:7000/IOCTL/IOCTL_EJECT?device=/dev/cdrom
>
> 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 )
>
Why use curl when /usr/bin/eject is almost certainly available?
Can you point at an *actual* case where (a) shell script access even makes
*sense*, and also (b) there *isn't* already a program available for the
shell script to call to issue the ioctl?
Or point at a non-shell language that *doesn't* have already have access to the
ioctl() wrapper that's in whatever libc you have?
I think you're trying to solve a non-problem here.
(For bonus points, instead of EJECT, explain how you form a curl URL
that does TCSETS. Yes, you *do* have to handle *all* the fields of a
struct termios, for both 32 and 64 bit environments....)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150118/e132f3a8/attachment.bin
More information about the Kernelnewbies
mailing list