Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

ethan (3163)

ethan
  reversethis-{ed. ... rap.nov.olissat}

Being a 25-year old chap living in the western-most town of Germany. Stuying communication and information science and being a huge fan of XS-related things.

Journal of ethan (3163)

Saturday January 03, 2004
05:43 AM

Things I never get right at the beginning

[ #16602 ]

There's a number of things that never fail to amaze me. One of them is the ioctl(2) system call. It should really be a rather plain thing: first argument is always a file-descriptor, second one always the operation to carry out and then some additional arguments that pass and retrieve the data related to the intended operation.

I was experimenting with the various controls concerning a CDROM drive. So I opened /dev/cdrom (which is a symlink to /dev/hdd) with O_READ|O_NONBLOCK and threw a CDROMREADRAW at the drive. Most of the time it complained about bad arguments so I played a little with the third argument to ioctl which - according to ioctl_list(2) - should be a struct cdrom_read_audio* (but nowehere it is said how this structure should be initialized). And indeed, after some attempts it seemed to do something.

Interestingly, the control light of my CDRW drive (which is /dev/hdc) lid up. The one of the drive that I opened remained dark. Nonetheless, both drives were blocked and the light of the writer happily kept burning. The only way to put things back to normal was actually a reboot. Very strange.

The whole thing very much reminds me of accessing my soundcard via ioctl. I needed a couple of google-sessions to get it right. The same thing is now required for the cdrom thing, I guess.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.