> Date: Thu, 29 Nov 2012 13:33:47 +0100 > From: Reyk Floeter <[email protected]> > > btw., I like C and it is still my favorite language (sorry, CS > people). But it shouldn't be a problem to do simple ioctls with most > other languages except shell scripts. > > #!/usr/bin/perl > require "sys/ioctl.ph"; > $TUNSIFUNIT = _IOC(&IOC_INOUT, ord('t'), 90, 4); > open(TUN0, "+</dev/tun0") or die "open"; > ioctl(TUN0, $TUNSIFUNIT, $unit = pack("i", -1)) or die "ioctl $!"; > print "Returned: tun".unpack("i", $unit)."\n"; > close(TUN0);
But you'll need to be a pretty hardcore Perl programmer to be able do this. My favourite "quick-and-dirty" language is Python, and I consider myself a fairly proficient Python programmer. I've never, ever, done ioctls from Python, and while it looks indeed as if it is possible to do so, I'm sure it'd take me some effort to get it right.
