Is fcntl.ioctl broken?

Michael Hudson mwh at python.net
Thu Apr 25 07:08:59 EDT 2002


"Noah" <noah at noah.org> writes:

> The documentation for ioctl in the fcntl module says:
> 	"ioctl(fd, op, arg) 
> 	This function is identical to the fcntl() function, 
> 	except that the operations are typically defined in 
> 	the library module IOCTL."
> 
> The only problem I can see is that there is no IOCTL module.
> I'm looking to get and set the winsize structure for the
> controlling terminal.

Oops, somethings out of date here (like the docs you're reading).

The constants you're looking for were never in the IOCTL module,
though.  They *were* TERMIOS.TIOCGWINSZ and TERMIOS.TIOCSWINSZ but now
they're in the termios module.

>>> struct.unpack('hhhh', fcntl.ioctl(0, termios.TIOCGWINSZ, "\000"*8))
(55, 80, 499, 719)

Cheers,
M.

-- 
  The meaning of "brunch" is as yet undefined.
                                             -- Simon Booth, ucam.chat



More information about the Python-list mailing list