I had kind of the same problem about 1½ ago. I needed to interface with my soundcard and thus needed ioctl. However, there was some argument against adding a general ioctl call, but I'm not sure what it was. I ended up using a tiny cmod for the purpose of setting my parameter.
It might be that there is no real way of knowing what parameters are passed and how they should be interperted on the C-level. But that could be fixed using some smart heuristics, IMHO.
/ Marcus Agehall (PacketFront)
Previous text:
Not easily. Also, you need all the IOCTL constants somewhere, and those are highly system specific.
It's probably easier to simply implement interfaces as they are needed. As an example, adding a soundcard interface that handles several different output methods (ALSA (spdif and not), Solaris /dev/audio, esd etc) directly.
/ Per Hedbor ()
Previous text:
What would be nice, is a way to define ioctl methods in Pike. Perhaps something like
object i = Stdio.IOCTL(4242 /* request_id */ ); i->add_int_parameter(); i->add_string_parameter(); i->set_return_type(STRING);
string ret = i(fd, 1, "somestring");
That ought to be possible, or..?
/ Marcus Agehall (PacketFront)
Previous text:
Sorry. Lost my CVS-repository to a fsck a few months ago. However, it is not very hard to fix up a cmod that accomplishes what you need.
Look at some (fairly simple) cmod in the pike source and I'm sure you can figure it out. I usually start with the Bz-module, rip out almost everything and then add my stuff. Just copy the post_modules/Bz dir to post_modules/MyIOCTL and start changing... ;)
/ Marcus Agehall (PacketFront)
Previous text:
pike-devel@lists.lysator.liu.se