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/os.rst

    r2 r391  
    1414module.
    1515
    16 The design of all built-in operating system dependent modules of Python is such
    17 that as long as the same functionality is available, it uses the same interface;
    18 for example, the function ``os.stat(path)`` returns stat information about
    19 *path* in the same format (which happens to have originated with the POSIX
    20 interface).
    21 
    22 Extensions peculiar to a particular operating system are also available through
    23 the :mod:`os` module, but using them is of course a threat to portability!
    24 
    25 .. note::
    26 
    27    If not separately noted, all functions that claim "Availability: Unix" are
    28    supported on Mac OS X, which builds on a Unix core.
     16Notes on the availability of these functions:
     17
     18* The design of all built-in operating system dependent modules of Python is
     19  such that as long as the same functionality is available, it uses the same
     20  interface; for example, the function ``os.stat(path)`` returns stat
     21  information about *path* in the same format (which happens to have originated
     22  with the POSIX interface).
     23
     24* Extensions peculiar to a particular operating system are also available
     25  through the :mod:`os` module, but using them is of course a threat to
     26  portability.
     27
     28* An "Availability: Unix" note means that this function is commonly found on
     29  Unix systems.  It does not make any claims about its existence on a specific
     30  operating system.
     31
     32* If not separately noted, all functions that claim "Availability: Unix" are
     33  supported on Mac OS X, which builds on a Unix core.
     34
     35.. Availability notes get their own line and occur at the end of the function
     36.. documentation.
    2937
    3038.. note::
     
    4250.. data:: name
    4351
    44    The name of the operating system dependent module imported.  The following names
    45    have currently been registered: ``'posix'``, ``'nt'``, ``'mac'``, ``'os2'``,
    46    ``'ce'``, ``'java'``, ``'riscos'``.
     52   The name of the operating system dependent module imported.  The following
     53   names have currently been registered: ``'posix'``, ``'nt'``,
     54   ``'os2'``, ``'ce'``, ``'java'``, ``'riscos'``.
     55
     56   .. seealso::
     57      :attr:`sys.platform` has a finer granularity.  :func:`os.uname` gives
     58      system-dependent version information.
     59
     60      The :mod:`platform` module provides detailed checks for the
     61      system's identity.
    4762
    4863
     
    5873.. data:: environ
    5974
    60    A mapping object representing the string environment. For example,
     75   A :term:`mapping` object representing the string environment. For example,
    6176   ``environ['HOME']`` is the pathname of your home directory (on some platforms),
    6277   and is equivalent to ``getenv("HOME")`` in C.
     
    8095      On some platforms, including FreeBSD and Mac OS X, setting ``environ`` may
    8196      cause memory leaks.  Refer to the system documentation for
    82       :cfunc:`putenv`.
     97      :c:func:`putenv`.
    8398
    8499   If :func:`putenv` is not provided, a modified copy of this mapping  may be
     
    107122
    108123   Return the filename corresponding to the controlling terminal of the process.
     124
    109125   Availability: Unix.
    110126
     
    113129
    114130   Return the effective group id of the current process.  This corresponds to the
    115    "set id" bit on the file being executed in the current process. Availability:
    116    Unix.
     131   "set id" bit on the file being executed in the current process.
     132
     133   Availability: Unix.
    117134
    118135
     
    121138   .. index:: single: user; effective id
    122139
    123    Return the current process's effective user id. Availability: Unix.
     140   Return the current process's effective user id.
     141
     142   Availability: Unix.
    124143
    125144
     
    128147   .. index:: single: process; group
    129148
    130    Return the real group id of the current process. Availability: Unix.
     149   Return the real group id of the current process.
     150
     151   Availability: Unix.
    131152
    132153
     
    134155
    135156   Return list of supplemental group ids associated with the current process.
    136    Availability: Unix.
     157
     158   Availability: Unix.
     159
     160   .. note:: On Mac OS X, :func:`getgroups` behavior differs somewhat from
     161      other Unix platforms. If the Python interpreter was built with a
     162      deployment target of :const:`10.5` or earlier, :func:`getgroups` returns
     163      the list of effective group ids associated with the current user process;
     164      this list is limited to a system-defined number of entries, typically 16,
     165      and may be modified by calls to :func:`setgroups` if suitably privileged.
     166      If built with a deployment target greater than :const:`10.5`,
     167      :func:`getgroups` returns the current group access list for the user
     168      associated with the effective user id of the process; the group access
     169      list may change over the lifetime of the process, it is not affected by
     170      calls to :func:`setgroups`, and its length is not limited to 16.  The
     171      deployment target value, :const:`MACOSX_DEPLOYMENT_TARGET`, can be
     172      obtained with :func:`sysconfig.get_config_var`.
     173
     174
     175.. function:: initgroups(username, gid)
     176
     177   Call the system initgroups() to initialize the group access list with all of
     178   the groups of which the specified username is a member, plus the specified
     179   group id.
     180
     181   Availability: Unix.
     182
     183   .. versionadded:: 2.7
    137184
    138185
     
    143190   :envvar:`LOGNAME` to find out who the user is, or
    144191   ``pwd.getpwuid(os.getuid())[0]`` to get the login name of the currently
    145    effective user id. Availability: Unix.
     192   effective user id.
     193
     194   Availability: Unix.
    146195
    147196
     
    149198
    150199   Return the process group id of the process with process id *pid*. If *pid* is 0,
    151    the process group id of the current process is returned. Availability: Unix.
     200   the process group id of the current process is returned.
     201
     202   Availability: Unix.
    152203
    153204   .. versionadded:: 2.3
     
    158209   .. index:: single: process; group
    159210
    160    Return the id of the current process group. Availability: Unix.
     211   Return the id of the current process group.
     212
     213   Availability: Unix.
    161214
    162215
     
    165218   .. index:: single: process; id
    166219
    167    Return the current process id. Availability: Unix, Windows.
     220   Return the current process id.
     221
     222   Availability: Unix, Windows.
    168223
    169224
     
    172227   .. index:: single: process; id of parent
    173228
    174    Return the parent's process id. Availability: Unix.
     229   Return the parent's process id.
     230
     231   Availability: Unix.
     232
     233
     234.. function:: getresuid()
     235
     236   Return a tuple (ruid, euid, suid) denoting the current process's
     237   real, effective, and saved user ids.
     238
     239   Availability: Unix.
     240
     241   .. versionadded:: 2.7
     242
     243
     244.. function:: getresgid()
     245
     246   Return a tuple (rgid, egid, sgid) denoting the current process's
     247   real, effective, and saved group ids.
     248
     249   Availability: Unix.
     250
     251   .. versionadded:: 2.7
    175252
    176253
     
    179256   .. index:: single: user; id
    180257
    181    Return the current process's user id. Availability: Unix.
     258   Return the current process's user id.
     259
     260   Availability: Unix.
    182261
    183262
     
    185264
    186265   Return the value of the environment variable *varname* if it exists, or *value*
    187    if it doesn't.  *value* defaults to ``None``. Availability: most flavors of
    188    Unix, Windows.
     266   if it doesn't.  *value* defaults to ``None``.
     267
     268   Availability: most flavors of Unix, Windows.
    189269
    190270
     
    195275   Set the environment variable named *varname* to the string *value*.  Such
    196276   changes to the environment affect subprocesses started with :func:`os.system`,
    197    :func:`popen` or :func:`fork` and :func:`execv`. Availability: most flavors of
    198    Unix, Windows.
     277   :func:`popen` or :func:`fork` and :func:`execv`.
     278
     279   Availability: most flavors of Unix, Windows.
    199280
    200281   .. note::
     
    211292.. function:: setegid(egid)
    212293
    213    Set the current process's effective group id. Availability: Unix.
     294   Set the current process's effective group id.
     295
     296   Availability: Unix.
    214297
    215298
    216299.. function:: seteuid(euid)
    217300
    218    Set the current process's effective user id. Availability: Unix.
     301   Set the current process's effective user id.
     302
     303   Availability: Unix.
    219304
    220305
    221306.. function:: setgid(gid)
    222307
    223    Set the current process' group id. Availability: Unix.
     308   Set the current process' group id.
     309
     310   Availability: Unix.
    224311
    225312
     
    229316   *groups*. *groups* must be a sequence, and each element must be an integer
    230317   identifying a group. This operation is typically available only to the superuser.
     318
    231319   Availability: Unix.
    232320
    233321   .. versionadded:: 2.2
    234322
     323   .. note:: On Mac OS X, the length of *groups* may not exceed the
     324      system-defined maximum number of effective group ids, typically 16.
     325      See the documentation for :func:`getgroups` for cases where it may not
     326      return the same group list set by calling setgroups().
    235327
    236328.. function:: setpgrp()
    237329
    238    Call the system call :cfunc:`setpgrp` or :cfunc:`setpgrp(0, 0)` depending on
     330   Call the system call :c:func:`setpgrp` or :c:func:`setpgrp(0, 0)` depending on
    239331   which version is implemented (if any).  See the Unix manual for the semantics.
     332
    240333   Availability: Unix.
    241334
     
    243336.. function:: setpgid(pid, pgrp)
    244337
    245    Call the system call :cfunc:`setpgid` to set the process group id of the
     338   Call the system call :c:func:`setpgid` to set the process group id of the
    246339   process with id *pid* to the process group with id *pgrp*.  See the Unix manual
    247    for the semantics. Availability: Unix.
     340   for the semantics.
     341
     342   Availability: Unix.
     343
     344
     345.. function:: setregid(rgid, egid)
     346
     347   Set the current process's real and effective group ids.
     348
     349   Availability: Unix.
     350
     351
     352.. function:: setresgid(rgid, egid, sgid)
     353
     354   Set the current process's real, effective, and saved group ids.
     355
     356   Availability: Unix.
     357
     358   .. versionadded:: 2.7
     359
     360
     361.. function:: setresuid(ruid, euid, suid)
     362
     363   Set the current process's real, effective, and saved user ids.
     364
     365   Availability: Unix.
     366
     367   .. versionadded:: 2.7
    248368
    249369
    250370.. function:: setreuid(ruid, euid)
    251371
    252    Set the current process's real and effective user ids. Availability: Unix.
    253 
    254 
    255 .. function:: setregid(rgid, egid)
    256 
    257    Set the current process's real and effective group ids. Availability: Unix.
     372   Set the current process's real and effective user ids.
     373
     374   Availability: Unix.
    258375
    259376
    260377.. function:: getsid(pid)
    261378
    262    Call the system call :cfunc:`getsid`.  See the Unix manual for the semantics.
     379   Call the system call :c:func:`getsid`.  See the Unix manual for the semantics.
     380
    263381   Availability: Unix.
    264382
     
    268386.. function:: setsid()
    269387
    270    Call the system call :cfunc:`setsid`.  See the Unix manual for the semantics.
     388   Call the system call :c:func:`setsid`.  See the Unix manual for the semantics.
     389
    271390   Availability: Unix.
    272391
     
    276395   .. index:: single: user; id, setting
    277396
    278    Set the current process's user id. Availability: Unix.
     397   Set the current process's user id.
     398
     399   Availability: Unix.
    279400
    280401
     
    283404
    284405   Return the error message corresponding to the error code in *code*.
    285    On platforms where :cfunc:`strerror` returns ``NULL`` when given an unknown
    286    error number, :exc:`ValueError` is raised.  Availability: Unix, Windows.
     406   On platforms where :c:func:`strerror` returns ``NULL`` when given an unknown
     407   error number, :exc:`ValueError` is raised.
     408
     409   Availability: Unix, Windows.
    287410
    288411
    289412.. function:: umask(mask)
    290413
    291    Set the current numeric umask and return the previous umask. Availability:
    292    Unix, Windows.
     414   Set the current numeric umask and return the previous umask.
     415
     416   Availability: Unix, Windows.
    293417
    294418
     
    304428   leading component; a better way to get the hostname is
    305429   :func:`socket.gethostname`  or even
    306    ``socket.gethostbyaddr(socket.gethostname())``. Availability: recent flavors of
    307    Unix.
     430   ``socket.gethostbyaddr(socket.gethostname())``.
     431
     432   Availability: recent flavors of Unix.
    308433
    309434
     
    314439   Unset (delete) the environment variable named *varname*. Such changes to the
    315440   environment affect subprocesses started with :func:`os.system`, :func:`popen` or
    316    :func:`fork` and :func:`execv`. Availability: most flavors of Unix, Windows.
     441   :func:`fork` and :func:`execv`.
    317442
    318443   When :func:`unsetenv` is supported, deletion of items in ``os.environ`` is
     
    321446   preferable to delete items of ``os.environ``.
    322447
     448   Availability: most flavors of Unix, Windows.
     449
    323450
    324451.. _os-newstreams:
     
    336463   Return an open file object connected to the file descriptor *fd*.  The *mode*
    337464   and *bufsize* arguments have the same meaning as the corresponding arguments to
    338    the built-in :func:`open` function. Availability: Unix, Windows.
     465   the built-in :func:`open` function.
     466
     467   Availability: Unix, Windows.
    339468
    340469   .. versionchanged:: 2.3
     
    344473   .. versionchanged:: 2.5
    345474      On Unix, when the *mode* argument starts with ``'a'``, the *O_APPEND* flag is
    346       set on the file descriptor (which the :cfunc:`fdopen` implementation already
     475      set on the file descriptor (which the :c:func:`fdopen` implementation already
    347476      does on most platforms).
    348477
     
    357486   available as the return value of the :meth:`~file.close` method of the file object,
    358487   except that when the exit status is zero (termination without errors), ``None``
    359    is returned. Availability: Unix, Windows.
     488   is returned.
     489
     490   Availability: Unix, Windows.
    360491
    361492   .. deprecated:: 2.6
     
    365496   .. versionchanged:: 2.0
    366497      This function worked unreliably under Windows in earlier versions of Python.
    367       This was due to the use of the :cfunc:`_popen` function from the libraries
     498      This was due to the use of the :c:func:`_popen` function from the libraries
    368499      provided with Windows.  Newer versions of Python do not use the broken
    369500      implementation from the Windows libraries.
     
    374505   Return a new file object opened in update mode (``w+b``).  The file has no
    375506   directory entries associated with it and will be automatically deleted once
    376    there are no file descriptors for the file. Availability: Unix,
    377    Windows.
     507   there are no file descriptors for the file.
     508
     509   Availability: Unix, Windows.
    378510
    379511There are a number of different :func:`popen\*` functions that provide slightly
     
    468600by file descriptors.
    469601
     602The :meth:`~file.fileno` method can be used to obtain the file descriptor
     603associated with a file object when required.  Note that using the file
     604descriptor directly will bypass the file object methods, ignoring aspects such
     605as internal buffering of data.
    470606
    471607.. function:: close(fd)
    472608
    473    Close file descriptor *fd*. Availability: Unix, Windows.
     609   Close file descriptor *fd*.
     610
     611   Availability: Unix, Windows.
    474612
    475613   .. note::
     
    478616      descriptor as returned by :func:`os.open` or :func:`pipe`.  To close a "file
    479617      object" returned by the built-in function :func:`open` or by :func:`popen` or
    480       :func:`fdopen`, use its :meth:`~file.close` method.
     618      :func:`fdopen`, use its :meth:`~io.IOBase.close` method.
    481619
    482620
     
    484622
    485623   Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive),
    486    ignoring errors. Availability: Unix, Windows. Equivalent to::
     624   ignoring errors. Equivalent to::
    487625
    488626      for fd in xrange(fd_low, fd_high):
     
    492630              pass
    493631
     632   Availability: Unix, Windows.
     633
    494634   .. versionadded:: 2.6
    495635
     
    497637.. function:: dup(fd)
    498638
    499    Return a duplicate of file descriptor *fd*. Availability: Unix,
    500    Windows.
     639   Return a duplicate of file descriptor *fd*.
     640
     641   Availability: Unix, Windows.
    501642
    502643
     
    504645
    505646   Duplicate file descriptor *fd* to *fd2*, closing the latter first if necessary.
     647
    506648   Availability: Unix, Windows.
    507649
     
    510652
    511653   Change the mode of the file given by *fd* to the numeric *mode*.  See the docs
    512    for :func:`chmod` for possible values of *mode*.  Availability: Unix.
     654   for :func:`chmod` for possible values of *mode*.
     655
     656   Availability: Unix.
    513657
    514658   .. versionadded:: 2.6
     
    519663   Change the owner and group id of the file given by *fd* to the numeric *uid*
    520664   and *gid*.  To leave one of the ids unchanged, set it to -1.
     665
    521666   Availability: Unix.
    522667
     
    527672
    528673   Force write of file with filedescriptor *fd* to disk. Does not force update of
    529    metadata. Availability: Unix.
     674   metadata.
     675
     676   Availability: Unix.
    530677
    531678   .. note::
     
    542689   given in the ``pathconf_names`` dictionary.  For configuration variables not
    543690   included in that mapping, passing an integer for *name* is also accepted.
    544    Availability: Unix.
    545691
    546692   If *name* is a string and is not known, :exc:`ValueError` is raised.  If a
     
    549695   :const:`errno.EINVAL` for the error number.
    550696
     697   Availability: Unix.
     698
    551699
    552700.. function:: fstat(fd)
    553701
    554    Return status for file descriptor *fd*, like :func:`stat`. Availability:
    555    Unix, Windows.
     702   Return status for file descriptor *fd*, like :func:`~os.stat`.
     703
     704   Availability: Unix, Windows.
    556705
    557706
     
    559708
    560709   Return information about the filesystem containing the file associated with file
    561    descriptor *fd*, like :func:`statvfs`. Availability: Unix.
     710   descriptor *fd*, like :func:`statvfs`.
     711
     712   Availability: Unix.
    562713
    563714
     
    565716
    566717   Force write of file with filedescriptor *fd* to disk.  On Unix, this calls the
    567    native :cfunc:`fsync` function; on Windows, the MS :cfunc:`_commit` function.
     718   native :c:func:`fsync` function; on Windows, the MS :c:func:`_commit` function.
    568719
    569720   If you're starting with a Python file object *f*, first do ``f.flush()``, and
    570721   then do ``os.fsync(f.fileno())``, to ensure that all internal buffers associated
    571    with *f* are written to disk. Availability: Unix, and Windows
    572    starting in 2.2.3.
     722   with *f* are written to disk.
     723
     724   Availability: Unix, and Windows starting in 2.2.3.
    573725
    574726
     
    576728
    577729   Truncate the file corresponding to file descriptor *fd*, so that it is at most
    578    *length* bytes in size. Availability: Unix.
     730   *length* bytes in size.
     731
     732   Availability: Unix.
    579733
    580734
     
    582736
    583737   Return ``True`` if the file descriptor *fd* is open and connected to a
    584    tty(-like) device, else ``False``. Availability: Unix.
     738   tty(-like) device, else ``False``.
    585739
    586740
     
    590744   by *how*: :const:`SEEK_SET` or ``0`` to set the position relative to the
    591745   beginning of the file; :const:`SEEK_CUR` or ``1`` to set it relative to the
    592    current position; :const:`os.SEEK_END` or ``2`` to set it relative to the end of
    593    the file. Availability: Unix, Windows.
     746   current position; :const:`SEEK_END` or ``2`` to set it relative to the end of
     747   the file.
     748
     749   Availability: Unix, Windows.
     750
     751
     752.. data:: SEEK_SET
     753          SEEK_CUR
     754          SEEK_END
     755
     756   Parameters to the :func:`lseek` function. Their values are 0, 1, and 2,
     757   respectively.
     758
     759   Availability: Windows, Unix.
     760
     761   .. versionadded:: 2.5
    594762
    595763
     
    599767   mode according to *mode*. The default *mode* is ``0777`` (octal), and the
    600768   current umask value is first masked out.  Return the file descriptor for the
    601    newly opened file. Availability: Unix, Windows.
     769   newly opened file.
    602770
    603771   For a description of the flag and mode values, see the C run-time documentation;
    604772   flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) are defined in
    605    this module too (see below).
     773   this module too (see :ref:`open-constants`).  In particular, on Windows adding
     774   :const:`O_BINARY` is needed to open files in binary mode.
     775
     776   Availability: Unix, Windows.
    606777
    607778   .. note::
     
    619790   Open a new pseudo-terminal pair. Return a pair of file descriptors ``(master,
    620791   slave)`` for the pty and the tty, respectively. For a (slightly) more portable
    621    approach, use the :mod:`pty` module. Availability: some flavors of
    622    Unix.
     792   approach, use the :mod:`pty` module.
     793
     794   Availability: some flavors of Unix.
    623795
    624796
     
    626798
    627799   Create a pipe.  Return a pair of file descriptors ``(r, w)`` usable for reading
    628    and writing, respectively. Availability: Unix, Windows.
     800   and writing, respectively.
     801
     802   Availability: Unix, Windows.
    629803
    630804
     
    633807   Read at most *n* bytes from file descriptor *fd*. Return a string containing the
    634808   bytes read.  If the end of the file referred to by *fd* has been reached, an
    635    empty string is returned. Availability: Unix, Windows.
     809   empty string is returned.
     810
     811   Availability: Unix, Windows.
    636812
    637813   .. note::
     
    647823
    648824   Return the process group associated with the terminal given by *fd* (an open
    649    file descriptor as returned by :func:`os.open`). Availability: Unix.
     825   file descriptor as returned by :func:`os.open`).
     826
     827   Availability: Unix.
    650828
    651829
     
    653831
    654832   Set the process group associated with the terminal given by *fd* (an open file
    655    descriptor as returned by :func:`os.open`) to *pg*. Availability: Unix.
     833   descriptor as returned by :func:`os.open`) to *pg*.
     834
     835   Availability: Unix.
    656836
    657837
     
    660840   Return a string which specifies the terminal device associated with
    661841   file descriptor *fd*.  If *fd* is not associated with a terminal device, an
    662    exception is raised. Availability: Unix.
     842   exception is raised.
     843
     844   Availability: Unix.
    663845
    664846
     
    666848
    667849   Write the string *str* to file descriptor *fd*. Return the number of bytes
    668    actually written. Availability: Unix, Windows.
     850   actually written.
     851
     852   Availability: Unix, Windows.
    669853
    670854   .. note::
     
    675859      :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use its
    676860      :meth:`~file.write` method.
     861
     862
     863.. _open-constants:
     864
     865``open()`` flag constants
     866~~~~~~~~~~~~~~~~~~~~~~~~~
    677867
    678868The following constants are options for the *flags* parameter to the
     
    727917
    728918
    729 .. data:: SEEK_SET
    730           SEEK_CUR
    731           SEEK_END
    732 
    733    Parameters to the :func:`lseek` function. Their values are 0, 1, and 2,
    734    respectively. Availability: Windows, Unix.
    735 
    736    .. versionadded:: 2.5
    737 
    738 
    739919.. _os-file-dir:
    740920
     
    751931   :const:`X_OK` to test permissions.  Return :const:`True` if access is allowed,
    752932   :const:`False` if not. See the Unix man page :manpage:`access(2)` for more
    753    information. Availability: Unix, Windows.
     933   information.
     934
     935   Availability: Unix, Windows.
    754936
    755937   .. note::
     
    758940      before actually doing so using :func:`open` creates a security hole,
    759941      because the user might exploit the short time interval between checking
    760       and opening the file to manipulate it.
     942      and opening the file to manipulate it. It's preferable to use :term:`EAFP`
     943      techniques. For example::
     944
     945         if os.access("myfile", os.R_OK):
     946             with open("myfile") as fp:
     947                 return fp.read()
     948         return "some default data"
     949
     950      is better written as::
     951
     952         try:
     953             fp = open("myfile")
     954         except IOError as e:
     955             if e.errno == errno.EACCES:
     956                 return "some default data"
     957             # Not a permission error.
     958             raise
     959         else:
     960             with fp:
     961                 return fp.read()
    761962
    762963   .. note::
     
    795996   .. index:: single: directory; changing
    796997
    797    Change the current working directory to *path*. Availability: Unix,
    798    Windows.
     998   Change the current working directory to *path*.
     999
     1000   Availability: Unix, Windows.
    7991001
    8001002
     
    8031005   Change the current working directory to the directory represented by the file
    8041006   descriptor *fd*.  The descriptor must refer to an opened directory, not an open
    805    file. Availability: Unix.
     1007   file.
     1008
     1009   Availability: Unix.
    8061010
    8071011   .. versionadded:: 2.3
     
    8101014.. function:: getcwd()
    8111015
    812    Return a string representing the current working directory. Availability:
    813    Unix, Windows.
     1016   Return a string representing the current working directory.
     1017
     1018   Availability: Unix, Windows.
    8141019
    8151020
     
    8171022
    8181023   Return a Unicode object representing the current working directory.
     1024
    8191025   Availability: Unix, Windows.
    8201026
     
    8271033   (bitwise OR) of the following values (as defined in the :mod:`stat` module):
    8281034
    829    * ``UF_NODUMP``
    830    * ``UF_IMMUTABLE``
    831    * ``UF_APPEND``
    832    * ``UF_OPAQUE``
    833    * ``UF_NOUNLINK``
    834    * ``SF_ARCHIVED``
    835    * ``SF_IMMUTABLE``
    836    * ``SF_APPEND``
    837    * ``SF_NOUNLINK``
    838    * ``SF_SNAPSHOT``
     1035   * :data:`stat.UF_NODUMP`
     1036   * :data:`stat.UF_IMMUTABLE`
     1037   * :data:`stat.UF_APPEND`
     1038   * :data:`stat.UF_OPAQUE`
     1039   * :data:`stat.UF_NOUNLINK`
     1040   * :data:`stat.UF_COMPRESSED`
     1041   * :data:`stat.UF_HIDDEN`
     1042   * :data:`stat.SF_ARCHIVED`
     1043   * :data:`stat.SF_IMMUTABLE`
     1044   * :data:`stat.SF_APPEND`
     1045   * :data:`stat.SF_NOUNLINK`
     1046   * :data:`stat.SF_SNAPSHOT`
    8391047
    8401048   Availability: Unix.
     
    8911099
    8921100   Change the owner and group id of *path* to the numeric *uid* and *gid*. To leave
    893    one of the ids unchanged, set it to -1. Availability: Unix.
     1101   one of the ids unchanged, set it to -1.
     1102
     1103   Availability: Unix.
    8941104
    8951105
     
    8971107
    8981108   Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do not
    899    follow symbolic links. Availability: Unix.
     1109   follow symbolic links.
     1110
     1111   Availability: Unix.
    9001112
    9011113   .. versionadded:: 2.6
     
    9061118   Change the mode of *path* to the numeric *mode*. If path is a symlink, this
    9071119   affects the symlink rather than the target. See the docs for :func:`chmod`
    908    for possible values of *mode*.  Availability: Unix.
     1120   for possible values of *mode*.
     1121
     1122   Availability: Unix.
    9091123
    9101124   .. versionadded:: 2.6
     
    9141128
    9151129   Change the owner and group id of *path* to the numeric *uid* and *gid*. This
    916    function will not follow symbolic links. Availability: Unix.
     1130   function will not follow symbolic links.
     1131
     1132   Availability: Unix.
    9171133
    9181134   .. versionadded:: 2.3
     
    9211137.. function:: link(source, link_name)
    9221138
    923    Create a hard link pointing to *source* named *link_name*. Availability:
    924    Unix.
     1139   Create a hard link pointing to *source* named *link_name*.
     1140
     1141   Availability: Unix.
    9251142
    9261143
     
    9301147   *path*.  The list is in arbitrary order.  It does not include the special
    9311148   entries ``'.'`` and ``'..'`` even if they are present in the
    932    directory.  Availability: Unix, Windows.
     1149   directory.
     1150
     1151   Availability: Unix, Windows.
    9331152
    9341153   .. versionchanged:: 2.3
     
    9401159.. function:: lstat(path)
    9411160
    942    Like :func:`stat`, but do not follow symbolic links.  This is an alias for
    943    :func:`stat` on platforms that do not support symbolic links, such as
    944    Windows.
     1161   Perform the equivalent of an :c:func:`lstat` system call on the given path.
     1162   Similar to :func:`~os.stat`, but does not follow symbolic links.  On
     1163   platforms that do not support symbolic links, this is an alias for
     1164   :func:`~os.stat`.
    9451165
    9461166
     
    9491169   Create a FIFO (a named pipe) named *path* with numeric mode *mode*.  The default
    9501170   *mode* is ``0666`` (octal).  The current umask value is first masked out from
    951    the mode. Availability: Unix.
     1171   the mode.
     1172
     1173   Availability: Unix.
    9521174
    9531175   FIFOs are pipes that can be accessed like regular files.  FIFOs exist until they
     
    9581180
    9591181
    960 .. function:: mknod(filename[, mode=0600, device])
     1182.. function:: mknod(filename[, mode=0600[, device=0]])
    9611183
    9621184   Create a filesystem node (file, device special file or named pipe) named
     
    9751197
    9761198   Extract the device major number from a raw device number (usually the
    977    :attr:`st_dev` or :attr:`st_rdev` field from :ctype:`stat`).
     1199   :attr:`st_dev` or :attr:`st_rdev` field from :c:type:`stat`).
    9781200
    9791201   .. versionadded:: 2.3
     
    9831205
    9841206   Extract the device minor number from a raw device number (usually the
    985    :attr:`st_dev` or :attr:`st_rdev` field from :ctype:`stat`).
     1207   :attr:`st_dev` or :attr:`st_rdev` field from :c:type:`stat`).
    9861208
    9871209   .. versionadded:: 2.3
     
    9991221   Create a directory named *path* with numeric mode *mode*. The default *mode* is
    10001222   ``0777`` (octal).  On some systems, *mode* is ignored.  Where it is used, the
    1001    current umask value is first masked out. Availability: Unix, Windows.
     1223   current umask value is first masked out.  If the directory already exists,
     1224   :exc:`OSError` is raised.
    10021225
    10031226   It is also possible to create temporary directories; see the
    10041227   :mod:`tempfile` module's :func:`tempfile.mkdtemp` function.
     1228
     1229   Availability: Unix, Windows.
    10051230
    10061231
     
    10121237
    10131238   Recursive directory creation function.  Like :func:`mkdir`, but makes all
    1014    intermediate-level directories needed to contain the leaf directory.  Throws an
     1239   intermediate-level directories needed to contain the leaf directory.  Raises an
    10151240   :exc:`error` exception if the leaf directory already exists or cannot be
    10161241   created.  The default *mode* is ``0777`` (octal).  On some systems, *mode* is
     
    10371262   given in the ``pathconf_names`` dictionary.  For configuration variables not
    10381263   included in that mapping, passing an integer for *name* is also accepted.
    1039    Availability: Unix.
    10401264
    10411265   If *name* is a string and is not known, :exc:`ValueError` is raised.  If a
     
    10431267   included in ``pathconf_names``, an :exc:`OSError` is raised with
    10441268   :const:`errno.EINVAL` for the error number.
     1269
     1270   Availability: Unix.
    10451271
    10461272
     
    10731299   remove a file that is in use causes an exception to be raised; on Unix, the
    10741300   directory entry is removed but the storage allocated to the file is not made
    1075    available until the original file is no longer in use. Availability: Unix,
    1076    Windows.
     1301   available until the original file is no longer in use.
     1302
     1303   Availability: Unix, Windows.
    10771304
    10781305
     
    11021329   Windows, if *dst* already exists, :exc:`OSError` will be raised even if it is a
    11031330   file; there may be no way to implement an atomic rename when *dst* names an
    1104    existing file. Availability: Unix, Windows.
     1331   existing file.
     1332
     1333   Availability: Unix, Windows.
    11051334
    11061335
     
    11241353   Remove (delete) the directory *path*.  Only works when the directory is
    11251354   empty, otherwise, :exc:`OSError` is raised.  In order to remove whole
    1126    directory trees, :func:`shutil.rmtree` can be used.  Availability: Unix,
    1127    Windows.
     1355   directory trees, :func:`shutil.rmtree` can be used.
     1356
     1357   Availability: Unix, Windows.
    11281358
    11291359
    11301360.. function:: stat(path)
    11311361
    1132    Perform a :cfunc:`stat` system call on the given path.  The return value is an
    1133    object whose attributes correspond to the members of the :ctype:`stat`
    1134    structure, namely: :attr:`st_mode` (protection bits), :attr:`st_ino` (inode
    1135    number), :attr:`st_dev` (device), :attr:`st_nlink` (number of hard links),
    1136    :attr:`st_uid` (user id of owner), :attr:`st_gid` (group id of owner),
    1137    :attr:`st_size` (size of file, in bytes), :attr:`st_atime` (time of most recent
    1138    access), :attr:`st_mtime` (time of most recent content modification),
    1139    :attr:`st_ctime` (platform dependent; time of most recent metadata change on
    1140    Unix, or the time of creation on Windows)::
    1141 
    1142       >>> import os
    1143       >>> statinfo = os.stat('somefile.txt')
    1144       >>> statinfo
    1145       (33188, 422511L, 769L, 1, 1032, 100, 926L, 1105022698,1105022732, 1105022732)
    1146       >>> statinfo.st_size
    1147       926L
    1148       >>>
     1362   Perform the equivalent of a :c:func:`stat` system call on the given path.
     1363   (This function follows symlinks; to stat a symlink use :func:`lstat`.)
     1364
     1365   The return value is an object whose attributes correspond to the members
     1366   of the :c:type:`stat` structure, namely:
     1367
     1368   * :attr:`st_mode` - protection bits,
     1369   * :attr:`st_ino` - inode number,
     1370   * :attr:`st_dev` - device,
     1371   * :attr:`st_nlink` - number of hard links,
     1372   * :attr:`st_uid` - user id of owner,
     1373   * :attr:`st_gid` - group id of owner,
     1374   * :attr:`st_size` - size of file, in bytes,
     1375   * :attr:`st_atime` - time of most recent access,
     1376   * :attr:`st_mtime` - time of most recent content modification,
     1377   * :attr:`st_ctime` - platform dependent; time of most recent metadata change on
     1378     Unix, or the time of creation on Windows)
    11491379
    11501380   .. versionchanged:: 2.3
     
    11551385
    11561386   On some Unix systems (such as Linux), the following attributes may also be
    1157    available: :attr:`st_blocks` (number of blocks allocated for file),
    1158    :attr:`st_blksize` (filesystem blocksize), :attr:`st_rdev` (type of device if an
    1159    inode device). :attr:`st_flags` (user defined flags for file).
     1387   available:
     1388
     1389   * :attr:`st_blocks` - number of 512-byte blocks allocated for file
     1390   * :attr:`st_blksize` - filesystem blocksize for efficient file system I/O
     1391   * :attr:`st_rdev` - type of device if an inode device
     1392   * :attr:`st_flags` - user defined flags for file
    11601393
    11611394   On other Unix systems (such as FreeBSD), the following attributes may be
    1162    available (but may be only filled out if root tries to use them): :attr:`st_gen`
    1163    (file generation number), :attr:`st_birthtime` (time of file creation).
     1395   available (but may be only filled out if root tries to use them):
     1396
     1397   * :attr:`st_gen` - file generation number
     1398   * :attr:`st_birthtime` - time of file creation
    11641399
    11651400   On Mac OS systems, the following attributes may also be available:
    1166    :attr:`st_rsize`, :attr:`st_creator`, :attr:`st_type`.
    1167 
    1168    On RISCOS systems, the following attributes are also available: :attr:`st_ftype`
    1169    (file type), :attr:`st_attrs` (attributes), :attr:`st_obtype` (object type).
    1170 
    1171    .. index:: module: stat
    1172 
    1173    For backward compatibility, the return value of :func:`stat` is also accessible
     1401
     1402   * :attr:`st_rsize`
     1403   * :attr:`st_creator`
     1404   * :attr:`st_type`
     1405
     1406   On RISCOS systems, the following attributes are also available:
     1407
     1408   * :attr:`st_ftype` (file type)
     1409   * :attr:`st_attrs` (attributes)
     1410   * :attr:`st_obtype` (object type).
     1411
     1412   .. note::
     1413
     1414      The exact meaning and resolution of the :attr:`st_atime`,
     1415      :attr:`st_mtime`, and :attr:`st_ctime` attributes depend on the operating
     1416      system and the file system. For example, on Windows systems using the FAT
     1417      or FAT32 file systems, :attr:`st_mtime` has 2-second resolution, and
     1418      :attr:`st_atime` has only 1-day resolution.  See your operating system
     1419      documentation for details.
     1420
     1421   For backward compatibility, the return value of :func:`~os.stat` is also accessible
    11741422   as a tuple of at least 10 integers giving the most important (and portable)
    1175    members of the :ctype:`stat` structure, in the order :attr:`st_mode`,
     1423   members of the :c:type:`stat` structure, in the order :attr:`st_mode`,
    11761424   :attr:`st_ino`, :attr:`st_dev`, :attr:`st_nlink`, :attr:`st_uid`,
    11771425   :attr:`st_gid`, :attr:`st_size`, :attr:`st_atime`, :attr:`st_mtime`,
    11781426   :attr:`st_ctime`. More items may be added at the end by some implementations.
     1427
     1428   .. index:: module: stat
     1429
    11791430   The standard module :mod:`stat` defines functions and constants that are useful
    1180    for extracting information from a :ctype:`stat` structure. (On Windows, some
     1431   for extracting information from a :c:type:`stat` structure. (On Windows, some
    11811432   items are filled with dummy values.)
    11821433
    1183    .. note::
    1184 
    1185       The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, and
    1186       :attr:`st_ctime` members depends on the operating system and the file system.
    1187       For example, on Windows systems using the FAT or FAT32 file systems,
    1188       :attr:`st_mtime` has 2-second resolution, and :attr:`st_atime` has only 1-day
    1189       resolution.  See your operating system documentation for details.
     1434   Example::
     1435
     1436      >>> import os
     1437      >>> statinfo = os.stat('somefile.txt')
     1438      >>> statinfo
     1439      (33188, 422511, 769, 1, 1032, 100, 926, 1105022698,1105022732, 1105022732)
     1440      >>> statinfo.st_size
     1441      926
    11901442
    11911443   Availability: Unix, Windows.
     
    12011453
    12021454   Determine whether :class:`stat_result` represents time stamps as float objects.
    1203    If *newvalue* is ``True``, future calls to :func:`stat` return floats, if it is
     1455   If *newvalue* is ``True``, future calls to :func:`~os.stat` return floats, if it is
    12041456   ``False``, future calls return ints. If *newvalue* is omitted, return the
    12051457   current setting.
     
    12261478.. function:: statvfs(path)
    12271479
    1228    Perform a :cfunc:`statvfs` system call on the given path.  The return value is
     1480   Perform a :c:func:`statvfs` system call on the given path.  The return value is
    12291481   an object whose attributes describe the filesystem on the given path, and
    1230    correspond to the members of the :ctype:`statvfs` structure, namely:
     1482   correspond to the members of the :c:type:`statvfs` structure, namely:
    12311483   :attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`,
    12321484   :attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`,
    1233    :attr:`f_flag`, :attr:`f_namemax`. Availability: Unix.
     1485   :attr:`f_flag`, :attr:`f_namemax`.
    12341486
    12351487   .. index:: module: statvfs
     
    12381490   values correspond to the attributes, in the order given above. The standard
    12391491   module :mod:`statvfs` defines constants that are useful for extracting
    1240    information from a :ctype:`statvfs` structure when accessing it as a sequence;
     1492   information from a :c:type:`statvfs` structure when accessing it as a sequence;
    12411493   this remains useful when writing code that needs to work with versions of Python
    12421494   that don't support accessing the fields as attributes.
    12431495
     1496   Availability: Unix.
     1497
    12441498   .. versionchanged:: 2.2
    12451499      Added access to values as attributes of the returned object.
     
    12481502.. function:: symlink(source, link_name)
    12491503
    1250    Create a symbolic link pointing to *source* named *link_name*. Availability:
    1251    Unix.
     1504   Create a symbolic link pointing to *source* named *link_name*.
     1505
     1506   Availability: Unix.
    12521507
    12531508
     
    13031558   Remove (delete) the file *path*.  This is the same function as
    13041559   :func:`remove`; the :func:`unlink` name is its traditional Unix
    1305    name. Availability: Unix, Windows.
     1560   name.
     1561
     1562   Availability: Unix, Windows.
    13061563
    13071564
     
    13161573   the operating system implements directories as files (for example, Windows
    13171574   does not).  Note that the exact times you set here may not be returned by a
    1318    subsequent :func:`stat` call, depending on the resolution with which your
    1319    operating system records access and modification times; see :func:`stat`.
     1575   subsequent :func:`~os.stat` call, depending on the resolution with which your
     1576   operating system records access and modification times; see :func:`~os.stat`.
    13201577
    13211578   .. versionchanged:: 2.0
     
    13251582
    13261583
    1327 .. function:: walk(top[, topdown=True [, onerror=None[, followlinks=False]]])
     1584.. function:: walk(top, topdown=True, onerror=None, followlinks=False)
    13281585
    13291586   .. index::
     
    13581615   generated before *dirpath* itself is generated.
    13591616
    1360    By default errors from the :func:`listdir` call are ignored.  If optional
     1617   By default, errors from the :func:`listdir` call are ignored.  If optional
    13611618   argument *onerror* is specified, it should be a function; it will be called with
    13621619   one argument, an :exc:`OSError` instance.  It can report the error to continue
     
    14201677These functions may be used to create and manage processes.
    14211678
    1422 The various :func:`exec\*` functions take a list of arguments for the new
     1679The various :func:`exec\* <execl>` functions take a list of arguments for the new
    14231680program loaded into the process.  In each case, the first of these arguments is
    14241681passed to the new program as its own name rather than as an argument a user may
    14251682have typed on a command line.  For the C programmer, this is the ``argv[0]``
    1426 passed to a program's :cfunc:`main`.  For example, ``os.execv('/bin/echo',
     1683passed to a program's :c:func:`main`.  For example, ``os.execv('/bin/echo',
    14271684['foo', 'bar'])`` will only print ``bar`` on standard output; ``foo`` will seem
    14281685to be ignored.
     
    14331690   Generate a :const:`SIGABRT` signal to the current process.  On Unix, the default
    14341691   behavior is to produce a core dump; on Windows, the process immediately returns
    1435    an exit code of ``3``.  Be aware that programs which use :func:`signal.signal`
    1436    to register a handler for :const:`SIGABRT` will behave differently.
     1692   an exit code of ``3``.  Be aware that calling this function will not call the
     1693   Python signal handler registered for :const:`SIGABRT` with
     1694   :func:`signal.signal`.
     1695
    14371696   Availability: Unix, Windows.
    14381697
     
    14561715   on these open files, you should flush them using
    14571716   :func:`sys.stdout.flush` or :func:`os.fsync` before calling an
    1458    :func:`exec\*` function.
    1459 
    1460    The "l" and "v" variants of the :func:`exec\*` functions differ in how
     1717   :func:`exec\* <execl>` function.
     1718
     1719   The "l" and "v" variants of the :func:`exec\* <execl>` functions differ in how
    14611720   command-line arguments are passed.  The "l" variants are perhaps the easiest
    14621721   to work with if the number of parameters is fixed when the code is written; the
     
    14701729   :func:`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the
    14711730   :envvar:`PATH` environment variable to locate the program *file*.  When the
    1472    environment is being replaced (using one of the :func:`exec\*e` variants,
     1731   environment is being replaced (using one of the :func:`exec\*e <execl>` variants,
    14731732   discussed in the next paragraph), the new environment is used as the source of
    14741733   the :envvar:`PATH` variable. The other variants, :func:`execl`, :func:`execle`,
     
    14891748.. function:: _exit(n)
    14901749
    1491    Exit to the system with status *n*, without calling cleanup handlers, flushing
    1492    stdio buffers, etc. Availability: Unix, Windows.
     1750   Exit the process with status *n*, without calling cleanup handlers, flushing
     1751   stdio buffers, etc.
     1752
     1753   Availability: Unix, Windows.
    14931754
    14941755   .. note::
    14951756
    1496       The standard way to exit is ``sys.exit(n)``. :func:`_exit` should normally only
    1497       be used in the child process after a :func:`fork`.
     1757      The standard way to exit is ``sys.exit(n)``.  :func:`_exit` should
     1758      normally only be used in the child process after a :func:`fork`.
    14981759
    14991760The following exit codes are defined and can be used with :func:`_exit`,
     
    15101771.. data:: EX_OK
    15111772
    1512    Exit code that means no error occurred. Availability: Unix.
     1773   Exit code that means no error occurred.
     1774
     1775   Availability: Unix.
    15131776
    15141777   .. versionadded:: 2.3
     
    15181781
    15191782   Exit code that means the command was used incorrectly, such as when the wrong
    1520    number of arguments are given. Availability: Unix.
     1783   number of arguments are given.
     1784
     1785   Availability: Unix.
    15211786
    15221787   .. versionadded:: 2.3
     
    15251790.. data:: EX_DATAERR
    15261791
    1527    Exit code that means the input data was incorrect. Availability: Unix.
     1792   Exit code that means the input data was incorrect.
     1793
     1794   Availability: Unix.
    15281795
    15291796   .. versionadded:: 2.3
     
    15331800
    15341801   Exit code that means an input file did not exist or was not readable.
     1802
    15351803   Availability: Unix.
    15361804
     
    15401808.. data:: EX_NOUSER
    15411809
    1542    Exit code that means a specified user did not exist. Availability: Unix.
     1810   Exit code that means a specified user did not exist.
     1811
     1812   Availability: Unix.
    15431813
    15441814   .. versionadded:: 2.3
     
    15471817.. data:: EX_NOHOST
    15481818
    1549    Exit code that means a specified host did not exist. Availability: Unix.
     1819   Exit code that means a specified host did not exist.
     1820
     1821   Availability: Unix.
    15501822
    15511823   .. versionadded:: 2.3
     
    15541826.. data:: EX_UNAVAILABLE
    15551827
    1556    Exit code that means that a required service is unavailable. Availability:
    1557    Unix.
     1828   Exit code that means that a required service is unavailable.
     1829
     1830   Availability: Unix.
    15581831
    15591832   .. versionadded:: 2.3
     
    15621835.. data:: EX_SOFTWARE
    15631836
    1564    Exit code that means an internal software error was detected. Availability:
    1565    Unix.
     1837   Exit code that means an internal software error was detected.
     1838
     1839   Availability: Unix.
    15661840
    15671841   .. versionadded:: 2.3
     
    15711845
    15721846   Exit code that means an operating system error was detected, such as the
    1573    inability to fork or create a pipe. Availability: Unix.
     1847   inability to fork or create a pipe.
     1848
     1849   Availability: Unix.
    15741850
    15751851   .. versionadded:: 2.3
     
    15791855
    15801856   Exit code that means some system file did not exist, could not be opened, or had
    1581    some other kind of error. Availability: Unix.
     1857   some other kind of error.
     1858
     1859   Availability: Unix.
    15821860
    15831861   .. versionadded:: 2.3
     
    15871865
    15881866   Exit code that means a user specified output file could not be created.
     1867
    15891868   Availability: Unix.
    15901869
     
    15951874
    15961875   Exit code that means that an error occurred while doing I/O on some file.
     1876
    15971877   Availability: Unix.
    15981878
     
    16041884   Exit code that means a temporary failure occurred.  This indicates something
    16051885   that may not really be an error, such as a network connection that couldn't be
    1606    made during a retryable operation. Availability: Unix.
     1886   made during a retryable operation.
     1887
     1888   Availability: Unix.
    16071889
    16081890   .. versionadded:: 2.3
     
    16121894
    16131895   Exit code that means that a protocol exchange was illegal, invalid, or not
    1614    understood. Availability: Unix.
     1896   understood.
     1897
     1898   Availability: Unix.
    16151899
    16161900   .. versionadded:: 2.3
     
    16201904
    16211905   Exit code that means that there were insufficient permissions to perform the
    1622    operation (but not intended for file system problems). Availability: Unix.
     1906   operation (but not intended for file system problems).
     1907
     1908   Availability: Unix.
    16231909
    16241910   .. versionadded:: 2.3
     
    16281914
    16291915   Exit code that means that some kind of configuration error occurred.
     1916
    16301917   Availability: Unix.
    16311918
     
    16351922.. data:: EX_NOTFOUND
    16361923
    1637    Exit code that means something like "an entry was not found". Availability:
    1638    Unix.
     1924   Exit code that means something like "an entry was not found".
     1925
     1926   Availability: Unix.
    16391927
    16401928   .. versionadded:: 2.3
     
    16591947   master end of the pseudo-terminal.  For a more portable approach, use the
    16601948   :mod:`pty` module.  If an error occurs :exc:`OSError` is raised.
     1949
    16611950   Availability: some flavors of Unix.
    16621951
     
    16701959   Send signal *sig* to the process *pid*.  Constants for the specific signals
    16711960   available on the host platform are defined in the :mod:`signal` module.
    1672    Availability: Unix.
     1961
     1962   Windows: The :data:`signal.CTRL_C_EVENT` and
     1963   :data:`signal.CTRL_BREAK_EVENT` signals are special signals which can
     1964   only be sent to console processes which share a common console window,
     1965   e.g., some subprocesses. Any other value for *sig* will cause the process
     1966   to be unconditionally killed by the TerminateProcess API, and the exit code
     1967   will be set to *sig*. The Windows version of :func:`kill` additionally takes
     1968   process handles to be killed.
     1969
     1970   .. versionadded:: 2.7 Windows support
    16731971
    16741972
     
    16791977      single: process; signalling
    16801978
    1681    Send the signal *sig* to the process group *pgid*. Availability: Unix.
     1979   Send the signal *sig* to the process group *pgid*.
     1980
     1981   Availability: Unix.
    16821982
    16831983   .. versionadded:: 2.3
     
    16871987
    16881988   Add *increment* to the process's "niceness".  Return the new niceness.
     1989
    16891990   Availability: Unix.
    16901991
     
    16931994
    16941995   Lock program segments into memory.  The value of *op* (defined in
    1695    ``<sys/lock.h>``) determines which segments are locked. Availability: Unix.
     1996   ``<sys/lock.h>``) determines which segments are locked.
     1997
     1998   Availability: Unix.
    16961999
    16972000
     
    17282031   be used with the :func:`waitpid` function.
    17292032
    1730    The "l" and "v" variants of the :func:`spawn\*` functions differ in how
     2033   The "l" and "v" variants of the :func:`spawn\* <spawnl>` functions differ in how
    17312034   command-line arguments are passed.  The "l" variants are perhaps the easiest
    17322035   to work with if the number of parameters is fixed when the code is written; the
     
    17402043   :func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the
    17412044   :envvar:`PATH` environment variable to locate the program *file*.  When the
    1742    environment is being replaced (using one of the :func:`spawn\*e` variants,
     2045   environment is being replaced (using one of the :func:`spawn\*e <spawnl>` variants,
    17432046   discussed in the next paragraph), the new environment is used as the source of
    17442047   the :envvar:`PATH` variable.  The other variants, :func:`spawnl`,
     
    17662069
    17672070   Availability: Unix, Windows.  :func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp`
    1768    and :func:`spawnvpe` are not available on Windows.
     2071   and :func:`spawnvpe` are not available on Windows.  :func:`spawnle` and
     2072   :func:`spawnve` are not thread-safe on Windows; we advise you to use the
     2073   :mod:`subprocess` module instead.
    17692074
    17702075   .. versionadded:: 1.6
     
    17742079          P_NOWAITO
    17752080
    1776    Possible values for the *mode* parameter to the :func:`spawn\*` family of
     2081   Possible values for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
    17772082   functions.  If either of these values is given, the :func:`spawn\*` functions
    17782083   will return as soon as the new process has been created, with the process id as
    1779    the return value. Availability: Unix, Windows.
     2084   the return value.
     2085
     2086   Availability: Unix, Windows.
    17802087
    17812088   .. versionadded:: 1.6
     
    17842091.. data:: P_WAIT
    17852092
    1786    Possible value for the *mode* parameter to the :func:`spawn\*` family of
     2093   Possible value for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
    17872094   functions.  If this is given as *mode*, the :func:`spawn\*` functions will not
    17882095   return until the new process has run to completion and will return the exit code
    17892096   of the process the run is successful, or ``-signal`` if a signal kills the
    1790    process. Availability: Unix, Windows.
     2097   process.
     2098
     2099   Availability: Unix, Windows.
    17912100
    17922101   .. versionadded:: 1.6
     
    17962105          P_OVERLAY
    17972106
    1798    Possible values for the *mode* parameter to the :func:`spawn\*` family of
     2107   Possible values for the *mode* parameter to the :func:`spawn\* <spawnl>` family of
    17992108   functions.  These are less portable than those listed above. :const:`P_DETACH`
    18002109   is similar to :const:`P_NOWAIT`, but the new process is detached from the
    18012110   console of the calling process. If :const:`P_OVERLAY` is used, the current
    18022111   process will be replaced; the :func:`spawn\*` function will not return.
     2112
    18032113   Availability: Windows.
    18042114
     
    18242134   the application's exit status.  The *path* parameter is relative to the current
    18252135   directory.  If you want to use an absolute path, make sure the first character
    1826    is not a slash (``'/'``); the underlying Win32 :cfunc:`ShellExecute` function
     2136   is not a slash (``'/'``); the underlying Win32 :c:func:`ShellExecute` function
    18272137   doesn't work if it is.  Use the :func:`os.path.normpath` function to ensure that
    1828    the path is properly encoded for Win32. Availability: Windows.
     2138   the path is properly encoded for Win32.
     2139
     2140   Availability: Windows.
    18292141
    18302142   .. versionadded:: 2.0
     
    18372149
    18382150   Execute the command (a string) in a subshell.  This is implemented by calling
    1839    the Standard C function :cfunc:`system`, and has the same limitations.
     2151   the Standard C function :c:func:`system`, and has the same limitations.
    18402152   Changes to :data:`sys.stdin`, etc. are not reflected in the environment of the
    18412153   executed command.
     
    18432155   On Unix, the return value is the exit status of the process encoded in the
    18442156   format specified for :func:`wait`.  Note that POSIX does not specify the meaning
    1845    of the return value of the C :cfunc:`system` function, so the return value of
     2157   of the return value of the C :c:func:`system` function, so the return value of
    18462158   the Python function is system-dependent.
    18472159
     
    18532165   documentation.
    18542166
    1855    Availability: Unix, Windows.
    1856 
    18572167   The :mod:`subprocess` module provides more powerful facilities for spawning new
    18582168   processes and retrieving their results; using that module is preferable to using
    1859    this function.  Use the :mod:`subprocess` module.  Check especially the
    1860    :ref:`subprocess-replacements` section.
     2169   this function.  See the
     2170   :ref:`subprocess-replacements` section in the :mod:`subprocess` documentation
     2171   for some helpful recipes.
     2172
     2173   Availability: Unix, Windows.
    18612174
    18622175
    18632176.. function:: times()
    18642177
    1865    Return a 5-tuple of floating point numbers indicating accumulated (processor or
    1866    other) times, in seconds.  The items are: user time, system time, children's
    1867    user time, children's system time, and elapsed real time since a fixed point in
    1868    the past, in that order.  See the Unix manual page :manpage:`times(2)` or the
    1869    corresponding Windows Platform API documentation. Availability: Unix,
    1870    Windows.  On Windows, only the first two items are filled, the others are zero.
     2178   Return a 5-tuple of floating point numbers indicating accumulated (processor
     2179   or other) times, in seconds.  The items are: user time, system time,
     2180   children's user time, children's system time, and elapsed real time since a
     2181   fixed point in the past, in that order.  See the Unix manual page
     2182   :manpage:`times(2)` or the corresponding Windows Platform API documentation.
     2183   On Windows, only the first two items are filled, the others are zero.
     2184
     2185   Availability: Unix, Windows
    18712186
    18722187
     
    18772192   that killed the process, and whose high byte is the exit status (if the signal
    18782193   number is zero); the high bit of the low byte is set if a core file was
    1879    produced. Availability: Unix.
     2194   produced.
     2195
     2196   Availability: Unix.
    18802197
    18812198
     
    19042221   equal to ``0`` has no special meaning on Windows, and raises an exception. The
    19052222   value of integer *options* has no effect. *pid* can refer to any process whose
    1906    id is known, not necessarily a child process. The :func:`spawn` functions called
    1907    with :const:`P_NOWAIT` return suitable process handles.
    1908 
    1909 
    1910 .. function:: wait3([options])
     2223   id is known, not necessarily a child process. The :func:`spawn\* <spawnl>`
     2224   functions called with :const:`P_NOWAIT` return suitable process handles.
     2225
     2226
     2227.. function:: wait3(options)
    19112228
    19122229   Similar to :func:`waitpid`, except no process id argument is given and a
    19132230   3-element tuple containing the child's process id, exit status indication, and
    19142231   resource usage information is returned.  Refer to :mod:`resource`.\
    1915    :func:`getrusage` for details on resource usage information.  The option
    1916    argument is the same as that provided to :func:`waitpid` and :func:`wait4`.
     2232   :func:`~resource.getrusage` for details on resource usage information.  The
     2233   option argument is the same as that provided to :func:`waitpid` and
     2234   :func:`wait4`.
     2235
    19172236   Availability: Unix.
    19182237
     
    19242243   Similar to :func:`waitpid`, except a 3-element tuple, containing the child's
    19252244   process id, exit status indication, and resource usage information is returned.
    1926    Refer to :mod:`resource`.\ :func:`getrusage` for details on resource usage
    1927    information.  The arguments to :func:`wait4` are the same as those provided to
    1928    :func:`waitpid`. Availability: Unix.
     2245   Refer to :mod:`resource`.\ :func:`~resource.getrusage` for details on
     2246   resource usage information.  The arguments to :func:`wait4` are the same as
     2247   those provided to :func:`waitpid`.
     2248
     2249   Availability: Unix.
    19292250
    19302251   .. versionadded:: 2.5
     
    19352256   The option for :func:`waitpid` to return immediately if no child process status
    19362257   is available immediately. The function returns ``(0, 0)`` in this case.
     2258
    19372259   Availability: Unix.
    19382260
     
    19412263
    19422264   This option causes child processes to be reported if they have been continued
    1943    from a job control stop since their status was last reported. Availability: Some
    1944    Unix systems.
     2265   from a job control stop since their status was last reported.
     2266
     2267   Availability: Some Unix systems.
    19452268
    19462269   .. versionadded:: 2.3
     
    19502273
    19512274   This option causes child processes to be reported if they have been stopped but
    1952    their current state has not been reported since they were stopped. Availability:
    1953    Unix.
     2275   their current state has not been reported since they were stopped.
     2276
     2277   Availability: Unix.
    19542278
    19552279   .. versionadded:: 2.3
     
    19632287
    19642288   Return ``True`` if a core dump was generated for the process, otherwise
    1965    return ``False``. Availability: Unix.
     2289   return ``False``.
     2290
     2291   Availability: Unix.
    19662292
    19672293   .. versionadded:: 2.3
     
    19712297
    19722298   Return ``True`` if the process has been continued from a job control stop,
    1973    otherwise return ``False``. Availability: Unix.
     2299   otherwise return ``False``.
     2300
     2301   Availability: Unix.
    19742302
    19752303   .. versionadded:: 2.3
     
    19792307
    19802308   Return ``True`` if the process has been stopped, otherwise return
    1981    ``False``. Availability: Unix.
     2309   ``False``.
     2310
     2311   Availability: Unix.
    19822312
    19832313
     
    19852315
    19862316   Return ``True`` if the process exited due to a signal, otherwise return
    1987    ``False``. Availability: Unix.
     2317   ``False``.
     2318
     2319   Availability: Unix.
    19882320
    19892321
     
    19912323
    19922324   Return ``True`` if the process exited using the :manpage:`exit(2)` system call,
    1993    otherwise return ``False``. Availability: Unix.
     2325   otherwise return ``False``.
     2326
     2327   Availability: Unix.
    19942328
    19952329
     
    19982332   If ``WIFEXITED(status)`` is true, return the integer parameter to the
    19992333   :manpage:`exit(2)` system call.  Otherwise, the return value is meaningless.
     2334
    20002335   Availability: Unix.
    20012336
     
    20032338.. function:: WSTOPSIG(status)
    20042339
    2005    Return the signal which caused the process to stop. Availability: Unix.
     2340   Return the signal which caused the process to stop.
     2341
     2342   Availability: Unix.
    20062343
    20072344
    20082345.. function:: WTERMSIG(status)
    20092346
    2010    Return the signal which caused the process to exit. Availability: Unix.
     2347   Return the signal which caused the process to exit.
     2348
     2349   Availability: Unix.
    20112350
    20122351
     
    20252364   The names known to the host operating system are given as the keys of the
    20262365   ``confstr_names`` dictionary.  For configuration variables not included in that
    2027    mapping, passing an integer for *name* is also accepted. Availability:
    2028    Unix.
     2366   mapping, passing an integer for *name* is also accepted.
    20292367
    20302368   If the configuration value specified by *name* isn't defined, ``None`` is
     
    20362374   :const:`errno.EINVAL` for the error number.
    20372375
     2376   Availability: Unix
     2377
    20382378
    20392379.. data:: confstr_names
     
    20412381   Dictionary mapping names accepted by :func:`confstr` to the integer values
    20422382   defined for those names by the host operating system. This can be used to
    2043    determine the set of names known to the system. Availability: Unix.
     2383   determine the set of names known to the system.
     2384
     2385   Availability: Unix.
    20442386
    20452387
     
    20482390   Return the number of processes in the system run queue averaged over the last
    20492391   1, 5, and 15 minutes or raises :exc:`OSError` if the load average was
    2050    unobtainable.  Availability: Unix.
     2392   unobtainable.
     2393
     2394   Availability: Unix.
    20512395
    20522396   .. versionadded:: 2.3
     
    20592403   the *name* parameter for :func:`confstr` apply here as well; the dictionary that
    20602404   provides information on the known names is given by ``sysconf_names``.
     2405
    20612406   Availability: Unix.
    20622407
     
    20662411   Dictionary mapping names accepted by :func:`sysconf` to the integer values
    20672412   defined for those names by the host operating system. This can be used to
    2068    determine the set of names known to the system. Availability: Unix.
     2413   determine the set of names known to the system.
     2414
     2415   Availability: Unix.
    20692416
    20702417The following data values are used to support path manipulation operations.  These
     
    21222469.. data:: defpath
    21232470
    2124    The default search path used by :func:`exec\*p\*` and :func:`spawn\*p\*` if the
    2125    environment doesn't have a ``'PATH'`` key. Also available via :mod:`os.path`.
     2471   The default search path used by :func:`exec\*p\* <execl>` and
     2472   :func:`spawn\*p\* <spawnl>` if the environment doesn't have a ``'PATH'``
     2473   key. Also available via :mod:`os.path`.
    21262474
    21272475
     
    21372485.. data:: devnull
    21382486
    2139    The file path of the null device. For example: ``'/dev/null'`` for POSIX.
    2140    Also available via :mod:`os.path`.
     2487   The file path of the null device. For example: ``'/dev/null'`` for
     2488   POSIX, ``'nul'`` for Windows.  Also available via :mod:`os.path`.
    21412489
    21422490   .. versionadded:: 2.4
     
    21562504   returned data should be unpredictable enough for cryptographic applications,
    21572505   though its exact quality depends on the OS implementation.  On a UNIX-like
    2158    system this will query /dev/urandom, and on Windows it will use CryptGenRandom.
    2159    If a randomness source is not found, :exc:`NotImplementedError` will be raised.
     2506   system this will query ``/dev/urandom``, and on Windows it will use
     2507   ``CryptGenRandom()``.  If a randomness source is not found,
     2508   :exc:`NotImplementedError` will be raised.
     2509
     2510   For an easy-to-use interface to the random number generator
     2511   provided by your platform, please see :class:`random.SystemRandom`.
    21602512
    21612513   .. versionadded:: 2.4
    2162 
Note: See TracChangeset for help on using the changeset viewer.