I tried to reimplement this in ruby with stuff like
f = File.open '/dev/modem’
p f.ioctl(0x5415)
but it results in errors.
irb(main):006:0> f.ioctl(0x5415)
Errno::EFAULT: Bad address - "/dev/modem"
from (irb):6:in `ioctl’
from (irb):6
So I wrote something to brute out the ioctls that didn’t raise an
exception, and tried them all, but I never seem to get anything sane.
Please give me a clue what’s wrong.
but it results in errors.
irb(main):006:0> f.ioctl(0x5415)
Errno::EFAULT: Bad address - “/dev/modem”
from (irb):6:in `ioctl’
from (irb):6
Basically, it seems to be caused by bugs in the ~2002.11.10 snapshot.
Code in io.c seems to think that ioctl returns its goodies in the
return value, but that doesn’t really seem to be the way at works, at
least in Linux and OpenBSD. The third argument of ioctl is a pointer
to an integer, and the goodies come back in that, not in the return
value. So I sort of fixed the bug and got stuff to work and told Nobu
and hopefully people who actually know what they’re doing will make
actual good fixes at some point in the near future.