summaryrefslogtreecommitdiffstats
path: root/Doc/libfcntl.tex
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1998-03-12 05:33:40 (GMT)
committerFred Drake <fdrake@acm.org>1998-03-12 05:33:40 (GMT)
commitc71585e06974df20f1b840de63fc75835274ab4c (patch)
tree8a2ed0d1e89bfae5da889aca6d11141e5b8bcc4e /Doc/libfcntl.tex
parent38d3fe012e76e1807133db9d02ea8fc087c625d6 (diff)
downloadcpython-c71585e06974df20f1b840de63fc75835274ab4c.zip
cpython-c71585e06974df20f1b840de63fc75835274ab4c.tar.gz
cpython-c71585e06974df20f1b840de63fc75835274ab4c.tar.bz2
Logical markup.
Markup consistency. Removed incorrect \setindexsubitem{}.
Diffstat (limited to 'Doc/libfcntl.tex')
-rw-r--r--Doc/libfcntl.tex61
1 files changed, 31 insertions, 30 deletions
diff --git a/Doc/libfcntl.tex b/Doc/libfcntl.tex
index e3a4ae0..3070f63 100644
--- a/Doc/libfcntl.tex
+++ b/Doc/libfcntl.tex
@@ -6,54 +6,55 @@
\indexii{UNIX@\UNIX{}}{I/O control}
This module performs file control and I/O control on file descriptors.
-It is an interface to the \dfn{fcntl()} and \dfn{ioctl()} \UNIX{} routines.
-File descriptors can be obtained with the \dfn{fileno()} method of a
-file or socket object.
+It is an interface to the \cfunction{fcntl()} and \cfunction{ioctl()}
+\UNIX{} routines. File descriptors can be obtained with the
+\method{fileno()} method of a file or socket object.
The module defines the following functions:
-\setindexsubitem{(in module struct)}
-\begin{funcdesc}{fcntl}{fd\, op\optional{\, arg}}
- Perform the requested operation on file descriptor \code{\var{fd}}.
- The operation is defined by \code{\var{op}} and is operating system
+\begin{funcdesc}{fcntl}{fd, op\optional{, arg}}
+ Perform the requested operation on file descriptor \var{fd}.
+ The operation is defined by \var{op} and is operating system
dependent. Typically these codes can be retrieved from the library
- module \code{FCNTL}. The argument \code{\var{arg}} is optional, and
+ module \module{FCNTL}. The argument \var{arg} is optional, and
defaults to the integer value \code{0}. When
it is present, it can either be an integer value, or a string. With
the argument missing or an integer value, the return value of this
- function is the integer return value of the real \code{fcntl()}
+ function is the integer return value of the \C{} \cfunction{fcntl()}
call. When the argument is a string it represents a binary
- structure, e.g.\ created by \code{struct.pack()}. The binary data is
- copied to a buffer whose address is passed to the real \code{fcntl()}
- call. The return value after a successful call is the contents of
- the buffer, converted to a string object. In case the
- \code{fcntl()} fails, an \code{IOError} will be raised.
+ structure, e.g.\ created by \function{struct.pack()}. The binary
+ data is copied to a buffer whose address is passed to the \C{}
+ \cfunction{fcntl()} call. The return value after a successful call
+ is the contents of the buffer, converted to a string object. In
+ case the \cfunction{fcntl()} fails, an \exception{IOError} is
+ raised.
\end{funcdesc}
-\begin{funcdesc}{ioctl}{fd\, op\, arg}
- This function is identical to the \code{fcntl()} function, except
+\begin{funcdesc}{ioctl}{fd, op, arg}
+ This function is identical to the \function{fcntl()} function, except
that the operations are typically defined in the library module
- \code{IOCTL}.
+ \module{IOCTL}.
\end{funcdesc}
-\begin{funcdesc}{flock}{fd\, op}
+\begin{funcdesc}{flock}{fd, op}
Perform the lock operation \var{op} on file descriptor \var{fd}.
See the \UNIX{} manual for details. (On some systems, this function is
-emulated using \code{fcntl()}.)
+emulated using \function{fcntl()}.)
\end{funcdesc}
-\begin{funcdesc}{lockf}{fd\, code\, \optional{len\, \optional{start\, \optional{whence}}}}
-This is a wrapper around the \code{F_SETLK} and \code{F_SETLKW}
-\code{fcntl()} calls. See the \UNIX{} manual for details.
+\begin{funcdesc}{lockf}{fd, code, \optional{len, \optional{start, \optional{whence}}}}
+This is a wrapper around the \constant{FCNTL.F_SETLK} and
+\constant{FCNTL.F_SETLKW} \function{fcntl()} calls. See the \UNIX{}
+manual for details.
\end{funcdesc}
-If the library modules \code{FCNTL} or \code{IOCTL} are missing, you
-can find the opcodes in the C include files \file{sys/fcntl.h} and
-\file{sys/ioctl.h}. You can create the modules yourself with the h2py
-script, found in the \file{Tools/scripts} directory.
-\refstmodindex{FCNTL}
-\refstmodindex{IOCTL}
+If the library modules \module{FCNTL}\refstmodindex{FCNTL} or
+\module{IOCTL}\refstmodindex{IOCTL} are missing, you can find the
+opcodes in the \C{} include files \code{<sys/fcntl.h>} and
+\code{<sys/ioctl.h>}. You can create the modules yourself with the
+\program{h2py} script, found in the \file{Tools/scripts/} directory.
+
Examples (all on a SVR4 compliant system):
@@ -66,9 +67,9 @@ rv = fcntl(file.fileno(), FCNTL.O_NDELAY, 1)
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
rv = fcntl(file.fileno(), FCNTL.F_SETLKW, lockdata)
\end{verbatim}
-%
+
Note that in the first example the return value variable \code{rv} will
hold an integer value; in the second example it will hold a string
value. The structure lay-out for the \var{lockadata} variable is
-system dependent -- therefore using the \code{flock()} call may be
+system dependent --- therefore using the \function{flock()} call may be
better.