ioctl in python

Angus MacKay amackay at starvision.com
Wed Jun 30 15:36:55 EDT 1999


is there some magic to the fcntl.ioctl() call?

I can do these ioctl calls in C no problem (with a small wrapper):
(amackay at phat)~/tmp$ ./ioctltest /tmp 0x80047601
0x80047601: 1
(amackay at phat)~/tmp$ ./ioctltest / 0x80047601
0x80047601: 0
(amackay at phat)~/tmp$ ./ioctltest /proc 0x80047601
/proc: Inappropriate ioctl for device

that was the Linux ioctl for EXT2 version.

but in python:
>>> a = 0
>>> req = 0x80047601
>>> import fcntl
>>> fo=open('/tmp')
>>> fcntl.ioctl(fo.fileno(), req, a)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
IOError: (14, 'Bad address')
>>> 

thanks in advance.
cheers, Angus.




More information about the Python-list mailing list