Commit 50beebf3 authored by Guido van Rossum's avatar Guido van Rossum

Clarify the example by explicitly importing the fcntl module -- this

avoid being fooled into thinking that fcntl and FCNTL are the same
thing -- they aren't!  (fcntl is the extension, FCNTL.py is h2py
output that defines all the constants).

(XXX The example is still weird -- I think there's a more portable way
to do locking now.  That's for someone else to fix...)
parent c5ab1f5d
...@@ -63,13 +63,13 @@ opcodes in the C include files \code{<sys/fcntl.h>} and ...@@ -63,13 +63,13 @@ opcodes in the C include files \code{<sys/fcntl.h>} and
Examples (all on a SVR4 compliant system): Examples (all on a SVR4 compliant system):
\begin{verbatim} \begin{verbatim}
import struct, FCNTL import struct, fcntl, FCNTL
file = open(...) file = open(...)
rv = fcntl(file.fileno(), FCNTL.O_NDELAY, 1) rv = fcntl(file.fileno(), FCNTL.O_NDELAY, 1)
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0) lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
rv = fcntl(file.fileno(), FCNTL.F_SETLKW, lockdata) rv = fcntl.fcntl(file.fileno(), FCNTL.F_SETLKW, lockdata)
\end{verbatim} \end{verbatim}
Note that in the first example the return value variable \code{rv} will Note that in the first example the return value variable \code{rv} will
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment