Kaydet (Commit) d91203bc authored tarafından Benjamin Peterson's avatar Benjamin Peterson

Merged revisions 80897 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r80897 | benjamin.peterson | 2010-05-06 18:03:05 -0500 (Thu, 06 May 2010) | 13 lines

  Merged revisions 80894,80896 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r80894 | benjamin.peterson | 2010-05-06 17:33:46 -0500 (Thu, 06 May 2010) | 1 line

    Availability gets its own line
  ........
    r80896 | benjamin.peterson | 2010-05-06 17:49:28 -0500 (Thu, 06 May 2010) | 1 line

    ensure that availability information is on its own line at the end of the function docs
  ........
................
üst 861c0e51
...@@ -223,19 +223,24 @@ applications should use string objects to access all files. ...@@ -223,19 +223,24 @@ applications should use string objects to access all files.
Return a relative filepath to *path* either from the current directory or from Return a relative filepath to *path* either from the current directory or from
an optional *start* point. an optional *start* point.
*start* defaults to :attr:`os.curdir`. Availability: Windows, Unix. *start* defaults to :attr:`os.curdir`.
Availability: Windows, Unix.
.. function:: samefile(path1, path2) .. function:: samefile(path1, path2)
Return ``True`` if both pathname arguments refer to the same file or directory Return ``True`` if both pathname arguments refer to the same file or directory
(as indicated by device number and i-node number). Raise an exception if a (as indicated by device number and i-node number). Raise an exception if a
:func:`os.stat` call on either pathname fails. Availability: Unix. :func:`os.stat` call on either pathname fails.
Availability: Unix.
.. function:: sameopenfile(fp1, fp2) .. function:: sameopenfile(fp1, fp2)
Return ``True`` if the file descriptors *fp1* and *fp2* refer to the same file. Return ``True`` if the file descriptors *fp1* and *fp2* refer to the same file.
Availability: Unix. Availability: Unix.
...@@ -244,7 +249,9 @@ applications should use string objects to access all files. ...@@ -244,7 +249,9 @@ applications should use string objects to access all files.
Return ``True`` if the stat tuples *stat1* and *stat2* refer to the same file. Return ``True`` if the stat tuples *stat1* and *stat2* refer to the same file.
These structures may have been returned by :func:`fstat`, :func:`lstat`, or These structures may have been returned by :func:`fstat`, :func:`lstat`, or
:func:`stat`. This function implements the underlying comparison used by :func:`stat`. This function implements the underlying comparison used by
:func:`samefile` and :func:`sameopenfile`. Availability: Unix. :func:`samefile` and :func:`sameopenfile`.
Availability: Unix.
.. function:: split(path) .. function:: split(path)
...@@ -293,7 +300,9 @@ applications should use string objects to access all files. ...@@ -293,7 +300,9 @@ applications should use string objects to access all files.
Split the pathname *path* into a pair ``(unc, rest)`` so that *unc* is the UNC Split the pathname *path* into a pair ``(unc, rest)`` so that *unc* is the UNC
mount point (such as ``r'\\host\mount'``), if present, and *rest* the rest of mount point (such as ``r'\\host\mount'``), if present, and *rest* the rest of
the path (such as ``r'\path\file.ext'``). For paths containing drive letters, the path (such as ``r'\path\file.ext'``). For paths containing drive letters,
*unc* will always be the empty string. Availability: Windows. *unc* will always be the empty string.
Availability: Windows.
.. data:: supports_unicode_filenames .. data:: supports_unicode_filenames
......
...@@ -41,6 +41,9 @@ Notes on the availability of these functions: ...@@ -41,6 +41,9 @@ Notes on the availability of these functions:
* If not separately noted, all functions that claim "Availability: Unix" are * If not separately noted, all functions that claim "Availability: Unix" are
supported on Mac OS X, which builds on a Unix core. supported on Mac OS X, which builds on a Unix core.
.. Availability notes get their own line and occur at the end of the function
.. documentation.
.. note:: .. note::
All functions in this module raise :exc:`OSError` in the case of invalid or All functions in this module raise :exc:`OSError` in the case of invalid or
...@@ -139,33 +142,40 @@ process and user. ...@@ -139,33 +142,40 @@ process and user.
.. function:: ctermid() .. function:: ctermid()
Return the filename corresponding to the controlling terminal of the process. Return the filename corresponding to the controlling terminal of the process.
Availability: Unix. Availability: Unix.
.. function:: getegid() .. function:: getegid()
Return the effective group id of the current process. This corresponds to the Return the effective group id of the current process. This corresponds to the
"set id" bit on the file being executed in the current process. Availability: "set id" bit on the file being executed in the current process.
Unix.
Availability: Unix.
.. function:: geteuid() .. function:: geteuid()
.. index:: single: user; effective id .. index:: single: user; effective id
Return the current process's effective user id. Availability: Unix. Return the current process's effective user id.
Availability: Unix.
.. function:: getgid() .. function:: getgid()
.. index:: single: process; group .. index:: single: process; group
Return the real group id of the current process. Availability: Unix. Return the real group id of the current process.
Availability: Unix.
.. function:: getgroups() .. function:: getgroups()
Return list of supplemental group ids associated with the current process. Return list of supplemental group ids associated with the current process.
Availability: Unix. Availability: Unix.
...@@ -175,48 +185,60 @@ process and user. ...@@ -175,48 +185,60 @@ process and user.
process. For most purposes, it is more useful to use the environment variable process. For most purposes, it is more useful to use the environment variable
:envvar:`LOGNAME` to find out who the user is, or :envvar:`LOGNAME` to find out who the user is, or
``pwd.getpwuid(os.getuid())[0]`` to get the login name of the currently ``pwd.getpwuid(os.getuid())[0]`` to get the login name of the currently
effective user id. Availability: Unix. effective user id.
Availability: Unix.
.. function:: getpgid(pid) .. function:: getpgid(pid)
Return the process group id of the process with process id *pid*. If *pid* is 0, Return the process group id of the process with process id *pid*. If *pid* is 0,
the process group id of the current process is returned. Availability: Unix. the process group id of the current process is returned.
Availability: Unix.
.. function:: getpgrp() .. function:: getpgrp()
.. index:: single: process; group .. index:: single: process; group
Return the id of the current process group. Availability: Unix. Return the id of the current process group.
Availability: Unix.
.. function:: getpid() .. function:: getpid()
.. index:: single: process; id .. index:: single: process; id
Return the current process id. Availability: Unix, Windows. Return the current process id.
Availability: Unix, Windows.
.. function:: getppid() .. function:: getppid()
.. index:: single: process; id of parent .. index:: single: process; id of parent
Return the parent's process id. Availability: Unix. Return the parent's process id.
Availability: Unix.
.. function:: getuid() .. function:: getuid()
.. index:: single: user; id .. index:: single: user; id
Return the current process's user id. Availability: Unix. Return the current process's user id.
Availability: Unix.
.. function:: getenv(varname[, value]) .. function:: getenv(varname[, value])
Return the value of the environment variable *varname* if it exists, or *value* Return the value of the environment variable *varname* if it exists, or *value*
if it doesn't. *value* defaults to ``None``. Availability: most flavors of if it doesn't. *value* defaults to ``None``.
Unix, Windows.
Availability: most flavors of Unix, Windows.
.. function:: putenv(varname, value) .. function:: putenv(varname, value)
...@@ -225,8 +247,9 @@ process and user. ...@@ -225,8 +247,9 @@ process and user.
Set the environment variable named *varname* to the string *value*. Such Set the environment variable named *varname* to the string *value*. Such
changes to the environment affect subprocesses started with :func:`os.system`, changes to the environment affect subprocesses started with :func:`os.system`,
:func:`popen` or :func:`fork` and :func:`execv`. Availability: most flavors of :func:`popen` or :func:`fork` and :func:`execv`.
Unix, Windows.
Availability: most flavors of Unix, Windows.
.. note:: .. note::
...@@ -241,17 +264,23 @@ process and user. ...@@ -241,17 +264,23 @@ process and user.
.. function:: setegid(egid) .. function:: setegid(egid)
Set the current process's effective group id. Availability: Unix. Set the current process's effective group id.
Availability: Unix.
.. function:: seteuid(euid) .. function:: seteuid(euid)
Set the current process's effective user id. Availability: Unix. Set the current process's effective user id.
Availability: Unix.
.. function:: setgid(gid) .. function:: setgid(gid)
Set the current process' group id. Availability: Unix. Set the current process' group id.
Availability: Unix.
.. function:: setgroups(groups) .. function:: setgroups(groups)
...@@ -259,6 +288,7 @@ process and user. ...@@ -259,6 +288,7 @@ process and user.
Set the list of supplemental group ids associated with the current process to Set the list of supplemental group ids associated with the current process to
*groups*. *groups* must be a sequence, and each element must be an integer *groups*. *groups* must be a sequence, and each element must be an integer
identifying a group. This operation is typically available only to the superuser. identifying a group. This operation is typically available only to the superuser.
Availability: Unix. Availability: Unix.
...@@ -266,6 +296,7 @@ process and user. ...@@ -266,6 +296,7 @@ process and user.
Call the system call :cfunc:`setpgrp` or :cfunc:`setpgrp(0, 0)` depending on Call the system call :cfunc:`setpgrp` or :cfunc:`setpgrp(0, 0)` depending on
which version is implemented (if any). See the Unix manual for the semantics. which version is implemented (if any). See the Unix manual for the semantics.
Availability: Unix. Availability: Unix.
...@@ -273,28 +304,37 @@ process and user. ...@@ -273,28 +304,37 @@ process and user.
Call the system call :cfunc:`setpgid` to set the process group id of the Call the system call :cfunc:`setpgid` to set the process group id of the
process with id *pid* to the process group with id *pgrp*. See the Unix manual process with id *pid* to the process group with id *pgrp*. See the Unix manual
for the semantics. Availability: Unix. for the semantics.
Availability: Unix.
.. function:: setreuid(ruid, euid) .. function:: setreuid(ruid, euid)
Set the current process's real and effective user ids. Availability: Unix.
Set the current process's real and effective user ids.
Availability: Unix.
.. function:: setregid(rgid, egid) .. function:: setregid(rgid, egid)
Set the current process's real and effective group ids. Availability: Unix. Set the current process's real and effective group ids.
Availability: Unix.
.. function:: getsid(pid) .. function:: getsid(pid)
Call the system call :cfunc:`getsid`. See the Unix manual for the semantics. Call the system call :cfunc:`getsid`. See the Unix manual for the semantics.
Availability: Unix. Availability: Unix.
.. function:: setsid() .. function:: setsid()
Call the system call :cfunc:`setsid`. See the Unix manual for the semantics. Call the system call :cfunc:`setsid`. See the Unix manual for the semantics.
Availability: Unix. Availability: Unix.
...@@ -302,7 +342,9 @@ process and user. ...@@ -302,7 +342,9 @@ process and user.
.. index:: single: user; id, setting .. index:: single: user; id, setting
Set the current process's user id. Availability: Unix. Set the current process's user id.
Availability: Unix.
.. placed in this section since it relates to errno.... a little weak .. placed in this section since it relates to errno.... a little weak
...@@ -310,13 +352,16 @@ process and user. ...@@ -310,13 +352,16 @@ process and user.
Return the error message corresponding to the error code in *code*. Return the error message corresponding to the error code in *code*.
On platforms where :cfunc:`strerror` returns ``NULL`` when given an unknown On platforms where :cfunc:`strerror` returns ``NULL`` when given an unknown
error number, :exc:`ValueError` is raised. Availability: Unix, Windows. error number, :exc:`ValueError` is raised.
Availability: Unix, Windows.
.. function:: umask(mask) .. function:: umask(mask)
Set the current numeric umask and return the previous umask. Availability: Set the current numeric umask and return the previous umask.
Unix, Windows.
Availability: Unix, Windows.
.. function:: uname() .. function:: uname()
...@@ -330,8 +375,9 @@ process and user. ...@@ -330,8 +375,9 @@ process and user.
machine)``. Some systems truncate the nodename to 8 characters or to the machine)``. Some systems truncate the nodename to 8 characters or to the
leading component; a better way to get the hostname is leading component; a better way to get the hostname is
:func:`socket.gethostname` or even :func:`socket.gethostname` or even
``socket.gethostbyaddr(socket.gethostname())``. Availability: recent flavors of ``socket.gethostbyaddr(socket.gethostname())``.
Unix.
Availability: recent flavors of Unix.
.. function:: unsetenv(varname) .. function:: unsetenv(varname)
...@@ -340,13 +386,15 @@ process and user. ...@@ -340,13 +386,15 @@ process and user.
Unset (delete) the environment variable named *varname*. Such changes to the Unset (delete) the environment variable named *varname*. Such changes to the
environment affect subprocesses started with :func:`os.system`, :func:`popen` or environment affect subprocesses started with :func:`os.system`, :func:`popen` or
:func:`fork` and :func:`execv`. Availability: most flavors of Unix, Windows. :func:`fork` and :func:`execv`.
When :func:`unsetenv` is supported, deletion of items in ``os.environ`` is When :func:`unsetenv` is supported, deletion of items in ``os.environ`` is
automatically translated into a corresponding call to :func:`unsetenv`; however, automatically translated into a corresponding call to :func:`unsetenv`; however,
calls to :func:`unsetenv` don't update ``os.environ``, so it is actually calls to :func:`unsetenv` don't update ``os.environ``, so it is actually
preferable to delete items of ``os.environ``. preferable to delete items of ``os.environ``.
Availability: most flavors of Unix, Windows.
.. _os-newstreams: .. _os-newstreams:
...@@ -362,7 +410,7 @@ These functions create new file objects. (See also :func:`open`.) ...@@ -362,7 +410,7 @@ These functions create new file objects. (See also :func:`open`.)
Return an open file object connected to the file descriptor *fd*. The *mode* Return an open file object connected to the file descriptor *fd*. The *mode*
and *bufsize* arguments have the same meaning as the corresponding arguments to and *bufsize* arguments have the same meaning as the corresponding arguments to
the built-in :func:`open` function. Availability: Unix, Windows. the built-in :func:`open` function.
When specified, the *mode* argument must start with one of the letters When specified, the *mode* argument must start with one of the letters
``'r'``, ``'w'``, or ``'a'``, otherwise a :exc:`ValueError` is raised. ``'r'``, ``'w'``, or ``'a'``, otherwise a :exc:`ValueError` is raised.
...@@ -371,6 +419,8 @@ These functions create new file objects. (See also :func:`open`.) ...@@ -371,6 +419,8 @@ These functions create new file objects. (See also :func:`open`.)
set on the file descriptor (which the :cfunc:`fdopen` implementation already set on the file descriptor (which the :cfunc:`fdopen` implementation already
does on most platforms). does on most platforms).
Availability: Unix, Windows.
.. _os-fd-ops: .. _os-fd-ops:
...@@ -389,7 +439,9 @@ by file descriptors. ...@@ -389,7 +439,9 @@ by file descriptors.
.. function:: close(fd) .. function:: close(fd)
Close file descriptor *fd*. Availability: Unix, Windows. Close file descriptor *fd*.
Availability: Unix, Windows.
.. note:: .. note::
...@@ -402,7 +454,7 @@ by file descriptors. ...@@ -402,7 +454,7 @@ by file descriptors.
.. function:: closerange(fd_low, fd_high) .. function:: closerange(fd_low, fd_high)
Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive), Close all file descriptors from *fd_low* (inclusive) to *fd_high* (exclusive),
ignoring errors. Availability: Unix, Windows. Equivalent to:: ignoring errors. Equivalent to::
for fd in range(fd_low, fd_high): for fd in range(fd_low, fd_high):
try: try:
...@@ -410,6 +462,8 @@ by file descriptors. ...@@ -410,6 +462,8 @@ by file descriptors.
except OSError: except OSError:
pass pass
Availability: Unix, Windows.
.. function:: device_encoding(fd) .. function:: device_encoding(fd)
...@@ -419,33 +473,40 @@ by file descriptors. ...@@ -419,33 +473,40 @@ by file descriptors.
.. function:: dup(fd) .. function:: dup(fd)
Return a duplicate of file descriptor *fd*. Availability: Unix, Return a duplicate of file descriptor *fd*.
Windows.
Availability: Unix, Windows.
.. function:: dup2(fd, fd2) .. function:: dup2(fd, fd2)
Duplicate file descriptor *fd* to *fd2*, closing the latter first if necessary. Duplicate file descriptor *fd* to *fd2*, closing the latter first if necessary.
Availability: Unix, Windows. Availability: Unix, Windows.
.. function:: fchmod(fd, mode) .. function:: fchmod(fd, mode)
Change the mode of the file given by *fd* to the numeric *mode*. See the docs Change the mode of the file given by *fd* to the numeric *mode*. See the docs
for :func:`chmod` for possible values of *mode*. Availability: Unix. for :func:`chmod` for possible values of *mode*.
Availability: Unix.
.. function:: fchown(fd, uid, gid) .. function:: fchown(fd, uid, gid)
Change the owner and group id of the file given by *fd* to the numeric *uid* Change the owner and group id of the file given by *fd* to the numeric *uid*
and *gid*. To leave one of the ids unchanged, set it to -1. and *gid*. To leave one of the ids unchanged, set it to -1.
Availability: Unix. Availability: Unix.
.. function:: fdatasync(fd) .. function:: fdatasync(fd)
Force write of file with filedescriptor *fd* to disk. Does not force update of Force write of file with filedescriptor *fd* to disk. Does not force update of
metadata. Availability: Unix. metadata.
Availability: Unix.
.. note:: .. note::
This function is not available on MacOS. This function is not available on MacOS.
...@@ -460,24 +521,28 @@ by file descriptors. ...@@ -460,24 +521,28 @@ by file descriptors.
additional names as well. The names known to the host operating system are additional names as well. The names known to the host operating system are
given in the ``pathconf_names`` dictionary. For configuration variables not given in the ``pathconf_names`` dictionary. For configuration variables not
included in that mapping, passing an integer for *name* is also accepted. included in that mapping, passing an integer for *name* is also accepted.
Availability: Unix.
If *name* is a string and is not known, :exc:`ValueError` is raised. If a If *name* is a string and is not known, :exc:`ValueError` is raised. If a
specific value for *name* is not supported by the host system, even if it is specific value for *name* is not supported by the host system, even if it is
included in ``pathconf_names``, an :exc:`OSError` is raised with included in ``pathconf_names``, an :exc:`OSError` is raised with
:const:`errno.EINVAL` for the error number. :const:`errno.EINVAL` for the error number.
Availability: Unix.
.. function:: fstat(fd) .. function:: fstat(fd)
Return status for file descriptor *fd*, like :func:`stat`. Availability: Return status for file descriptor *fd*, like :func:`stat`.
Unix, Windows.
Availability: Unix, Windows.
.. function:: fstatvfs(fd) .. function:: fstatvfs(fd)
Return information about the filesystem containing the file associated with file Return information about the filesystem containing the file associated with file
descriptor *fd*, like :func:`statvfs`. Availability: Unix. descriptor *fd*, like :func:`statvfs`.
Availability: Unix.
.. function:: fsync(fd) .. function:: fsync(fd)
...@@ -487,19 +552,25 @@ by file descriptors. ...@@ -487,19 +552,25 @@ by file descriptors.
If you're starting with a Python file object *f*, first do ``f.flush()``, and If you're starting with a Python file object *f*, first do ``f.flush()``, and
then do ``os.fsync(f.fileno())``, to ensure that all internal buffers associated then do ``os.fsync(f.fileno())``, to ensure that all internal buffers associated
with *f* are written to disk. Availability: Unix, Windows. with *f* are written to disk.
Availability: Unix, and Windows.
.. function:: ftruncate(fd, length) .. function:: ftruncate(fd, length)
Truncate the file corresponding to file descriptor *fd*, so that it is at most Truncate the file corresponding to file descriptor *fd*, so that it is at most
*length* bytes in size. Availability: Unix. *length* bytes in size.
Availability: Unix.
.. function:: isatty(fd) .. function:: isatty(fd)
Return ``True`` if the file descriptor *fd* is open and connected to a Return ``True`` if the file descriptor *fd* is open and connected to a
tty(-like) device, else ``False``. Availability: Unix. tty(-like) device, else ``False``.
Availability: Unix.
.. function:: lseek(fd, pos, how) .. function:: lseek(fd, pos, how)
...@@ -508,7 +579,9 @@ by file descriptors. ...@@ -508,7 +579,9 @@ by file descriptors.
by *how*: :const:`SEEK_SET` or ``0`` to set the position relative to the by *how*: :const:`SEEK_SET` or ``0`` to set the position relative to the
beginning of the file; :const:`SEEK_CUR` or ``1`` to set it relative to the beginning of the file; :const:`SEEK_CUR` or ``1`` to set it relative to the
current position; :const:`os.SEEK_END` or ``2`` to set it relative to the end of current position; :const:`os.SEEK_END` or ``2`` to set it relative to the end of
the file. Availability: Unix, Windows. the file.
Availability: Unix, Windows.
.. function:: open(file, flags[, mode]) .. function:: open(file, flags[, mode])
...@@ -516,17 +589,19 @@ by file descriptors. ...@@ -516,17 +589,19 @@ by file descriptors.
Open the file *file* and set various flags according to *flags* and possibly Open the file *file* and set various flags according to *flags* and possibly
its mode according to *mode*. The default *mode* is ``0o777`` (octal), and its mode according to *mode*. The default *mode* is ``0o777`` (octal), and
the current umask value is first masked out. Return the file descriptor for the current umask value is first masked out. Return the file descriptor for
the newly opened file. Availability: Unix, Windows. the newly opened file.
For a description of the flag and mode values, see the C run-time documentation; For a description of the flag and mode values, see the C run-time documentation;
flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) are defined in flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) are defined in
this module too (see below). this module too (see below).
Availability: Unix, Windows.
.. note:: .. note::
This function is intended for low-level I/O. For normal usage, use the This function is intended for low-level I/O. For normal usage, use the
built-in function :func:`open`, which returns a "file object" with built-in function :func:`open`, which returns a "file object" with
:meth:`~file.read` and :meth:`~file.write` methods (and many more). To :meth:`~file.read` and :meth:`~file.wprite` methods (and many more). To
wrap a file descriptor in a "file object", use :func:`fdopen`. wrap a file descriptor in a "file object", use :func:`fdopen`.
...@@ -536,21 +611,26 @@ by file descriptors. ...@@ -536,21 +611,26 @@ by file descriptors.
Open a new pseudo-terminal pair. Return a pair of file descriptors ``(master, Open a new pseudo-terminal pair. Return a pair of file descriptors ``(master,
slave)`` for the pty and the tty, respectively. For a (slightly) more portable slave)`` for the pty and the tty, respectively. For a (slightly) more portable
approach, use the :mod:`pty` module. Availability: some flavors of approach, use the :mod:`pty` module.
Unix.
Availability: some flavors of Unix.
.. function:: pipe() .. function:: pipe()
Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for reading Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for reading
and writing, respectively. Availability: Unix, Windows. and writing, respectively.
Availability: Unix, Windows.
.. function:: read(fd, n) .. function:: read(fd, n)
Read at most *n* bytes from file descriptor *fd*. Return a bytestring containing the Read at most *n* bytes from file descriptor *fd*. Return a bytestring containing the
bytes read. If the end of the file referred to by *fd* has been reached, an bytes read. If the end of the file referred to by *fd* has been reached, an
empty bytes object is returned. Availability: Unix, Windows. empty bytes object is returned.
Availability: Unix, Windows.
.. note:: .. note::
...@@ -564,26 +644,34 @@ by file descriptors. ...@@ -564,26 +644,34 @@ by file descriptors.
.. function:: tcgetpgrp(fd) .. function:: tcgetpgrp(fd)
Return the process group associated with the terminal given by *fd* (an open Return the process group associated with the terminal given by *fd* (an open
file descriptor as returned by :func:`os.open`). Availability: Unix. file descriptor as returned by :func:`os.open`).
Availability: Unix.
.. function:: tcsetpgrp(fd, pg) .. function:: tcsetpgrp(fd, pg)
Set the process group associated with the terminal given by *fd* (an open file Set the process group associated with the terminal given by *fd* (an open file
descriptor as returned by :func:`os.open`) to *pg*. Availability: Unix. descriptor as returned by :func:`os.open`) to *pg*.
Availability: Unix.
.. function:: ttyname(fd) .. function:: ttyname(fd)
Return a string which specifies the terminal device associated with Return a string which specifies the terminal device associated with
file descriptor *fd*. If *fd* is not associated with a terminal device, an file descriptor *fd*. If *fd* is not associated with a terminal device, an
exception is raised. Availability: Unix. exception is raised.
Availability: Unix.
.. function:: write(fd, str) .. function:: write(fd, str)
Write the bytestring in *str* to file descriptor *fd*. Return the number of Write the bytestring in *str* to file descriptor *fd*. Return the number of
bytes actually written. Availability: Unix, Windows. bytes actually written.
Availability: Unix, Windows.
.. note:: .. note::
...@@ -666,7 +754,9 @@ Files and Directories ...@@ -666,7 +754,9 @@ Files and Directories
can be the inclusive OR of one or more of :const:`R_OK`, :const:`W_OK`, and can be the inclusive OR of one or more of :const:`R_OK`, :const:`W_OK`, and
:const:`X_OK` to test permissions. Return :const:`True` if access is allowed, :const:`X_OK` to test permissions. Return :const:`True` if access is allowed,
:const:`False` if not. See the Unix man page :manpage:`access(2)` for more :const:`False` if not. See the Unix man page :manpage:`access(2)` for more
information. Availability: Unix, Windows. information.
Availability: Unix, Windows.
.. note:: .. note::
...@@ -710,25 +800,31 @@ Files and Directories ...@@ -710,25 +800,31 @@ Files and Directories
.. index:: single: directory; changing .. index:: single: directory; changing
Change the current working directory to *path*. Availability: Unix, Change the current working directory to *path*.
Windows.
Availability: Unix, Windows.
.. function:: fchdir(fd) .. function:: fchdir(fd)
Change the current working directory to the directory represented by the file Change the current working directory to the directory represented by the file
descriptor *fd*. The descriptor must refer to an opened directory, not an open descriptor *fd*. The descriptor must refer to an opened directory, not an open
file. Availability: Unix. file.
Availability: Unix.
.. function:: getcwd() .. function:: getcwd()
Return a string representing the current working directory. Return a string representing the current working directory.
Availability: Unix, Windows. Availability: Unix, Windows.
.. function:: getcwdb() .. function:: getcwdb()
Return a bytestring representing the current working directory. Return a bytestring representing the current working directory.
Availability: Unix, Windows. Availability: Unix, Windows.
...@@ -796,32 +892,41 @@ Files and Directories ...@@ -796,32 +892,41 @@ Files and Directories
.. function:: chown(path, uid, gid) .. function:: chown(path, uid, gid)
Change the owner and group id of *path* to the numeric *uid* and *gid*. To leave Change the owner and group id of *path* to the numeric *uid* and *gid*. To leave
one of the ids unchanged, set it to -1. Availability: Unix. one of the ids unchanged, set it to -1.
Availability: Unix.
.. function:: lchflags(path, flags) .. function:: lchflags(path, flags)
Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do not Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do not
follow symbolic links. Availability: Unix. follow symbolic links.
Availability: Unix.
.. function:: lchmod(path, mode) .. function:: lchmod(path, mode)
Change the mode of *path* to the numeric *mode*. If path is a symlink, this Change the mode of *path* to the numeric *mode*. If path is a symlink, this
affects the symlink rather than the target. See the docs for :func:`chmod` affects the symlink rather than the target. See the docs for :func:`chmod`
for possible values of *mode*. Availability: Unix. for possible values of *mode*.
Availability: Unix.
.. function:: lchown(path, uid, gid) .. function:: lchown(path, uid, gid)
Change the owner and group id of *path* to the numeric *uid* and *gid*. This Change the owner and group id of *path* to the numeric *uid* and *gid*. This
function will not follow symbolic links. Availability: Unix. function will not follow symbolic links.
Availability: Unix.
.. function:: link(source, link_name) .. function:: link(source, link_name)
Create a hard link pointing to *source* named *link_name*. Availability: Create a hard link pointing to *source* named *link_name*.
Unix.
Availability: Unix.
.. function:: listdir(path) .. function:: listdir(path)
...@@ -829,11 +934,12 @@ Files and Directories ...@@ -829,11 +934,12 @@ Files and Directories
Return a list containing the names of the entries in the directory given by Return a list containing the names of the entries in the directory given by
*path*. The list is in arbitrary order. It does not include the special *path*. The list is in arbitrary order. It does not include the special
entries ``'.'`` and ``'..'`` even if they are present in the directory. entries ``'.'`` and ``'..'`` even if they are present in the directory.
Availability: Unix, Windows.
This function can be called with a bytes or string argument, and returns This function can be called with a bytes or string argument, and returns
filenames of the same datatype. filenames of the same datatype.
Availability: Unix, Windows.
.. function:: lstat(path) .. function:: lstat(path)
...@@ -846,7 +952,7 @@ Files and Directories ...@@ -846,7 +952,7 @@ Files and Directories
Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The
default *mode* is ``0o666`` (octal). The current umask value is first masked default *mode* is ``0o666`` (octal). The current umask value is first masked
out from the mode. Availability: Unix. out from the mode.
FIFOs are pipes that can be accessed like regular files. FIFOs exist until they FIFOs are pipes that can be accessed like regular files. FIFOs exist until they
are deleted (for example with :func:`os.unlink`). Generally, FIFOs are used as are deleted (for example with :func:`os.unlink`). Generally, FIFOs are used as
...@@ -854,6 +960,8 @@ Files and Directories ...@@ -854,6 +960,8 @@ Files and Directories
FIFO for reading, and the client opens it for writing. Note that :func:`mkfifo` FIFO for reading, and the client opens it for writing. Note that :func:`mkfifo`
doesn't open the FIFO --- it just creates the rendezvous point. doesn't open the FIFO --- it just creates the rendezvous point.
Availability: Unix.
.. function:: mknod(filename[, mode=0o600, device]) .. function:: mknod(filename[, mode=0o600, device])
...@@ -888,11 +996,13 @@ Files and Directories ...@@ -888,11 +996,13 @@ Files and Directories
Create a directory named *path* with numeric mode *mode*. The default *mode* Create a directory named *path* with numeric mode *mode*. The default *mode*
is ``0o777`` (octal). On some systems, *mode* is ignored. Where it is used, is ``0o777`` (octal). On some systems, *mode* is ignored. Where it is used,
the current umask value is first masked out. Availability: Unix, Windows. the current umask value is first masked out.
It is also possible to create temporary directories; see the It is also possible to create temporary directories; see the
:mod:`tempfile` module's :func:`tempfile.mkdtemp` function. :mod:`tempfile` module's :func:`tempfile.mkdtemp` function.
Availability: Unix, Windows.
.. function:: makedirs(path[, mode]) .. function:: makedirs(path[, mode])
...@@ -923,13 +1033,14 @@ Files and Directories ...@@ -923,13 +1033,14 @@ Files and Directories
additional names as well. The names known to the host operating system are additional names as well. The names known to the host operating system are
given in the ``pathconf_names`` dictionary. For configuration variables not given in the ``pathconf_names`` dictionary. For configuration variables not
included in that mapping, passing an integer for *name* is also accepted. included in that mapping, passing an integer for *name* is also accepted.
Availability: Unix.
If *name* is a string and is not known, :exc:`ValueError` is raised. If a If *name* is a string and is not known, :exc:`ValueError` is raised. If a
specific value for *name* is not supported by the host system, even if it is specific value for *name* is not supported by the host system, even if it is
included in ``pathconf_names``, an :exc:`OSError` is raised with included in ``pathconf_names``, an :exc:`OSError` is raised with
:const:`errno.EINVAL` for the error number. :const:`errno.EINVAL` for the error number.
Availability: Unix.
.. data:: pathconf_names .. data:: pathconf_names
...@@ -960,8 +1071,9 @@ Files and Directories ...@@ -960,8 +1071,9 @@ Files and Directories
the :func:`unlink` function documented below. On Windows, attempting to the :func:`unlink` function documented below. On Windows, attempting to
remove a file that is in use causes an exception to be raised; on Unix, the remove a file that is in use causes an exception to be raised; on Unix, the
directory entry is removed but the storage allocated to the file is not made directory entry is removed but the storage allocated to the file is not made
available until the original file is no longer in use. Availability: Unix, available until the original file is no longer in use.
Windows.
Availability: Unix, Windows.
.. function:: removedirs(path) .. function:: removedirs(path)
...@@ -987,7 +1099,9 @@ Files and Directories ...@@ -987,7 +1099,9 @@ Files and Directories
the renaming will be an atomic operation (this is a POSIX requirement). On the renaming will be an atomic operation (this is a POSIX requirement). On
Windows, if *dst* already exists, :exc:`OSError` will be raised even if it is a Windows, if *dst* already exists, :exc:`OSError` will be raised even if it is a
file; there may be no way to implement an atomic rename when *dst* names an file; there may be no way to implement an atomic rename when *dst* names an
existing file. Availability: Unix, Windows. existing file.
Availability: Unix, Windows.
.. function:: renames(old, new) .. function:: renames(old, new)
...@@ -1007,8 +1121,9 @@ Files and Directories ...@@ -1007,8 +1121,9 @@ Files and Directories
Remove (delete) the directory *path*. Only works when the directory is Remove (delete) the directory *path*. Only works when the directory is
empty, otherwise, :exc:`OSError` is raised. In order to remove whole empty, otherwise, :exc:`OSError` is raised. In order to remove whole
directory trees, :func:`shutil.rmtree` can be used. Availability: Unix, directory trees, :func:`shutil.rmtree` can be used.
Windows.
Availability: Unix, Windows.
.. function:: stat(path) .. function:: stat(path)
...@@ -1099,20 +1214,25 @@ Files and Directories ...@@ -1099,20 +1214,25 @@ Files and Directories
correspond to the members of the :ctype:`statvfs` structure, namely: correspond to the members of the :ctype:`statvfs` structure, namely:
:attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`, :attr:`f_bsize`, :attr:`f_frsize`, :attr:`f_blocks`, :attr:`f_bfree`,
:attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`, :attr:`f_bavail`, :attr:`f_files`, :attr:`f_ffree`, :attr:`f_favail`,
:attr:`f_flag`, :attr:`f_namemax`. Availability: Unix. :attr:`f_flag`, :attr:`f_namemax`.
Availability: Unix.
.. function:: symlink(source, link_name) .. function:: symlink(source, link_name)
Create a symbolic link pointing to *source* named *link_name*. Availability: Create a symbolic link pointing to *source* named *link_name*.
Unix.
Availability: Unix.
.. function:: unlink(path) .. function:: unlink(path)
Remove (delete) the file *path*. This is the same function as Remove (delete) the file *path*. This is the same function as
:func:`remove`; the :func:`unlink` name is its traditional Unix :func:`remove`; the :func:`unlink` name is its traditional Unix
name. Availability: Unix, Windows. name.
Availability: Unix, Windows.
.. function:: utime(path, times) .. function:: utime(path, times)
...@@ -1236,6 +1356,7 @@ to be ignored. ...@@ -1236,6 +1356,7 @@ to be ignored.
behavior is to produce a core dump; on Windows, the process immediately returns behavior is to produce a core dump; on Windows, the process immediately returns
an exit code of ``3``. Be aware that programs which use :func:`signal.signal` an exit code of ``3``. Be aware that programs which use :func:`signal.signal`
to register a handler for :const:`SIGABRT` will behave differently. to register a handler for :const:`SIGABRT` will behave differently.
Availability: Unix, Windows. Availability: Unix, Windows.
...@@ -1291,7 +1412,9 @@ to be ignored. ...@@ -1291,7 +1412,9 @@ to be ignored.
.. function:: _exit(n) .. function:: _exit(n)
Exit to the system with status *n*, without calling cleanup handlers, flushing Exit to the system with status *n*, without calling cleanup handlers, flushing
stdio buffers, etc. Availability: Unix, Windows. stdio buffers, etc.
Availability: Unix, Windows.
.. note:: .. note::
...@@ -1311,69 +1434,88 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1311,69 +1434,88 @@ written in Python, such as a mail server's external command delivery program.
.. data:: EX_OK .. data:: EX_OK
Exit code that means no error occurred. Availability: Unix. Exit code that means no error occurred.
Availability: Unix.
.. data:: EX_USAGE .. data:: EX_USAGE
Exit code that means the command was used incorrectly, such as when the wrong Exit code that means the command was used incorrectly, such as when the wrong
number of arguments are given. Availability: Unix. number of arguments are given.
Availability: Unix.
.. data:: EX_DATAERR .. data:: EX_DATAERR
Exit code that means the input data was incorrect. Availability: Unix. Exit code that means the input data was incorrect.
Availability: Unix.
.. data:: EX_NOINPUT .. data:: EX_NOINPUT
Exit code that means an input file did not exist or was not readable. Exit code that means an input file did not exist or was not readable.
Availability: Unix. Availability: Unix.
.. data:: EX_NOUSER .. data:: EX_NOUSER
Exit code that means a specified user did not exist. Availability: Unix. Exit code that means a specified user did not exist.
Availability: Unix.
.. data:: EX_NOHOST .. data:: EX_NOHOST
Exit code that means a specified host did not exist. Availability: Unix. Exit code that means a specified host did not exist.
Availability: Unix.
.. data:: EX_UNAVAILABLE .. data:: EX_UNAVAILABLE
Exit code that means that a required service is unavailable. Availability: Exit code that means that a required service is unavailable.
Unix.
Availability: Unix.
.. data:: EX_SOFTWARE .. data:: EX_SOFTWARE
Exit code that means an internal software error was detected. Availability: Exit code that means an internal software error was detected.
Unix.
Availability: Unix.
.. data:: EX_OSERR .. data:: EX_OSERR
Exit code that means an operating system error was detected, such as the Exit code that means an operating system error was detected, such as the
inability to fork or create a pipe. Availability: Unix. inability to fork or create a pipe.
Availability: Unix.
.. data:: EX_OSFILE .. data:: EX_OSFILE
Exit code that means some system file did not exist, could not be opened, or had Exit code that means some system file did not exist, could not be opened, or had
some other kind of error. Availability: Unix. some other kind of error.
Availability: Unix.
.. data:: EX_CANTCREAT .. data:: EX_CANTCREAT
Exit code that means a user specified output file could not be created. Exit code that means a user specified output file could not be created.
Availability: Unix. Availability: Unix.
.. data:: EX_IOERR .. data:: EX_IOERR
Exit code that means that an error occurred while doing I/O on some file. Exit code that means that an error occurred while doing I/O on some file.
Availability: Unix. Availability: Unix.
...@@ -1381,31 +1523,39 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1381,31 +1523,39 @@ written in Python, such as a mail server's external command delivery program.
Exit code that means a temporary failure occurred. This indicates something Exit code that means a temporary failure occurred. This indicates something
that may not really be an error, such as a network connection that couldn't be that may not really be an error, such as a network connection that couldn't be
made during a retryable operation. Availability: Unix. made during a retryable operation.
Availability: Unix.
.. data:: EX_PROTOCOL .. data:: EX_PROTOCOL
Exit code that means that a protocol exchange was illegal, invalid, or not Exit code that means that a protocol exchange was illegal, invalid, or not
understood. Availability: Unix. understood.
Availability: Unix.
.. data:: EX_NOPERM .. data:: EX_NOPERM
Exit code that means that there were insufficient permissions to perform the Exit code that means that there were insufficient permissions to perform the
operation (but not intended for file system problems). Availability: Unix. operation (but not intended for file system problems).
Availability: Unix.
.. data:: EX_CONFIG .. data:: EX_CONFIG
Exit code that means that some kind of configuration error occurred. Exit code that means that some kind of configuration error occurred.
Availability: Unix. Availability: Unix.
.. data:: EX_NOTFOUND .. data:: EX_NOTFOUND
Exit code that means something like "an entry was not found". Availability: Exit code that means something like "an entry was not found".
Unix.
Availability: Unix.
.. function:: fork() .. function:: fork()
...@@ -1426,6 +1576,7 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1426,6 +1576,7 @@ written in Python, such as a mail server's external command delivery program.
new child's process id in the parent, and *fd* is the file descriptor of the new child's process id in the parent, and *fd* is the file descriptor of the
master end of the pseudo-terminal. For a more portable approach, use the master end of the pseudo-terminal. For a more portable approach, use the
:mod:`pty` module. If an error occurs :exc:`OSError` is raised. :mod:`pty` module. If an error occurs :exc:`OSError` is raised.
Availability: some flavors of Unix. Availability: some flavors of Unix.
...@@ -1446,19 +1597,24 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1446,19 +1597,24 @@ written in Python, such as a mail server's external command delivery program.
single: process; killing single: process; killing
single: process; signalling single: process; signalling
Send the signal *sig* to the process group *pgid*. Availability: Unix. Send the signal *sig* to the process group *pgid*.
Availability: Unix.
.. function:: nice(increment) .. function:: nice(increment)
Add *increment* to the process's "niceness". Return the new niceness. Add *increment* to the process's "niceness". Return the new niceness.
Availability: Unix. Availability: Unix.
.. function:: plock(op) .. function:: plock(op)
Lock program segments into memory. The value of *op* (defined in Lock program segments into memory. The value of *op* (defined in
``<sys/lock.h>``) determines which segments are locked. Availability: Unix. ``<sys/lock.h>``) determines which segments are locked.
Availability: Unix.
.. function:: popen(...) .. function:: popen(...)
...@@ -1537,7 +1693,9 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1537,7 +1693,9 @@ written in Python, such as a mail server's external command delivery program.
Possible values for the *mode* parameter to the :func:`spawn\*` family of Possible values for the *mode* parameter to the :func:`spawn\*` family of
functions. If either of these values is given, the :func:`spawn\*` functions functions. If either of these values is given, the :func:`spawn\*` functions
will return as soon as the new process has been created, with the process id as will return as soon as the new process has been created, with the process id as
the return value. Availability: Unix, Windows. the return value.
Availability: Unix, Windows.
.. data:: P_WAIT .. data:: P_WAIT
...@@ -1546,7 +1704,9 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1546,7 +1704,9 @@ written in Python, such as a mail server's external command delivery program.
functions. If this is given as *mode*, the :func:`spawn\*` functions will not functions. If this is given as *mode*, the :func:`spawn\*` functions will not
return until the new process has run to completion and will return the exit code return until the new process has run to completion and will return the exit code
of the process the run is successful, or ``-signal`` if a signal kills the of the process the run is successful, or ``-signal`` if a signal kills the
process. Availability: Unix, Windows. process.
Availability: Unix, Windows.
.. data:: P_DETACH .. data:: P_DETACH
...@@ -1557,6 +1717,7 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1557,6 +1717,7 @@ written in Python, such as a mail server's external command delivery program.
is similar to :const:`P_NOWAIT`, but the new process is detached from the is similar to :const:`P_NOWAIT`, but the new process is detached from the
console of the calling process. If :const:`P_OVERLAY` is used, the current console of the calling process. If :const:`P_OVERLAY` is used, the current
process will be replaced; the :func:`spawn\*` function will not return. process will be replaced; the :func:`spawn\*` function will not return.
Availability: Windows. Availability: Windows.
...@@ -1580,7 +1741,9 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1580,7 +1741,9 @@ written in Python, such as a mail server's external command delivery program.
directory. If you want to use an absolute path, make sure the first character directory. If you want to use an absolute path, make sure the first character
is not a slash (``'/'``); the underlying Win32 :cfunc:`ShellExecute` function is not a slash (``'/'``); the underlying Win32 :cfunc:`ShellExecute` function
doesn't work if it is. Use the :func:`os.path.normpath` function to ensure that doesn't work if it is. Use the :func:`os.path.normpath` function to ensure that
the path is properly encoded for Win32. Availability: Windows. the path is properly encoded for Win32.
Availability: Windows.
.. function:: system(command) .. function:: system(command)
...@@ -1602,22 +1765,24 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1602,22 +1765,24 @@ written in Python, such as a mail server's external command delivery program.
the command run; on systems using a non-native shell, consult your shell the command run; on systems using a non-native shell, consult your shell
documentation. documentation.
Availability: Unix, Windows.
The :mod:`subprocess` module provides more powerful facilities for spawning new The :mod:`subprocess` module provides more powerful facilities for spawning new
processes and retrieving their results; using that module is preferable to using processes and retrieving their results; using that module is preferable to using
this function. Use the :mod:`subprocess` module. Check especially the this function. Use the :mod:`subprocess` module. Check especially the
:ref:`subprocess-replacements` section. :ref:`subprocess-replacements` section.
Availability: Unix, Windows.
.. function:: times() .. function:: times()
Return a 5-tuple of floating point numbers indicating accumulated (processor or Return a 5-tuple of floating point numbers indicating accumulated (processor
other) times, in seconds. The items are: user time, system time, children's or other) times, in seconds. The items are: user time, system time,
user time, children's system time, and elapsed real time since a fixed point in children's user time, children's system time, and elapsed real time since a
the past, in that order. See the Unix manual page :manpage:`times(2)` or the fixed point in the past, in that order. See the Unix manual page
corresponding Windows Platform API documentation. Availability: Unix, :manpage:`times(2)` or the corresponding Windows Platform API documentation.
Windows. On Windows, only the first two items are filled, the others are zero. On Windows, only the first two items are filled, the others are zero.
Availability: Unix, Windows
.. function:: wait() .. function:: wait()
...@@ -1626,7 +1791,9 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1626,7 +1791,9 @@ written in Python, such as a mail server's external command delivery program.
and exit status indication: a 16-bit number, whose low byte is the signal number and exit status indication: a 16-bit number, whose low byte is the signal number
that killed the process, and whose high byte is the exit status (if the signal that killed the process, and whose high byte is the exit status (if the signal
number is zero); the high bit of the low byte is set if a core file was number is zero); the high bit of the low byte is set if a core file was
produced. Availability: Unix. produced.
Availability: Unix.
.. function:: waitpid(pid, options) .. function:: waitpid(pid, options)
...@@ -1664,6 +1831,7 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1664,6 +1831,7 @@ written in Python, such as a mail server's external command delivery program.
resource usage information is returned. Refer to :mod:`resource`.\ resource usage information is returned. Refer to :mod:`resource`.\
:func:`getrusage` for details on resource usage information. The option :func:`getrusage` for details on resource usage information. The option
argument is the same as that provided to :func:`waitpid` and :func:`wait4`. argument is the same as that provided to :func:`waitpid` and :func:`wait4`.
Availability: Unix. Availability: Unix.
...@@ -1673,28 +1841,33 @@ written in Python, such as a mail server's external command delivery program. ...@@ -1673,28 +1841,33 @@ written in Python, such as a mail server's external command delivery program.
process id, exit status indication, and resource usage information is returned. process id, exit status indication, and resource usage information is returned.
Refer to :mod:`resource`.\ :func:`getrusage` for details on resource usage Refer to :mod:`resource`.\ :func:`getrusage` for details on resource usage
information. The arguments to :func:`wait4` are the same as those provided to information. The arguments to :func:`wait4` are the same as those provided to
:func:`waitpid`. Availability: Unix. :func:`waitpid`.
Availability: Unix.
.. data:: WNOHANG .. data:: WNOHANG
The option for :func:`waitpid` to return immediately if no child process status The option for :func:`waitpid` to return immediately if no child process status
is available immediately. The function returns ``(0, 0)`` in this case. is available immediately. The function returns ``(0, 0)`` in this case.
Availability: Unix. Availability: Unix.
.. data:: WCONTINUED .. data:: WCONTINUED
This option causes child processes to be reported if they have been continued This option causes child processes to be reported if they have been continued
from a job control stop since their status was last reported. Availability: Some from a job control stop since their status was last reported.
Unix systems.
Availability: Some Unix systems.
.. data:: WUNTRACED .. data:: WUNTRACED
This option causes child processes to be reported if they have been stopped but This option causes child processes to be reported if they have been stopped but
their current state has not been reported since they were stopped. Availability: their current state has not been reported since they were stopped.
Unix.
Availability: Unix.
The following functions take a process status code as returned by The following functions take a process status code as returned by
...@@ -1704,48 +1877,63 @@ used to determine the disposition of a process. ...@@ -1704,48 +1877,63 @@ used to determine the disposition of a process.
.. function:: WCOREDUMP(status) .. function:: WCOREDUMP(status)
Return ``True`` if a core dump was generated for the process, otherwise Return ``True`` if a core dump was generated for the process, otherwise
return ``False``. Availability: Unix. return ``False``.
Availability: Unix.
.. function:: WIFCONTINUED(status) .. function:: WIFCONTINUED(status)
Return ``True`` if the process has been continued from a job control stop, Return ``True`` if the process has been continued from a job control stop,
otherwise return ``False``. Availability: Unix. otherwise return ``False``.
Availability: Unix.
.. function:: WIFSTOPPED(status) .. function:: WIFSTOPPED(status)
Return ``True`` if the process has been stopped, otherwise return Return ``True`` if the process has been stopped, otherwise return
``False``. Availability: Unix. ``False``.
Availability: Unix.
.. function:: WIFSIGNALED(status) .. function:: WIFSIGNALED(status)
Return ``True`` if the process exited due to a signal, otherwise return Return ``True`` if the process exited due to a signal, otherwise return
``False``. Availability: Unix. ``False``.
Availability: Unix.
.. function:: WIFEXITED(status) .. function:: WIFEXITED(status)
Return ``True`` if the process exited using the :manpage:`exit(2)` system call, Return ``True`` if the process exited using the :manpage:`exit(2)` system call,
otherwise return ``False``. Availability: Unix. otherwise return ``False``.
Availability: Unix.
.. function:: WEXITSTATUS(status) .. function:: WEXITSTATUS(status)
If ``WIFEXITED(status)`` is true, return the integer parameter to the If ``WIFEXITED(status)`` is true, return the integer parameter to the
:manpage:`exit(2)` system call. Otherwise, the return value is meaningless. :manpage:`exit(2)` system call. Otherwise, the return value is meaningless.
Availability: Unix. Availability: Unix.
.. function:: WSTOPSIG(status) .. function:: WSTOPSIG(status)
Return the signal which caused the process to stop. Availability: Unix. Return the signal which caused the process to stop.
Availability: Unix.
.. function:: WTERMSIG(status) .. function:: WTERMSIG(status)
Return the signal which caused the process to exit. Availability: Unix. Return the signal which caused the process to exit.
Availability: Unix.
.. _os-path: .. _os-path:
...@@ -1762,8 +1950,7 @@ Miscellaneous System Information ...@@ -1762,8 +1950,7 @@ Miscellaneous System Information
Unix 95, Unix 98, and others). Some platforms define additional names as well. Unix 95, Unix 98, and others). Some platforms define additional names as well.
The names known to the host operating system are given as the keys of the The names known to the host operating system are given as the keys of the
``confstr_names`` dictionary. For configuration variables not included in that ``confstr_names`` dictionary. For configuration variables not included in that
mapping, passing an integer for *name* is also accepted. Availability: mapping, passing an integer for *name* is also accepted.
Unix.
If the configuration value specified by *name* isn't defined, ``None`` is If the configuration value specified by *name* isn't defined, ``None`` is
returned. returned.
...@@ -1773,19 +1960,25 @@ Miscellaneous System Information ...@@ -1773,19 +1960,25 @@ Miscellaneous System Information
included in ``confstr_names``, an :exc:`OSError` is raised with included in ``confstr_names``, an :exc:`OSError` is raised with
:const:`errno.EINVAL` for the error number. :const:`errno.EINVAL` for the error number.
Availability: Unix
.. data:: confstr_names .. data:: confstr_names
Dictionary mapping names accepted by :func:`confstr` to the integer values Dictionary mapping names accepted by :func:`confstr` to the integer values
defined for those names by the host operating system. This can be used to defined for those names by the host operating system. This can be used to
determine the set of names known to the system. Availability: Unix. determine the set of names known to the system.
Availability: Unix.
.. function:: getloadavg() .. function:: getloadavg()
Return the number of processes in the system run queue averaged over the last Return the number of processes in the system run queue averaged over the last
1, 5, and 15 minutes or raises :exc:`OSError` if the load average was 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was
unobtainable. Availability: Unix. unobtainable.
Availability: Unix.
.. function:: sysconf(name) .. function:: sysconf(name)
...@@ -1794,6 +1987,7 @@ Miscellaneous System Information ...@@ -1794,6 +1987,7 @@ Miscellaneous System Information
specified by *name* isn't defined, ``-1`` is returned. The comments regarding specified by *name* isn't defined, ``-1`` is returned. The comments regarding
the *name* parameter for :func:`confstr` apply here as well; the dictionary that the *name* parameter for :func:`confstr` apply here as well; the dictionary that
provides information on the known names is given by ``sysconf_names``. provides information on the known names is given by ``sysconf_names``.
Availability: Unix. Availability: Unix.
...@@ -1801,7 +1995,9 @@ Miscellaneous System Information ...@@ -1801,7 +1995,9 @@ Miscellaneous System Information
Dictionary mapping names accepted by :func:`sysconf` to the integer values Dictionary mapping names accepted by :func:`sysconf` to the integer values
defined for those names by the host operating system. This can be used to defined for those names by the host operating system. This can be used to
determine the set of names known to the system. Availability: Unix. determine the set of names known to the system.
Availability: Unix.
The following data values are used to support path manipulation operations. These The following data values are used to support path manipulation operations. These
are defined for all platforms. are defined for all platforms.
......
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