[Python-bugs-list] [ python-Bugs-550777 ] fcntl module with wrong module for ioctl

noreply@sourceforge.net noreply@sourceforge.net
Tue, 30 Apr 2002 13:40:13 -0700


Bugs item #550777, was opened at 2002-04-30 20:40
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=550777&group_id=5470

Category: Documentation
Group: Python 2.2.1 candidate
Status: Open
Resolution: None
Priority: 5
Submitted By: Noah Spurrier (noah)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: fcntl module with wrong module for ioctl

Initial Comment:
The documentation for fcntl.ioctl() gives the wrong 
module for definitions of ioctl operations.

    http://www.python.org/doc/lib/module-fcntl.html

    ioctl(fd, op, arg) 
    This function is identical to the fcntl()
    function, except that the operations are typically
    defined in the library module IOCTL. 

As far as I can tell, there is no IOCTL module.
I think what the documentation should say is the
termios module. The termios module defines various 
ioctl operation constants.

The following example demonstrates an ioctl operation
to get the current terminal window size.
#!/usr/bin/env python

import termios, fcntl, struct, sys

s = struct.pack("HHHH", 0, 0, 0, 0)
fd_stdout = sys.stdout.fileno()
x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s)
print '(rows, cols, x pixels, y pixels) =',
print struct.unpack("HHHH", x)

Yours,
Noah


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=550777&group_id=5470