[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53946.1421618631@turing-police.cc.vt.edu>
Date: Sun, 18 Jan 2015 17:03:51 -0500
From: Valdis.Kletnieks@...edu
To: Siddhartha De <siddhartha.de87@...il.com>
Cc: kernelnewbies@...nelnewbies.org,
linux-kernel <linux-kernel@...r.kernel.org>,
One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
Subject: Re: Question about kernel interfaces
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....)
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists