Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/fcntl.rst

    r2 r391  
    1 
    2 :mod:`fcntl` --- The :func:`fcntl` and :func:`ioctl` system calls
    3 =================================================================
     1:mod:`fcntl` --- The ``fcntl`` and ``ioctl`` system calls
     2=========================================================
    43
    54.. module:: fcntl
     
    109
    1110.. index::
    12    pair: UNIX@Unix; file control
    13    pair: UNIX@Unix; I/O control
     11   pair: UNIX; file control
     12   pair: UNIX; I/O control
    1413
    1514This module performs file control and I/O control on file descriptors. It is an
    16 interface to the :cfunc:`fcntl` and :cfunc:`ioctl` Unix routines.
     15interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines.
    1716
    1817All functions in this module take a file descriptor *fd* as their first
    1918argument.  This can be an integer file descriptor, such as returned by
    2019``sys.stdin.fileno()``, or a file object, such as ``sys.stdin`` itself, which
    21 provides a :meth:`fileno` which returns a genuine file descriptor.
     20provides a :meth:`~io.IOBase.fileno` which returns a genuine file descriptor.
    2221
    2322The module defines the following functions:
     
    2726
    2827   Perform the requested operation on file descriptor *fd* (file objects providing
    29    a :meth:`fileno` method are accepted as well). The operation is defined by *op*
     28   a :meth:`~io.IOBase.fileno` method are accepted as well). The operation is
     29   defined by *op*
    3030   and is operating system dependent.  These codes are also found in the
    3131   :mod:`fcntl` module. The argument *arg* is optional, and defaults to the integer
    3232   value ``0``.  When present, it can either be an integer value, or a string.
    3333   With the argument missing or an integer value, the return value of this function
    34    is the integer return value of the C :cfunc:`fcntl` call.  When the argument is
     34   is the integer return value of the C :c:func:`fcntl` call.  When the argument is
    3535   a string it represents a binary structure, e.g. created by :func:`struct.pack`.
    3636   The binary data is copied to a buffer whose address is passed to the C
    37    :cfunc:`fcntl` call.  The return value after a successful call is the contents
     37   :c:func:`fcntl` call.  The return value after a successful call is the contents
    3838   of the buffer, converted to a string object.  The length of the returned string
    3939   will be the same as the length of the *arg* argument.  This is limited to 1024
     
    4242   violation or a more subtle data corruption.
    4343
    44    If the :cfunc:`fcntl` fails, an :exc:`IOError` is raised.
     44   If the :c:func:`fcntl` fails, an :exc:`IOError` is raised.
    4545
    4646
    4747.. function:: ioctl(fd, op[, arg[, mutate_flag]])
    4848
    49    This function is identical to the :func:`fcntl` function, except that the
     49   This function is identical to the :func:`~fcntl.fcntl` function, except that the
    5050   operations are typically defined in the library module :mod:`termios` and the
    5151   argument handling is even more complicated.
     
    5757   a plain Python string) or an object supporting the read-write buffer interface.
    5858
    59    In all but the last case, behaviour is as for the :func:`fcntl` function.
     59   In all but the last case, behaviour is as for the :func:`~fcntl.fcntl`
     60   function.
    6061
    6162   If a mutable buffer is passed, then the behaviour is determined by the value of
     
    9697
    9798   Perform the lock operation *op* on file descriptor *fd* (file objects providing
    98    a :meth:`fileno` method are accepted as well). See the Unix manual
     99   a :meth:`~io.IOBase.fileno` method are accepted as well). See the Unix manual
    99100   :manpage:`flock(2)` for details.  (On some systems, this function is emulated
    100    using :cfunc:`fcntl`.)
     101   using :c:func:`fcntl`.)
    101102
    102103
    103104.. function:: lockf(fd, operation, [length, [start, [whence]]])
    104105
    105    This is essentially a wrapper around the :func:`fcntl` locking calls.  *fd* is
    106    the file descriptor of the file to lock or unlock, and *operation* is one of the
    107    following values:
     106   This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls.
     107   *fd* is the file descriptor of the file to lock or unlock, and *operation*
     108   is one of the following values:
    108109
    109110   * :const:`LOCK_UN` -- unlock
     
    120121   file opened for writing.
    121122
    122    *length* is the number of bytes to lock, *start* is the byte offset at which the
    123    lock starts, relative to *whence*, and *whence* is as with :func:`fileobj.seek`,
    124    specifically:
     123   *length* is the number of bytes to lock, *start* is the byte offset at
     124   which the lock starts, relative to *whence*, and *whence* is as with
     125   :func:`io.IOBase.seek`, specifically:
    125126
    126    * :const:`0` -- relative to the start of the file (:const:`SEEK_SET`)
    127    * :const:`1` -- relative to the current buffer position (:const:`SEEK_CUR`)
    128    * :const:`2` -- relative to the end of the file (:const:`SEEK_END`)
     127   * :const:`0` -- relative to the start of the file (:data:`os.SEEK_SET`)
     128   * :const:`1` -- relative to the current buffer position (:data:`os.SEEK_CUR`)
     129   * :const:`2` -- relative to the end of the file (:data:`os.SEEK_END`)
    129130
    130131   The default for *start* is 0, which means to start at the beginning of the file.
     
    151152
    152153   Module :mod:`os`
    153       If the locking flags :const:`O_SHLOCK` and :const:`O_EXLOCK` are present
    154       in the :mod:`os` module (on BSD only), the :func:`os.open` function
    155       provides an alternative to the :func:`lockf` and :func:`flock` functions.
     154      If the locking flags :data:`~os.O_SHLOCK` and :data:`~os.O_EXLOCK` are
     155      present in the :mod:`os` module (on BSD only), the :func:`os.open`
     156      function provides an alternative to the :func:`lockf` and :func:`flock`
     157      functions.
    156158
Note: See TracChangeset for help on using the changeset viewer.