diff options
author | Fred Drake <fdrake@acm.org> | 2001-11-28 07:48:32 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-11-28 07:48:32 (GMT) |
commit | 6a6bb1828bab8c0d3e67e619949846a3683fb43f (patch) | |
tree | 971c3005351e7fb8840fc4b4b761ea46df2f1198 /Doc | |
parent | 48704ee478fa8a5f7890dc15ac56297121f9eec1 (diff) | |
download | cpython-6a6bb1828bab8c0d3e67e619949846a3683fb43f.zip cpython-6a6bb1828bab8c0d3e67e619949846a3683fb43f.tar.gz cpython-6a6bb1828bab8c0d3e67e619949846a3683fb43f.tar.bz2 |
Clarify that on some systems, lockf() using LOCK_EX requires that the file
is opened for writing; this closes SF bug #485342.
Added notes that file objects are also accepted in the place of file
descriptors.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libfcntl.tex | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Doc/lib/libfcntl.tex b/Doc/lib/libfcntl.tex index 44b71b7..bc125e5 100644 --- a/Doc/lib/libfcntl.tex +++ b/Doc/lib/libfcntl.tex @@ -16,13 +16,15 @@ It is an interface to the \cfunction{fcntl()} and \cfunction{ioctl()} All functions in this module take a file descriptor \var{fd} as their first argument. This can be an integer file descriptor, such as returned by \code{sys.stdin.fileno()}, or a file object, such as -\code{sys.stdin} itself. +\code{sys.stdin} itself, which provides a \method{fileno()} which +returns a genuine file descriptor. The module defines the following functions: \begin{funcdesc}{fcntl}{fd, op\optional{, arg}} - Perform the requested operation on file descriptor \var{fd}. + Perform the requested operation on file descriptor \var{fd} (file + objects providing a \method{fileno()} method are accepted as well). The operation is defined by \var{op} and is operating system dependent. These codes are also found in the \module{fcntl} module. The argument \var{arg} is optional, and defaults to the @@ -52,7 +54,8 @@ The module defines the following functions: \end{funcdesc} \begin{funcdesc}{flock}{fd, op} -Perform the lock operation \var{op} on file descriptor \var{fd}. +Perform the lock operation \var{op} on file descriptor \var{fd} (file + objects providing a \method{fileno()} method are accepted as well). See the \UNIX{} manual \manpage{flock}{3} for details. (On some systems, this function is emulated using \cfunction{fcntl()}.) \end{funcdesc} @@ -75,7 +78,9 @@ lock acquisition. If \constant{LOCK_NB} is used and the lock cannot be acquired, an \exception{IOError} will be raised and the exception will have an \var{errno} attribute set to \constant{EACCES} or \constant{EAGAIN} (depending on the operating system; for portability, -check for both values). +check for both values). On at least some systems, \constant{LOCK_EX} +can only be used if the file descriptor refers to a file opened for +writing. \var{length} is the number of bytes to lock, \var{start} is the byte offset at which the lock starts, relative to \var{whence}, and |