annotate Doc/lib/libos.tex @ 27998:e27f58a50737 legacy-trunk

SF bug #690377: Dud footnote reference in distutils docs
author Raymond Hettinger <python@rcn.com>
date Fri, 21 Feb 2003 02:47:09 +0000
parents cf1efca82b18
children 12d4df71bdaa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8850
diff changeset
1 \section{\module{os} ---
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
2 Miscellaneous operating system interfaces}
10659
69fb81facb03 Small markup nits.
Fred Drake <fdrake@acm.org>
parents: 10346
diff changeset
3
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8597
diff changeset
4 \declaremodule{standard}{os}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
5 \modulesynopsis{Miscellaneous operating system interfaces.}
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8597
diff changeset
6
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
7
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 This module provides a more portable way of using operating system
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
9 dependent functionality than importing a operating system dependent
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
10 built-in module like \refmodule{posix} or \module{nt}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
11
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
12 This module searches for an operating system dependent built-in module like
10977
0f2292f57a83 Added 'ce' to the list of "registered" values for os.name.
Fred Drake <fdrake@acm.org>
parents: 10957
diff changeset
13 \module{mac} or \refmodule{posix} and exports the same functions and data
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
14 as found there. The design of all Python's built-in operating system dependent
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
15 modules is such that as long as the same functionality is available,
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
16 it uses the same interface; for example, the function
10659
69fb81facb03 Small markup nits.
Fred Drake <fdrake@acm.org>
parents: 10346
diff changeset
17 \code{os.stat(\var{path})} returns stat information about \var{path} in
69fb81facb03 Small markup nits.
Fred Drake <fdrake@acm.org>
parents: 10346
diff changeset
18 the same format (which happens to have originated with the
69fb81facb03 Small markup nits.
Fred Drake <fdrake@acm.org>
parents: 10346
diff changeset
19 \POSIX{} interface).
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
20
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
21 Extensions peculiar to a particular operating system are also
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
22 available through the \module{os} module, but using them is of course a
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
23 threat to portability!
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
24
7626
5aa7037a1e3f Logical markup. small nits.
Fred Drake <fdrake@acm.org>
parents: 7277
diff changeset
25 Note that after the first time \module{os} is imported, there is
5aa7037a1e3f Logical markup. small nits.
Fred Drake <fdrake@acm.org>
parents: 7277
diff changeset
26 \emph{no} performance penalty in using functions from \module{os}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
27 instead of directly from the operating system dependent built-in module,
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
28 so there should be \emph{no} reason not to use \module{os}!
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
29
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
30
11088
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
31 % Frank Stajano <fstajano@uk.research.att.com> complained that it
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
32 % wasn't clear that the entries described in the subsections were all
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
33 % available at the module level (most uses of subsections are
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
34 % different); I think this is only a problem for the HTML version,
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
35 % where the relationship may not be as clear.
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
36 %
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
37 \ifhtml
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
38 The \module{os} module contains many functions and data values.
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
39 The items below and in the following sub-sections are all available
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
40 directly from the \module{os} module.
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
41 \fi
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
42
4463dd7bb3e8 Per Frank Stajano's suggestion, state explicitly that the functions
Fred Drake <fdrake@acm.org>
parents: 11015
diff changeset
43
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
44 \begin{excdesc}{error}
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
45 This exception is raised when a function returns a system-related
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
46 error (not for illegal argument types or other incidental errors).
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
47 This is also known as the built-in exception \exception{OSError}. The
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
48 accompanying value is a pair containing the numeric error code from
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
49 \cdata{errno} and the corresponding string, as would be printed by the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
50 C function \cfunction{perror()}. See the module
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
51 \refmodule{errno}\refbimodindex{errno}, which contains names for the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
52 error codes defined by the underlying operating system.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
53
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
54 When exceptions are classes, this exception carries two attributes,
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
55 \member{errno} and \member{strerror}. The first holds the value of
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
56 the C \cdata{errno} variable, and the latter holds the corresponding
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
57 error message from \cfunction{strerror()}. For exceptions that
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
58 involve a file system path (such as \function{chdir()} or
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
59 \function{unlink()}), the exception instance will contain a third
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
60 attribute, \member{filename}, which is the file name passed to the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
61 function.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
62 \end{excdesc}
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
63
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
64 \begin{datadesc}{name}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
65 The name of the operating system dependent module imported. The
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
66 following names have currently been registered: \code{'posix'},
25709
1a9f47885260 Remove mentionings of DOS.
Martin v. Löwis <martin@v.loewis.de>
parents: 25694
diff changeset
67 \code{'nt'}, \code{'mac'}, \code{'os2'}, \code{'ce'},
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
68 \code{'java'}, \code{'riscos'}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
69 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
70
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
71 \begin{datadesc}{path}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
72 The corresponding operating system dependent standard module for pathname
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
73 operations, such as \module{posixpath} or \module{macpath}. Thus,
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
74 given the proper imports, \code{os.path.split(\var{file})} is
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
75 equivalent to but more portable than
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
76 \code{posixpath.split(\var{file})}. Note that this is also an
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
77 importable module: it may be imported directly as
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
78 \refmodule{os.path}.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
79 \end{datadesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
80
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
81
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
82
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
83 \subsection{Process Parameters \label{os-procinfo}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
84
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
85 These functions and data items provide information and operate on the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
86 current process and user.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
87
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
88 \begin{datadesc}{environ}
10789
767351f4944a Minor nits, partly in response to comments from Jonathan Black
Fred Drake <fdrake@acm.org>
parents: 10659
diff changeset
89 A mapping object representing the string environment. For example,
767351f4944a Minor nits, partly in response to comments from Jonathan Black
Fred Drake <fdrake@acm.org>
parents: 10659
diff changeset
90 \code{environ['HOME']} is the pathname of your home directory (on some
767351f4944a Minor nits, partly in response to comments from Jonathan Black
Fred Drake <fdrake@acm.org>
parents: 10659
diff changeset
91 platforms), and is equivalent to \code{getenv("HOME")} in C.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
92
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
93 If the platform supports the \function{putenv()} function, this
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
94 mapping may be used to modify the environment as well as query the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
95 environment. \function{putenv()} will be called automatically when
27745
c49638305a28 Fix SF bug #675259, os.environ leaks under FreeBSD and Mac OS X
Neal Norwitz <nnorwitz@gmail.com>
parents: 27642
diff changeset
96 the mapping is modified. \note{On some platforms, including
c49638305a28 Fix SF bug #675259, os.environ leaks under FreeBSD and Mac OS X
Neal Norwitz <nnorwitz@gmail.com>
parents: 27642
diff changeset
97 FreeBSD and Mac OS X, setting \code{environ} may cause memory leaks.
c49638305a28 Fix SF bug #675259, os.environ leaks under FreeBSD and Mac OS X
Neal Norwitz <nnorwitz@gmail.com>
parents: 27642
diff changeset
98 Refer to the system documentation for putenv.}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
99
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
100 If \function{putenv()} is not provided, this mapping may be passed to
21857
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
101 the appropriate process-creation functions to cause child processes to
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
102 use a modified environment.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
103 \end{datadesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
104
11122
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
105 \begin{funcdescni}{chdir}{path}
23058
8005fc1aef39 Be consistent in presenting the signatures.
Fred Drake <fdrake@acm.org>
parents: 23057
diff changeset
106 \funclineni{fchdir}{fd}
11122
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
107 \funclineni{getcwd}{}
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
108 These functions are described in ``Files and Directories'' (section
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
109 \ref{os-file-dir}).
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
110 \end{funcdescni}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
111
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
112 \begin{funcdesc}{ctermid}{}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
113 Return the filename corresponding to the controlling terminal of the
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
114 process.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
115 Availability: \UNIX.
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
116 \end{funcdesc}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
117
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
118 \begin{funcdesc}{getegid}{}
23291
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
119 Return the effective group id of the current process. This
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
120 corresponds to the `set id' bit on the file being executed in the
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
121 current process.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
122 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
123 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
124
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
125 \begin{funcdesc}{geteuid}{}
10878
b9ef424165d6 "proces" --> "process"; reported by Gerry Wiener <gerry@ucar.edu>.
Fred Drake <fdrake@acm.org>
parents: 10789
diff changeset
126 \index{user!effective id}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
127 Return the current process' effective user id.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
128 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
129 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
130
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
131 \begin{funcdesc}{getgid}{}
10878
b9ef424165d6 "proces" --> "process"; reported by Gerry Wiener <gerry@ucar.edu>.
Fred Drake <fdrake@acm.org>
parents: 10789
diff changeset
132 \index{process!group}
23291
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
133 Return the real group id of the current process.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
134 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
135 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
136
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
137 \begin{funcdesc}{getgroups}{}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
138 Return list of supplemental group ids associated with the current
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
139 process.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
140 Availability: \UNIX.
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
141 \end{funcdesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
142
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
143 \begin{funcdesc}{getlogin}{}
24371
40e0140181cf Flesh out description of getlogin() and recommend against using it.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 24094
diff changeset
144 Return the name of the user logged in on the controlling terminal of
40e0140181cf Flesh out description of getlogin() and recommend against using it.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 24094
diff changeset
145 the process. For most purposes, it is more useful to use the
27642
4d04f45ff8a1 Bug #678077: Suggest alternative to os.getlogin()
Andrew M. Kuchling <amk@amk.ca>
parents: 27144
diff changeset
146 environment variable \envvar{LOGNAME} to find out who the user is,
4d04f45ff8a1 Bug #678077: Suggest alternative to os.getlogin()
Andrew M. Kuchling <amk@amk.ca>
parents: 27144
diff changeset
147 or \code{pwd.getpwuid(os.getuid())[0]} to get the login name
4d04f45ff8a1 Bug #678077: Suggest alternative to os.getlogin()
Andrew M. Kuchling <amk@amk.ca>
parents: 27144
diff changeset
148 of the currently effective user ID.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
149 Availability: \UNIX.
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
150 \end{funcdesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
151
23833
9f0ad0eb61f0 Patch #568235: Add posix.setpgid.
Martin v. Löwis <martin@v.loewis.de>
parents: 23761
diff changeset
152 \begin{funcdesc}{getpgid}{pid}
9f0ad0eb61f0 Patch #568235: Add posix.setpgid.
Martin v. Löwis <martin@v.loewis.de>
parents: 23761
diff changeset
153 Return the process group id of the process with process id \var{pid}.
9f0ad0eb61f0 Patch #568235: Add posix.setpgid.
Martin v. Löwis <martin@v.loewis.de>
parents: 23761
diff changeset
154 If \var{pid} is 0, the process group id of the current process is
9f0ad0eb61f0 Patch #568235: Add posix.setpgid.
Martin v. Löwis <martin@v.loewis.de>
parents: 23761
diff changeset
155 returned. Availability: \UNIX.
23835
1cf1f9812219 Add "version added" for getpgid
Neal Norwitz <nnorwitz@gmail.com>
parents: 23833
diff changeset
156 \versionadded{2.3}
23833
9f0ad0eb61f0 Patch #568235: Add posix.setpgid.
Martin v. Löwis <martin@v.loewis.de>
parents: 23761
diff changeset
157 \end{funcdesc}
9f0ad0eb61f0 Patch #568235: Add posix.setpgid.
Martin v. Löwis <martin@v.loewis.de>
parents: 23761
diff changeset
158
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
159 \begin{funcdesc}{getpgrp}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
160 \index{process!group}
23291
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
161 Return the id of the current process group.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
162 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
163 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
164
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
165 \begin{funcdesc}{getpid}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
166 \index{process!id}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
167 Return the current process id.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
168 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
169 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
170
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
171 \begin{funcdesc}{getppid}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
172 \index{process!id of parent}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
173 Return the parent's process id.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
174 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
175 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
176
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
177 \begin{funcdesc}{getuid}{}
10878
b9ef424165d6 "proces" --> "process"; reported by Gerry Wiener <gerry@ucar.edu>.
Fred Drake <fdrake@acm.org>
parents: 10789
diff changeset
178 \index{user!id}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
179 Return the current process' user id.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
180 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
181 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
182
18012
582845e14e5c Document os.getenv().
Fred Drake <fdrake@acm.org>
parents: 17998
diff changeset
183 \begin{funcdesc}{getenv}{varname\optional{, value}}
582845e14e5c Document os.getenv().
Fred Drake <fdrake@acm.org>
parents: 17998
diff changeset
184 Return the value of the environment variable \var{varname} if it
582845e14e5c Document os.getenv().
Fred Drake <fdrake@acm.org>
parents: 17998
diff changeset
185 exists, or \var{value} if it doesn't. \var{value} defaults to
582845e14e5c Document os.getenv().
Fred Drake <fdrake@acm.org>
parents: 17998
diff changeset
186 \code{None}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
187 Availability: most flavors of \UNIX, Windows.
18012
582845e14e5c Document os.getenv().
Fred Drake <fdrake@acm.org>
parents: 17998
diff changeset
188 \end{funcdesc}
582845e14e5c Document os.getenv().
Fred Drake <fdrake@acm.org>
parents: 17998
diff changeset
189
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
190 \begin{funcdesc}{putenv}{varname, value}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
191 \index{environment variables!setting}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
192 Set the environment variable named \var{varname} to the string
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
193 \var{value}. Such changes to the environment affect subprocesses
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
194 started with \function{os.system()}, \function{popen()} or
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
195 \function{fork()} and \function{execv()}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
196 Availability: most flavors of \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
197
27745
c49638305a28 Fix SF bug #675259, os.environ leaks under FreeBSD and Mac OS X
Neal Norwitz <nnorwitz@gmail.com>
parents: 27642
diff changeset
198 \note{On some platforms, including FreeBSD and Mac OS X,
c49638305a28 Fix SF bug #675259, os.environ leaks under FreeBSD and Mac OS X
Neal Norwitz <nnorwitz@gmail.com>
parents: 27642
diff changeset
199 setting \code{environ} may cause memory leaks.
c49638305a28 Fix SF bug #675259, os.environ leaks under FreeBSD and Mac OS X
Neal Norwitz <nnorwitz@gmail.com>
parents: 27642
diff changeset
200 Refer to the system documentation for putenv.}
c49638305a28 Fix SF bug #675259, os.environ leaks under FreeBSD and Mac OS X
Neal Norwitz <nnorwitz@gmail.com>
parents: 27642
diff changeset
201
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
202 When \function{putenv()} is
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
203 supported, assignments to items in \code{os.environ} are automatically
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
204 translated into corresponding calls to \function{putenv()}; however,
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
205 calls to \function{putenv()} don't update \code{os.environ}, so it is
21857
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
206 actually preferable to assign to items of \code{os.environ}.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
207 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
208
13582
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
209 \begin{funcdesc}{setegid}{egid}
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
210 Set the current process's effective group id.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
211 Availability: \UNIX.
13582
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
212 \end{funcdesc}
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
213
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
214 \begin{funcdesc}{seteuid}{euid}
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
215 Set the current process's effective user id.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
216 Availability: \UNIX.
13582
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
217 \end{funcdesc}
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
218
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
219 \begin{funcdesc}{setgid}{gid}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
220 Set the current process' group id.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
221 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
222 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
223
20508
8e0c31849c64 Expose setgroups. Fixes feature request #468116.
Martin v. Löwis <martin@v.loewis.de>
parents: 20337
diff changeset
224 \begin{funcdesc}{setgroups}{groups}
20511
c13a473ce1b7 Elaborate on types and meaning of the setgroups arguments.
Martin v. Löwis <martin@v.loewis.de>
parents: 20508
diff changeset
225 Set the list of supplemental group ids associated with the current
c13a473ce1b7 Elaborate on types and meaning of the setgroups arguments.
Martin v. Löwis <martin@v.loewis.de>
parents: 20508
diff changeset
226 process to \var{groups}. \var{groups} must be a sequence, and each
c13a473ce1b7 Elaborate on types and meaning of the setgroups arguments.
Martin v. Löwis <martin@v.loewis.de>
parents: 20508
diff changeset
227 element must be an integer identifying a group. This operation is
c13a473ce1b7 Elaborate on types and meaning of the setgroups arguments.
Martin v. Löwis <martin@v.loewis.de>
parents: 20508
diff changeset
228 typical available only to the superuser.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
229 Availability: \UNIX.
20508
8e0c31849c64 Expose setgroups. Fixes feature request #468116.
Martin v. Löwis <martin@v.loewis.de>
parents: 20337
diff changeset
230 \versionadded{2.2}
8e0c31849c64 Expose setgroups. Fixes feature request #468116.
Martin v. Löwis <martin@v.loewis.de>
parents: 20337
diff changeset
231 \end{funcdesc}
8e0c31849c64 Expose setgroups. Fixes feature request #468116.
Martin v. Löwis <martin@v.loewis.de>
parents: 20337
diff changeset
232
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
233 \begin{funcdesc}{setpgrp}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
234 Calls the system call \cfunction{setpgrp()} or \cfunction{setpgrp(0,
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
235 0)} depending on which version is implemented (if any). See the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
236 \UNIX{} manual for the semantics.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
237 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
238 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
239
23291
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
240 \begin{funcdesc}{setpgid}{pid, pgrp} Calls the system call
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
241 \cfunction{setpgid()} to set the process group id of the process with
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
242 id \var{pid} to the process group with id \var{pgrp}. See the \UNIX{}
65610bc4e6a5 Slightly expand and clarify the differences between getegid(), getgid(),
Fred Drake <fdrake@acm.org>
parents: 23242
diff changeset
243 manual for the semantics.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
244 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
245 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
246
13582
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
247 \begin{funcdesc}{setreuid}{ruid, euid}
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
248 Set the current process's real and effective user ids.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
249 Availability: \UNIX.
13582
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
250 \end{funcdesc}
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
251
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
252 \begin{funcdesc}{setregid}{rgid, egid}
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
253 Set the current process's real and effective group ids.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
254 Availability: \UNIX.
13582
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
255 \end{funcdesc}
084a758051e0 From Sam Rushing's Medusa, via SF patch #100858: add & document
Andrew M. Kuchling <amk@amk.ca>
parents: 13222
diff changeset
256
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
257 \begin{funcdesc}{setsid}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
258 Calls the system call \cfunction{setsid()}. See the \UNIX{} manual
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
259 for the semantics.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
260 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
261 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
262
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
263 \begin{funcdesc}{setuid}{uid}
10878
b9ef424165d6 "proces" --> "process"; reported by Gerry Wiener <gerry@ucar.edu>.
Fred Drake <fdrake@acm.org>
parents: 10789
diff changeset
264 \index{user!id, setting}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
265 Set the current process' user id.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
266 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
267 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
268
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
269 % placed in this section since it relates to errno.... a little weak ;-(
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
270 \begin{funcdesc}{strerror}{code}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
271 Return the error message corresponding to the error code in
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
272 \var{code}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
273 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
274 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
275
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
276 \begin{funcdesc}{umask}{mask}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
277 Set the current numeric umask and returns the previous umask.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
278 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
279 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
280
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
281 \begin{funcdesc}{uname}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
282 Return a 5-tuple containing information identifying the current
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
283 operating system. The tuple contains 5 strings:
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
284 \code{(\var{sysname}, \var{nodename}, \var{release}, \var{version},
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
285 \var{machine})}. Some systems truncate the nodename to 8
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
286 characters or to the leading component; a better way to get the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
287 hostname is \function{socket.gethostname()}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
288 \withsubitem{(in module socket)}{\ttindex{gethostname()}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
289 or even
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
290 \withsubitem{(in module socket)}{\ttindex{gethostbyaddr()}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
291 \code{socket.gethostbyaddr(socket.gethostname())}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
292 Availability: recent flavors of \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
293 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
294
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
295
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
296
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
297 \subsection{File Object Creation \label{os-newstreams}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
298
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
299 These functions create new file objects.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
300
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
301
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
302 \begin{funcdesc}{fdopen}{fd\optional{, mode\optional{, bufsize}}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
303 Return an open file object connected to the file descriptor \var{fd}.
11179
d6ab72cb1625 Add index entry "I/O control, buffering" for fdopen().
Fred Drake <fdrake@acm.org>
parents: 11122
diff changeset
304 \index{I/O control!buffering}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
305 The \var{mode} and \var{bufsize} arguments have the same meaning as
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
306 the corresponding arguments to the built-in \function{open()}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
307 function.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
308 Availability: Macintosh, \UNIX, Windows.
26094
f62f773bc9fd Document the changed fdopen behaviour.
Thomas Heller <theller@ctypes.org>
parents: 25806
diff changeset
309
f62f773bc9fd Document the changed fdopen behaviour.
Thomas Heller <theller@ctypes.org>
parents: 25806
diff changeset
310 \versionchanged[When specified, the \var{mode} argument must now start
26098
933c6d608d01 Minor markup adjustments.
Fred Drake <fdrake@acm.org>
parents: 26094
diff changeset
311 with one of the letters \character{r}, \character{w}, or \character{a},
933c6d608d01 Minor markup adjustments.
Fred Drake <fdrake@acm.org>
parents: 26094
diff changeset
312 otherwise a \exception{ValueError} is raised]{2.3}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
313 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
314
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
315 \begin{funcdesc}{popen}{command\optional{, mode\optional{, bufsize}}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
316 Open a pipe to or from \var{command}. The return value is an open
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
317 file object connected to the pipe, which can be read or written
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
318 depending on whether \var{mode} is \code{'r'} (default) or \code{'w'}.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
319 The \var{bufsize} argument has the same meaning as the corresponding
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
320 argument to the built-in \function{open()} function. The exit status of
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
321 the command (encoded in the format specified for \function{wait()}) is
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
322 available as the return value of the \method{close()} method of the file
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
323 object, except that when the exit status is zero (termination without
14997
0c5b02cc5489 Remove old note that os.popen() on Windows is unreliable; this is no
Fred Drake <fdrake@acm.org>
parents: 14922
diff changeset
324 errors), \code{None} is returned.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
325 Availability: \UNIX, Windows.
15008
aa052a52ef87 Added \versionchanged comment to os.popen() noting that it was unreliable
Fred Drake <fdrake@acm.org>
parents: 14997
diff changeset
326
aa052a52ef87 Added \versionchanged comment to os.popen() noting that it was unreliable
Fred Drake <fdrake@acm.org>
parents: 14997
diff changeset
327 \versionchanged[This function worked unreliably under Windows in
aa052a52ef87 Added \versionchanged comment to os.popen() noting that it was unreliable
Fred Drake <fdrake@acm.org>
parents: 14997
diff changeset
328 earlier versions of Python. This was due to the use of the
aa052a52ef87 Added \versionchanged comment to os.popen() noting that it was unreliable
Fred Drake <fdrake@acm.org>
parents: 14997
diff changeset
329 \cfunction{_popen()} function from the libraries provided with
aa052a52ef87 Added \versionchanged comment to os.popen() noting that it was unreliable
Fred Drake <fdrake@acm.org>
parents: 14997
diff changeset
330 Windows. Newer versions of Python do not use the broken
aa052a52ef87 Added \versionchanged comment to os.popen() noting that it was unreliable
Fred Drake <fdrake@acm.org>
parents: 14997
diff changeset
331 implementation from the Windows libraries]{2.0}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
332 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
333
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
334 \begin{funcdesc}{tmpfile}{}
23761
94d0dc9d6e44 SF bug 563750 (Alex Martelli): posix_tmpfile():
Guido van Rossum <guido@python.org>
parents: 23408
diff changeset
335 Return a new file object opened in update mode (\samp{w+b}). The file
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
336 has no directory entries associated with it and will be automatically
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
337 deleted once there are no file descriptors for the file.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
338 Availability: \UNIX, Windows.
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
339 \end{funcdesc}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
340
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
341
14915
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
342 For each of these \function{popen()} variants, if \var{bufsize} is
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
343 specified, it specifies the buffer size for the I/O pipes.
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
344 \var{mode}, if provided, should be the string \code{'b'} or
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
345 \code{'t'}; on Windows this is needed to determine whether the file
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
346 objects should be opened in binary or text mode. The default value
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
347 for \var{mode} is \code{'t'}.
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
348
19873
a19eea41668f Document clearly that the only way to retrieve the return code from the
Fred Drake <fdrake@acm.org>
parents: 19325
diff changeset
349 These methods do not make it possible to retrieve the return code from
a19eea41668f Document clearly that the only way to retrieve the return code from the
Fred Drake <fdrake@acm.org>
parents: 19325
diff changeset
350 the child processes. The only way to control the input and output
a19eea41668f Document clearly that the only way to retrieve the return code from the
Fred Drake <fdrake@acm.org>
parents: 19325
diff changeset
351 streams and also retrieve the return codes is to use the
a19eea41668f Document clearly that the only way to retrieve the return code from the
Fred Drake <fdrake@acm.org>
parents: 19325
diff changeset
352 \class{Popen3} and \class{Popen4} classes from the \refmodule{popen2}
a19eea41668f Document clearly that the only way to retrieve the return code from the
Fred Drake <fdrake@acm.org>
parents: 19325
diff changeset
353 module; these are only available on \UNIX.
a19eea41668f Document clearly that the only way to retrieve the return code from the
Fred Drake <fdrake@acm.org>
parents: 19325
diff changeset
354
26554
4bebf1a19319 Typo: "dead lock" --> "deadlock"
Fred Drake <fdrake@acm.org>
parents: 26159
diff changeset
355 For a discussion of possible deadlock conditions related to the use
23921
bae996bb7d82 Add description of the deadlock problem with child processes and pipes, and
Fred Drake <fdrake@acm.org>
parents: 23897
diff changeset
356 of these functions, see ``\ulink{Flow Control
bae996bb7d82 Add description of the deadlock problem with child processes and pipes, and
Fred Drake <fdrake@acm.org>
parents: 23897
diff changeset
357 Issues}{popen2-flow-control.html}''
bae996bb7d82 Add description of the deadlock problem with child processes and pipes, and
Fred Drake <fdrake@acm.org>
parents: 23897
diff changeset
358 (section~\ref{popen2-flow-control}).
bae996bb7d82 Add description of the deadlock problem with child processes and pipes, and
Fred Drake <fdrake@acm.org>
parents: 23897
diff changeset
359
18074
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
360 \begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}}
14915
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
361 Executes \var{cmd} as a sub-process. Returns the file objects
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
362 \code{(\var{child_stdin}, \var{child_stdout})}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
363 Availability: \UNIX, Windows.
14915
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
364 \versionadded{2.0}
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
365 \end{funcdesc}
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
366
18074
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
367 \begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}}
14915
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
368 Executes \var{cmd} as a sub-process. Returns the file objects
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
369 \code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
370 Availability: \UNIX, Windows.
14915
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
371 \versionadded{2.0}
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
372 \end{funcdesc}
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
373
18074
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
374 \begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}}
14915
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
375 Executes \var{cmd} as a sub-process. Returns the file objects
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
376 \code{(\var{child_stdin}, \var{child_stdout_and_stderr})}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
377 Availability: \UNIX, Windows.
14915
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
378 \versionadded{2.0}
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
379 \end{funcdesc}
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
380
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
381 This functionality is also available in the \refmodule{popen2} module
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
382 using functions of the same names, but the return values of those
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
383 functions have a different order.
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
384
ea2ba910e5f0 Updated documentation relating to the various flavors of popen[234]()
Fred Drake <fdrake@acm.org>
parents: 14789
diff changeset
385
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
386 \subsection{File Descriptor Operations \label{os-fd-ops}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
387
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
388 These functions operate on I/O streams referred to
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
389 using file descriptors.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
390
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
391
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
392 \begin{funcdesc}{close}{fd}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
393 Close file descriptor \var{fd}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
394 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
395
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
396 Note: this function is intended for low-level I/O and must be applied
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
397 to a file descriptor as returned by \function{open()} or
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
398 \function{pipe()}. To close a ``file object'' returned by the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
399 built-in function \function{open()} or by \function{popen()} or
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
400 \function{fdopen()}, use its \method{close()} method.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
401 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
402
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
403 \begin{funcdesc}{dup}{fd}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
404 Return a duplicate of file descriptor \var{fd}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
405 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
406 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
407
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
408 \begin{funcdesc}{dup2}{fd, fd2}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
409 Duplicate file descriptor \var{fd} to \var{fd2}, closing the latter
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
410 first if necessary.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
411 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
412 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
413
24635
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
414 \begin{funcdesc}{fdatasync}{fd}
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
415 Force write of file with filedescriptor \var{fd} to disk.
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
416 Does not force update of metadata.
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
417 Availability: \UNIX.
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
418 \end{funcdesc}
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
419
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
420 \begin{funcdesc}{fpathconf}{fd, name}
13625
fdfd1049f36e Rob W. W. Hooft's spelling fixes for the Library Reference. I hope
Thomas Wouters <thomas@python.org>
parents: 13582
diff changeset
421 Return system configuration information relevant to an open file.
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
422 \var{name} specifies the configuration value to retrieve; it may be a
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
423 string which is the name of a defined system value; these names are
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
424 specified in a number of standards (\POSIX.1, \UNIX 95, \UNIX 98, and
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
425 others). Some platforms define additional names as well. The names
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
426 known to the host operating system are given in the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
427 \code{pathconf_names} dictionary. For configuration variables not
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
428 included in that mapping, passing an integer for \var{name} is also
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
429 accepted.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
430 Availability: \UNIX.
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
431
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
432 If \var{name} is a string and is not known, \exception{ValueError} is
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
433 raised. If a specific value for \var{name} is not supported by the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
434 host system, even if it is included in \code{pathconf_names}, an
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
435 \exception{OSError} is raised with \constant{errno.EINVAL} for the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
436 error number.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
437 \end{funcdesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
438
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
439 \begin{funcdesc}{fstat}{fd}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
440 Return status for file descriptor \var{fd}, like \function{stat()}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
441 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
442 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
443
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
444 \begin{funcdesc}{fstatvfs}{fd}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
445 Return information about the filesystem containing the file associated
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
446 with file descriptor \var{fd}, like \function{statvfs()}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
447 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
448 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
449
24635
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
450 \begin{funcdesc}{fsync}{fd}
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
451 Force write of file with filedescriptor \var{fd} to disk.
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
452 Availability: \UNIX.
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
453 \end{funcdesc}
7ae3d7486801 Documented os.fsync and os.fdatasync. Closes SF bug 584695.
Raymond Hettinger <python@rcn.com>
parents: 24413
diff changeset
454
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
455 \begin{funcdesc}{ftruncate}{fd, length}
21857
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
456 Truncate the file corresponding to file descriptor \var{fd},
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
457 so that it is at most \var{length} bytes in size.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
458 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
459 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
460
13649
f80571bb2913 added doc for isatty()
Skip Montanaro <skip@pobox.com>
parents: 13625
diff changeset
461 \begin{funcdesc}{isatty}{fd}
23242
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
462 Return \code{True} if the file descriptor \var{fd} is open and
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
463 connected to a tty(-like) device, else \code{False}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
464 Availability: \UNIX.
13649
f80571bb2913 added doc for isatty()
Skip Montanaro <skip@pobox.com>
parents: 13625
diff changeset
465 \end{funcdesc}
f80571bb2913 added doc for isatty()
Skip Montanaro <skip@pobox.com>
parents: 13625
diff changeset
466
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
467 \begin{funcdesc}{lseek}{fd, pos, how}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
468 Set the current position of file descriptor \var{fd} to position
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
469 \var{pos}, modified by \var{how}: \code{0} to set the position
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
470 relative to the beginning of the file; \code{1} to set it relative to
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
471 the current position; \code{2} to set it relative to the end of the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
472 file.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
473 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
474 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
475
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
476 \begin{funcdesc}{open}{file, flags\optional{, mode}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
477 Open the file \var{file} and set various flags according to
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
478 \var{flags} and possibly its mode according to \var{mode}.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
479 The default \var{mode} is \code{0777} (octal), and the current umask
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
480 value is first masked out. Return the file descriptor for the newly
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
481 opened file.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
482 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
483
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
484 For a description of the flag and mode values, see the C run-time
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
485 documentation; flag constants (like \constant{O_RDONLY} and
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
486 \constant{O_WRONLY}) are defined in this module too (see below).
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
487
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
488 Note: this function is intended for low-level I/O. For normal usage,
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
489 use the built-in function \function{open()}, which returns a ``file
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
490 object'' with \method{read()} and \method{write()} methods (and many
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
491 more).
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
492 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
493
13067
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
494 \begin{funcdesc}{openpty}{}
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
495 Open a new pseudo-terminal pair. Return a pair of file descriptors
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
496 \code{(\var{master}, \var{slave})} for the pty and the tty,
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
497 respectively. For a (slightly) more portable approach, use the
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
498 \refmodule{pty}\refstmodindex{pty} module.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
499 Availability: Some flavors of \UNIX.
13067
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
500 \end{funcdesc}
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
501
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
502 \begin{funcdesc}{pipe}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
503 Create a pipe. Return a pair of file descriptors \code{(\var{r},
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
504 \var{w})} usable for reading and writing, respectively.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
505 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
506 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
507
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
508 \begin{funcdesc}{read}{fd, n}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
509 Read at most \var{n} bytes from file descriptor \var{fd}.
23327
ba2901287cb7 Explain what os.read() returns at end of file.
Fred Drake <fdrake@acm.org>
parents: 23291
diff changeset
510 Return a string containing the bytes read. If the end of the file
ba2901287cb7 Explain what os.read() returns at end of file.
Fred Drake <fdrake@acm.org>
parents: 23291
diff changeset
511 referred to by \var{fd} has been reached, an empty string is
ba2901287cb7 Explain what os.read() returns at end of file.
Fred Drake <fdrake@acm.org>
parents: 23291
diff changeset
512 returned.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
513 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
514
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
515 Note: this function is intended for low-level I/O and must be applied
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
516 to a file descriptor as returned by \function{open()} or
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
517 \function{pipe()}. To read a ``file object'' returned by the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
518 built-in function \function{open()} or by \function{popen()} or
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
519 \function{fdopen()}, or \code{sys.stdin}, use its
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
520 \method{read()} or \method{readline()} methods.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
521 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
522
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
523 \begin{funcdesc}{tcgetpgrp}{fd}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
524 Return the process group associated with the terminal given by
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
525 \var{fd} (an open file descriptor as returned by \function{open()}).
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
526 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
527 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
528
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
529 \begin{funcdesc}{tcsetpgrp}{fd, pg}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
530 Set the process group associated with the terminal given by
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
531 \var{fd} (an open file descriptor as returned by \function{open()})
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
532 to \var{pg}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
533 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
534 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
535
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
536 \begin{funcdesc}{ttyname}{fd}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
537 Return a string which specifies the terminal device associated with
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
538 file-descriptor \var{fd}. If \var{fd} is not associated with a terminal
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
539 device, an exception is raised.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
540 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
541 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
542
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
543 \begin{funcdesc}{write}{fd, str}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
544 Write the string \var{str} to file descriptor \var{fd}.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
545 Return the number of bytes actually written.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
546 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
547
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
548 Note: this function is intended for low-level I/O and must be applied
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
549 to a file descriptor as returned by \function{open()} or
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
550 \function{pipe()}. To write a ``file object'' returned by the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
551 built-in function \function{open()} or by \function{popen()} or
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
552 \function{fdopen()}, or \code{sys.stdout} or \code{sys.stderr}, use
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
553 its \method{write()} method.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
554 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
555
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
556
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
557 The following data items are available for use in constructing the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
558 \var{flags} parameter to the \function{open()} function.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
559
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
560 \begin{datadesc}{O_RDONLY}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
561 \dataline{O_WRONLY}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
562 \dataline{O_RDWR}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
563 \dataline{O_NDELAY}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
564 \dataline{O_NONBLOCK}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
565 \dataline{O_APPEND}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
566 \dataline{O_DSYNC}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
567 \dataline{O_RSYNC}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
568 \dataline{O_SYNC}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
569 \dataline{O_NOCTTY}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
570 \dataline{O_CREAT}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
571 \dataline{O_EXCL}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
572 \dataline{O_TRUNC}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
573 Options for the \var{flag} argument to the \function{open()} function.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
574 These can be bit-wise OR'd together.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
575 Availability: Macintosh, \UNIX, Windows.
21840
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
576 % XXX O_NDELAY, O_NONBLOCK, O_DSYNC, O_RSYNC, O_SYNC, O_NOCTTY are not on Windows.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
577 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
578
13927
266fb6302f31 O_BINARY: Documented this constant; omission noted by David Ascher.
Fred Drake <fdrake@acm.org>
parents: 13649
diff changeset
579 \begin{datadesc}{O_BINARY}
266fb6302f31 O_BINARY: Documented this constant; omission noted by David Ascher.
Fred Drake <fdrake@acm.org>
parents: 13649
diff changeset
580 Option for the \var{flag} argument to the \function{open()} function.
266fb6302f31 O_BINARY: Documented this constant; omission noted by David Ascher.
Fred Drake <fdrake@acm.org>
parents: 13649
diff changeset
581 This can be bit-wise OR'd together with those listed above.
266fb6302f31 O_BINARY: Documented this constant; omission noted by David Ascher.
Fred Drake <fdrake@acm.org>
parents: 13649
diff changeset
582 Availability: Macintosh, Windows.
266fb6302f31 O_BINARY: Documented this constant; omission noted by David Ascher.
Fred Drake <fdrake@acm.org>
parents: 13649
diff changeset
583 % XXX need to check on the availability of this one.
266fb6302f31 O_BINARY: Documented this constant; omission noted by David Ascher.
Fred Drake <fdrake@acm.org>
parents: 13649
diff changeset
584 \end{datadesc}
266fb6302f31 O_BINARY: Documented this constant; omission noted by David Ascher.
Fred Drake <fdrake@acm.org>
parents: 13649
diff changeset
585
21840
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
586 \begin{datadesc}{O_NOINHERIT}
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
587 \dataline{O_SHORT_LIVED}
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
588 \dataline{O_TEMPORARY}
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
589 \dataline{O_RANDOM}
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
590 \dataline{O_SEQUENTIAL}
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
591 \dataline{O_TEXT}
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
592 Options for the \var{flag} argument to the \function{open()} function.
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
593 These can be bit-wise OR'd together.
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
594 Availability: Windows.
fd4184da0983 Add new constants usable with os.popen() on Windows.
Tim Peters <tim.peters@gmail.com>
parents: 21513
diff changeset
595 \end{datadesc}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
596
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
597 \subsection{Files and Directories \label{os-file-dir}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
598
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
599 \begin{funcdesc}{access}{path, mode}
23897
8305a19584bc Clarified documentation for os.access().
Fred Drake <fdrake@acm.org>
parents: 23835
diff changeset
600 Use the real uid/gid to test for access to \var{path}. Note that most
8305a19584bc Clarified documentation for os.access().
Fred Drake <fdrake@acm.org>
parents: 23835
diff changeset
601 operations will use the effective uid/gid, therefore this routine can
8305a19584bc Clarified documentation for os.access().
Fred Drake <fdrake@acm.org>
parents: 23835
diff changeset
602 be used in a suid/sgid environment to test if the invoking user has the
8305a19584bc Clarified documentation for os.access().
Fred Drake <fdrake@acm.org>
parents: 23835
diff changeset
603 specified access to \var{path}. \var{mode} should be \constant{F_OK}
8305a19584bc Clarified documentation for os.access().
Fred Drake <fdrake@acm.org>
parents: 23835
diff changeset
604 to test the existence of \var{path}, or it can be the inclusive OR of
8305a19584bc Clarified documentation for os.access().
Fred Drake <fdrake@acm.org>
parents: 23835
diff changeset
605 one or more of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to
8305a19584bc Clarified documentation for os.access().
Fred Drake <fdrake@acm.org>
parents: 23835
diff changeset
606 test permissions. Return \code{1} if access is allowed, \code{0} if not.
12223
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
607 See the \UNIX{} man page \manpage{access}{2} for more information.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
608 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
609 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
610
12223
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
611 \begin{datadesc}{F_OK}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
612 Value to pass as the \var{mode} parameter of \function{access()} to
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
613 test the existence of \var{path}.
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
614 \end{datadesc}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
615
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
616 \begin{datadesc}{R_OK}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
617 Value to include in the \var{mode} parameter of \function{access()}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
618 to test the readability of \var{path}.
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
619 \end{datadesc}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
620
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
621 \begin{datadesc}{W_OK}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
622 Value to include in the \var{mode} parameter of \function{access()}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
623 to test the writability of \var{path}.
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
624 \end{datadesc}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
625
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
626 \begin{datadesc}{X_OK}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
627 Value to include in the \var{mode} parameter of \function{access()}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
628 to determine if \var{path} can be executed.
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
629 \end{datadesc}
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
630
11122
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
631 \begin{funcdesc}{chdir}{path}
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
632 \index{directory!changing}
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
633 Change the current working directory to \var{path}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
634 Availability: Macintosh, \UNIX, Windows.
11122
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
635 \end{funcdesc}
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
636
23057
6be283d148f7 Add docs for os.fchdir().
Fred Drake <fdrake@acm.org>
parents: 23026
diff changeset
637 \begin{funcdesc}{fchdir}{fd}
6be283d148f7 Add docs for os.fchdir().
Fred Drake <fdrake@acm.org>
parents: 23026
diff changeset
638 Change the current working directory to the directory represented by
6be283d148f7 Add docs for os.fchdir().
Fred Drake <fdrake@acm.org>
parents: 23026
diff changeset
639 the file descriptor \var{fd}. The descriptor must refer to an opened
6be283d148f7 Add docs for os.fchdir().
Fred Drake <fdrake@acm.org>
parents: 23026
diff changeset
640 directory, not an open file.
6be283d148f7 Add docs for os.fchdir().
Fred Drake <fdrake@acm.org>
parents: 23026
diff changeset
641 Availability: \UNIX.
6be283d148f7 Add docs for os.fchdir().
Fred Drake <fdrake@acm.org>
parents: 23026
diff changeset
642 \versionadded{2.3}
6be283d148f7 Add docs for os.fchdir().
Fred Drake <fdrake@acm.org>
parents: 23026
diff changeset
643 \end{funcdesc}
6be283d148f7 Add docs for os.fchdir().
Fred Drake <fdrake@acm.org>
parents: 23026
diff changeset
644
11122
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
645 \begin{funcdesc}{getcwd}{}
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
646 Return a string representing the current working directory.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
647 Availability: Macintosh, \UNIX, Windows.
11122
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
648 \end{funcdesc}
306b49d68233 Move chdir() and getcwd() descriptions to "Files and Directories" with
Fred Drake <fdrake@acm.org>
parents: 11096
diff changeset
649
25580
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
650 \begin{funcdesc}{getcwdu}{}
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
651 Return a Unicode object representing the current working directory.
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
652 Availability: \UNIX, Windows.
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
653 \versionadded{2.3}
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
654 \end{funcdesc}
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
655
20264
d092abcf9c4b Add chroot call. Implements feature #459267.
Martin v. Löwis <martin@v.loewis.de>
parents: 20145
diff changeset
656 \begin{funcdesc}{chroot}{path}
d092abcf9c4b Add chroot call. Implements feature #459267.
Martin v. Löwis <martin@v.loewis.de>
parents: 20145
diff changeset
657 Change the root directory of the current process to \var{path}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
658 Availability: \UNIX.
20264
d092abcf9c4b Add chroot call. Implements feature #459267.
Martin v. Löwis <martin@v.loewis.de>
parents: 20145
diff changeset
659 \versionadded{2.2}
d092abcf9c4b Add chroot call. Implements feature #459267.
Martin v. Löwis <martin@v.loewis.de>
parents: 20145
diff changeset
660 \end{funcdesc}
d092abcf9c4b Add chroot call. Implements feature #459267.
Martin v. Löwis <martin@v.loewis.de>
parents: 20145
diff changeset
661
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
662 \begin{funcdesc}{chmod}{path, mode}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
663 Change the mode of \var{path} to the numeric \var{mode}.
27107
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
664 \var{mode} may take one of the following values:
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
665 \begin{itemize}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
666 \item \code{S_ISUID}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
667 \item \code{S_ISGID}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
668 \item \code{S_ENFMT}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
669 \item \code{S_ISVTX}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
670 \item \code{S_IREAD}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
671 \item \code{S_IWRITE}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
672 \item \code{S_IEXEC}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
673 \item \code{S_IRWXU}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
674 \item \code{S_IRUSR}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
675 \item \code{S_IWUSR}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
676 \item \code{S_IXUSR}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
677 \item \code{S_IRWXG}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
678 \item \code{S_IRGRP}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
679 \item \code{S_IWGRP}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
680 \item \code{S_IXGRP}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
681 \item \code{S_IRWXO}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
682 \item \code{S_IROTH}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
683 \item \code{S_IWOTH}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
684 \item \code{S_IXOTH}
a0a6f4dd7328 SF bug #592859: os.chmod is underdocumented
Raymond Hettinger <python@rcn.com>
parents: 27097
diff changeset
685 \end{itemize}
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
686 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
687 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
688
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
689 \begin{funcdesc}{chown}{path, uid, gid}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
690 Change the owner and group id of \var{path} to the numeric \var{uid}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
691 and \var{gid}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
692 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
693 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
694
24413
08926cc5f2af Patch #573770: Implement lchown.
Martin v. Löwis <martin@v.loewis.de>
parents: 24371
diff changeset
695 \begin{funcdesc}{lchown}{path, uid, gid}
08926cc5f2af Patch #573770: Implement lchown.
Martin v. Löwis <martin@v.loewis.de>
parents: 24371
diff changeset
696 Change the owner and group id of \var{path} to the numeric \var{uid}
08926cc5f2af Patch #573770: Implement lchown.
Martin v. Löwis <martin@v.loewis.de>
parents: 24371
diff changeset
697 and gid. This function will not follow symbolic links.
08926cc5f2af Patch #573770: Implement lchown.
Martin v. Löwis <martin@v.loewis.de>
parents: 24371
diff changeset
698 Availability: \UNIX.
08926cc5f2af Patch #573770: Implement lchown.
Martin v. Löwis <martin@v.loewis.de>
parents: 24371
diff changeset
699 \versionadded{2.3}
08926cc5f2af Patch #573770: Implement lchown.
Martin v. Löwis <martin@v.loewis.de>
parents: 24371
diff changeset
700 \end{funcdesc}
08926cc5f2af Patch #573770: Implement lchown.
Martin v. Löwis <martin@v.loewis.de>
parents: 24371
diff changeset
701
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
702 \begin{funcdesc}{link}{src, dst}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
703 Create a hard link pointing to \var{src} named \var{dst}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
704 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
705 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
706
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
707 \begin{funcdesc}{listdir}{path}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
708 Return a list containing the names of the entries in the directory.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
709 The list is in arbitrary order. It does not include the special
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
710 entries \code{'.'} and \code{'..'} even if they are present in the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
711 directory.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
712 Availability: Macintosh, \UNIX, Windows.
25580
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
713
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
714 \versionadded[On Windows NT/2k/XP, if \var{path} is a Unicode object,
3679c4fc68bc Document patch #594001.
Martin v. Löwis <martin@v.loewis.de>
parents: 25177
diff changeset
715 the result will be a list of Unicode objects.]{2.3}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
716 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
717
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
718 \begin{funcdesc}{lstat}{path}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
719 Like \function{stat()}, but do not follow symbolic links.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
720 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
721 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
722
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
723 \begin{funcdesc}{mkfifo}{path\optional{, mode}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
724 Create a FIFO (a named pipe) named \var{path} with numeric mode
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
725 \var{mode}. The default \var{mode} is \code{0666} (octal). The current
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
726 umask value is first masked out from the mode.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
727 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
728
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
729 FIFOs are pipes that can be accessed like regular files. FIFOs exist
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
730 until they are deleted (for example with \function{os.unlink()}).
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
731 Generally, FIFOs are used as rendezvous between ``client'' and
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
732 ``server'' type processes: the server opens the FIFO for reading, and
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
733 the client opens it for writing. Note that \function{mkfifo()}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
734 doesn't open the FIFO --- it just creates the rendezvous point.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
735 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
736
25694
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
737 \begin{funcdesc}{mknod}{path\optional{, mode=0600, device}}
23026
f3fc97da68a9 Patch #543447: Add posix.mknod.
Martin v. Löwis <martin@v.loewis.de>
parents: 22764
diff changeset
738 Create a filesystem node (file, device special file or named pipe)
25694
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
739 named filename. \var{mode} specifies both the permissions to use and
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
740 the type of node to be created, being combined (bitwise OR) with one
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
741 of S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO (those constants are
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
742 available in \module{stat}). For S_IFCHR and S_IFBLK, \var{device}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
743 defines the newly created device special file (probably using
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
744 \function{os.makedev()}), otherwise it is ignored.
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
745
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
746 \versionadded{2.3}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
747 \end{funcdesc}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
748
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
749 \begin{funcdesc}{major}{device}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
750 Extracts a device major number from a raw device number.
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
751
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
752 \versionadded{2.3}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
753 \end{funcdesc}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
754
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
755 \begin{funcdesc}{minor}{device}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
756 Extracts a device minor number from a raw device number.
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
757
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
758 \versionadded{2.3}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
759 \end{funcdesc}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
760
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
761 \begin{funcdesc}{makedev}{major, minor}
e9e7f160aac9 Patch #569139: Implementation of major, minor and makedev.
Martin v. Löwis <martin@v.loewis.de>
parents: 25580
diff changeset
762 Composes a raw device number from the major and minor device numbers.
23026
f3fc97da68a9 Patch #543447: Add posix.mknod.
Martin v. Löwis <martin@v.loewis.de>
parents: 22764
diff changeset
763
f3fc97da68a9 Patch #543447: Add posix.mknod.
Martin v. Löwis <martin@v.loewis.de>
parents: 22764
diff changeset
764 \versionadded{2.3}
f3fc97da68a9 Patch #543447: Add posix.mknod.
Martin v. Löwis <martin@v.loewis.de>
parents: 22764
diff changeset
765 \end{funcdesc}
f3fc97da68a9 Patch #543447: Add posix.mknod.
Martin v. Löwis <martin@v.loewis.de>
parents: 22764
diff changeset
766
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
767 \begin{funcdesc}{mkdir}{path\optional{, mode}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
768 Create a directory named \var{path} with numeric mode \var{mode}.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
769 The default \var{mode} is \code{0777} (octal). On some systems,
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
770 \var{mode} is ignored. Where it is used, the current umask value is
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
771 first masked out.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
772 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
773 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
774
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
775 \begin{funcdesc}{makedirs}{path\optional{, mode}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
776 \index{directory!creating}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
777 Recursive directory creation function. Like \function{mkdir()},
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
778 but makes all intermediate-level directories needed to contain the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
779 leaf directory. Throws an \exception{error} exception if the leaf
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
780 directory already exists or cannot be created. The default \var{mode}
20145
c6fc87810551 Added note about non-support of UNC paths on Windows.
Fred Drake <fdrake@acm.org>
parents: 19873
diff changeset
781 is \code{0777} (octal). This function does not properly handle UNC
c6fc87810551 Added note about non-support of UNC paths on Windows.
Fred Drake <fdrake@acm.org>
parents: 19873
diff changeset
782 paths (only relevant on Windows systems).
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
783 \versionadded{1.5.2}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
784 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
785
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
786 \begin{funcdesc}{pathconf}{path, name}
13625
fdfd1049f36e Rob W. W. Hooft's spelling fixes for the Library Reference. I hope
Thomas Wouters <thomas@python.org>
parents: 13582
diff changeset
787 Return system configuration information relevant to a named file.
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
788 \var{name} specifies the configuration value to retrieve; it may be a
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
789 string which is the name of a defined system value; these names are
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
790 specified in a number of standards (\POSIX.1, \UNIX 95, \UNIX 98, and
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
791 others). Some platforms define additional names as well. The names
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
792 known to the host operating system are given in the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
793 \code{pathconf_names} dictionary. For configuration variables not
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
794 included in that mapping, passing an integer for \var{name} is also
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
795 accepted.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
796 Availability: \UNIX.
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
797
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
798 If \var{name} is a string and is not known, \exception{ValueError} is
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
799 raised. If a specific value for \var{name} is not supported by the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
800 host system, even if it is included in \code{pathconf_names}, an
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
801 \exception{OSError} is raised with \constant{errno.EINVAL} for the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
802 error number.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
803 \end{funcdesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
804
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
805 \begin{datadesc}{pathconf_names}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
806 Dictionary mapping names accepted by \function{pathconf()} and
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
807 \function{fpathconf()} to the integer values defined for those names
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
808 by the host operating system. This can be used to determine the set
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
809 of names known to the system.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
810 Availability: \UNIX.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
811 \end{datadesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
812
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
813 \begin{funcdesc}{readlink}{path}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
814 Return a string representing the path to which the symbolic link
17998
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
815 points. The result may be either an absolute or relative pathname; if
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
816 it is relative, it may be converted to an absolute pathname using
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
817 \code{os.path.join(os.path.dirname(\var{path}), \var{result})}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
818 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
819 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
820
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
821 \begin{funcdesc}{remove}{path}
17998
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
822 Remove the file \var{path}. If \var{path} is a directory,
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
823 \exception{OSError} is raised; see \function{rmdir()} below to remove
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
824 a directory. This is identical to the \function{unlink()} function
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
825 documented below. On Windows, attempting to remove a file that is in
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
826 use causes an exception to be raised; on \UNIX, the directory entry is
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
827 removed but the storage allocated to the file is not made available
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
828 until the original file is no longer in use.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
829 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
830 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
831
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
832 \begin{funcdesc}{removedirs}{path}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
833 \index{directory!deleting}
24094
68995e854a88 Attempt to clarify removedirs().
Fred Drake <fdrake@acm.org>
parents: 23921
diff changeset
834 Removes directories recursively. Works like
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
835 \function{rmdir()} except that, if the leaf directory is
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
836 successfully removed, directories corresponding to rightmost path
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
837 segments will be pruned way until either the whole path is consumed or
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
838 an error is raised (which is ignored, because it generally means that
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
839 a parent directory is not empty). Throws an \exception{error}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
840 exception if the leaf directory could not be successfully removed.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
841 \versionadded{1.5.2}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
842 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
843
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
844 \begin{funcdesc}{rename}{src, dst}
17998
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
845 Rename the file or directory \var{src} to \var{dst}. If \var{dst} is
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
846 a directory, \exception{OSError} will be raised. On \UNIX, if
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
847 \var{dst} exists and is a file, it will be removed silently if the
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
848 user has permission. The operation may fail on some \UNIX{} flavors
18029
4d62a2fec930 is -> if in rename description
Skip Montanaro <skip@pobox.com>
parents: 18012
diff changeset
849 if \var{src} and \var{dst} are on different filesystems. If
17998
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
850 successful, the renaming will be an atomic operation (this is a
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
851 \POSIX{} requirement). On Windows, if \var{dst} already exists,
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
852 \exception{OSError} will be raised even if it is a file; there may be
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
853 no way to implement an atomic rename when \var{dst} names an existing
c8cb79772364 readlink() description: Added note that the return value may be either
Fred Drake <fdrake@acm.org>
parents: 15264
diff changeset
854 file.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
855 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
856 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
857
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
858 \begin{funcdesc}{renames}{old, new}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
859 Recursive directory or file renaming function.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
860 Works like \function{rename()}, except creation of any intermediate
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
861 directories needed to make the new pathname good is attempted first.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
862 After the rename, directories corresponding to rightmost path segments
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
863 of the old name will be pruned away using \function{removedirs()}.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
864
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
865 Note: this function can fail with the new directory structure made if
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
866 you lack permissions needed to remove the leaf directory or file.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
867 \versionadded{1.5.2}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
868 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
869
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
870 \begin{funcdesc}{rmdir}{path}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
871 Remove the directory \var{path}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
872 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
873 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
874
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
875 \begin{funcdesc}{stat}{path}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
876 Perform a \cfunction{stat()} system call on the given path. The
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
877 return value is an object whose attributes correspond to the members of
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
878 the \ctype{stat} structure, namely:
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
879 \member{st_mode} (protection bits),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
880 \member{st_ino} (inode number),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
881 \member{st_dev} (device),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
882 \member{st_nlink} (number of hard links,
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
883 \member{st_uid} (user ID of owner),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
884 \member{st_gid} (group ID of owner),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
885 \member{st_size} (size of file, in bytes),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
886 \member{st_atime} (time of most recent access),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
887 \member{st_mtime} (time of most recent content modification),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
888 \member{st_ctime}
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
889 (time of most recent content modification or metadata change).
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
890
25806
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
891 \versionchanged [If \function{stat_float_times} returns true, the time
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
892 values are floats, measuring seconds. Fractions of a second may be
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
893 reported if the system supports that. On Mac OS, the times are always
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
894 floats. See \function{stat_float_times} for further discussion. ]{2.3}
25177
bcdb60df4e3e Always generate floats for stat_result; fix configure test.
Martin v. Löwis <martin@v.loewis.de>
parents: 25176
diff changeset
895
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
896 On some Unix systems (such as Linux), the following attributes may
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
897 also be available:
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
898 \member{st_blocks} (number of blocks allocated for file),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
899 \member{st_blksize} (filesystem blocksize),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
900 \member{st_rdev} (type of device if an inode device).
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
901
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
902 On Mac OS systems, the following attributes may also be available:
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
903 \member{st_rsize},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
904 \member{st_creator},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
905 \member{st_type}.
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
906
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
907 On RISCOS systems, the following attributes are also available:
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
908 \member{st_ftype} (file type),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
909 \member{st_attrs} (attributes),
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
910 \member{st_obtype} (object type).
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
911
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
912 For backward compatibility, the return value of \function{stat()} is
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
913 also accessible as a tuple of at least 10 integers giving the most
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
914 important (and portable) members of the \ctype{stat} structure, in the
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
915 order
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
916 \member{st_mode},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
917 \member{st_ino},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
918 \member{st_dev},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
919 \member{st_nlink},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
920 \member{st_uid},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
921 \member{st_gid},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
922 \member{st_size},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
923 \member{st_atime},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
924 \member{st_mtime},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
925 \member{st_ctime}.
25177
bcdb60df4e3e Always generate floats for stat_result; fix configure test.
Martin v. Löwis <martin@v.loewis.de>
parents: 25176
diff changeset
926 More items may be added at the end by some implementations.
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
927 The standard module \refmodule{stat}\refstmodindex{stat} defines
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
928 functions and constants that are useful for extracting information
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
929 from a \ctype{stat} structure.
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
930 (On Windows, some items are filled with dummy values.)
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
931 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
932
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
933 \versionchanged
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
934 [Added access to values as attributes of the returned object]{2.2}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
935 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
936
25806
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
937 \begin{funcdesc}{stat_float_times}{\optional{newvalue}}
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
938 Determine whether \class{stat_result} represents time stamps as float
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
939 objects. If newval is True, future calls to stat() return floats, if
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
940 it is False, future calls return ints. If newval is omitted, return
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
941 the current setting.
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
942
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
943 For compatibility with older Python versions, accessing
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
944 \class{stat_result} as a tuple always returns integers. For
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
945 compatibility with Python 2.2, accessing the time stamps by field name
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
946 also returns integers. Applications that want to determine the
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
947 fractions of a second in a time stamp can use this function to have
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
948 time stamps represented as floats. Whether they will actually observe
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
949 non-zero fractions depends on the system.
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
950
27097
a1664b7da76f Fix a typo
Neal Norwitz <nnorwitz@gmail.com>
parents: 26811
diff changeset
951 Future Python releases will change the default of this setting;
25806
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
952 applications that cannot deal with floating point time stamps can then
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
953 use this function to turn the feature off.
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
954
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
955 It is recommended that this setting is only changed at program startup
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
956 time in the \var{__main__} module; libraries should never change this
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
957 setting. If an application uses a library that works incorrectly if
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
958 floating point time stamps are processed, this application should turn
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
959 the feature off until the library has been corrected.
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
960
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
961 \end{funcdesc}
0bbea4dcd9be Add PyStructSequence_UnnamedField. Add stat_float_times.
Martin v. Löwis <martin@v.loewis.de>
parents: 25709
diff changeset
962
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
963 \begin{funcdesc}{statvfs}{path}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
964 Perform a \cfunction{statvfs()} system call on the given path. The
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
965 return value is an object whose attributes describe the filesystem on
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
966 the given path, and correspond to the members of the
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
967 \ctype{statvfs} structure, namely:
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
968 \member{f_frsize},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
969 \member{f_blocks},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
970 \member{f_bfree},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
971 \member{f_bavail},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
972 \member{f_files},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
973 \member{f_ffree},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
974 \member{f_favail},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
975 \member{f_flag},
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
976 \member{f_namemax}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
977 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
978
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
979 For backward compatibility, the return value is also accessible as a
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
980 tuple whose values correspond to the attributes, in the order given above.
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
981 The standard module \refmodule{statvfs}\refstmodindex{statvfs}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
982 defines constants that are useful for extracting information
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
983 from a \ctype{statvfs} structure when accessing it as a sequence; this
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
984 remains useful when writing code that needs to work with versions of
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
985 Python that don't support accessing the fields as attributes.
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
986
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
987 \versionchanged
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
988 [Added access to values as attributes of the returned object]{2.2}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
989 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
990
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
991 \begin{funcdesc}{symlink}{src, dst}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
992 Create a symbolic link pointing to \var{src} named \var{dst}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
993 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
994 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
995
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
996 \begin{funcdesc}{tempnam}{\optional{dir\optional{, prefix}}}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
997 Return a unique path name that is reasonable for creating a temporary
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
998 file. This will be an absolute path that names a potential directory
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
999 entry in the directory \var{dir} or a common location for temporary
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1000 files if \var{dir} is omitted or \code{None}. If given and not
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1001 \code{None}, \var{prefix} is used to provide a short prefix to the
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1002 filename. Applications are responsible for properly creating and
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1003 managing files created using paths returned by \function{tempnam()};
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1004 no automatic cleanup is provided.
26159
27f64314f0de Clarified documentation of tempnam().
Fred Drake <fdrake@acm.org>
parents: 26098
diff changeset
1005 On \UNIX, the environment variable \envvar{TMPDIR} overrides
27f64314f0de Clarified documentation of tempnam().
Fred Drake <fdrake@acm.org>
parents: 26098
diff changeset
1006 \var{dir}, while on Windows the \envvar{TMP} is used. The specific
27f64314f0de Clarified documentation of tempnam().
Fred Drake <fdrake@acm.org>
parents: 26098
diff changeset
1007 behavior of this function depends on the C library implementation;
27f64314f0de Clarified documentation of tempnam().
Fred Drake <fdrake@acm.org>
parents: 26098
diff changeset
1008 some aspects are underspecified in system documentation.
20337
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1009 \warning{Use of \function{tempnam()} is vulnerable to symlink attacks;
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1010 consider using \function{tmpfile()} instead.}
18675
f7be7e9a6f20 Update the availability information for os.tempnam(), os.tmpfile(), and
Fred Drake <fdrake@acm.org>
parents: 18574
diff changeset
1011 Availability: \UNIX, Windows.
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1012 \end{funcdesc}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1013
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1014 \begin{funcdesc}{tmpnam}{}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1015 Return a unique path name that is reasonable for creating a temporary
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1016 file. This will be an absolute path that names a potential directory
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1017 entry in a common location for temporary files. Applications are
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1018 responsible for properly creating and managing files created using
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1019 paths returned by \function{tmpnam()}; no automatic cleanup is
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1020 provided.
20337
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1021 \warning{Use of \function{tmpnam()} is vulnerable to symlink attacks;
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1022 consider using \function{tmpfile()} instead.}
18675
f7be7e9a6f20 Update the availability information for os.tempnam(), os.tmpfile(), and
Fred Drake <fdrake@acm.org>
parents: 18574
diff changeset
1023 Availability: \UNIX, Windows.
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1024 \end{funcdesc}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1025
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1026 \begin{datadesc}{TMP_MAX}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1027 The maximum number of unique names that \function{tmpnam()} will
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1028 generate before reusing names.
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1029 \end{datadesc}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1030
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1031 \begin{funcdesc}{unlink}{path}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1032 Remove the file \var{path}. This is the same function as
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1033 \function{remove()}; the \function{unlink()} name is its traditional
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1034 \UNIX{} name.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1035 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1036 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1037
12535
8a5036544727 Document the new additional signature for utime(). In addition to the
Barry Warsaw <barry@python.org>
parents: 12223
diff changeset
1038 \begin{funcdesc}{utime}{path, times}
8a5036544727 Document the new additional signature for utime(). In addition to the
Barry Warsaw <barry@python.org>
parents: 12223
diff changeset
1039 Set the access and modified times of the file specified by \var{path}.
8a5036544727 Document the new additional signature for utime(). In addition to the
Barry Warsaw <barry@python.org>
parents: 12223
diff changeset
1040 If \var{times} is \code{None}, then the file's access and modified
8a5036544727 Document the new additional signature for utime(). In addition to the
Barry Warsaw <barry@python.org>
parents: 12223
diff changeset
1041 times are set to the current time. Otherwise, \var{times} must be a
12550
dc9d1b71cc38 Use \versionchanged to indicate when the second parameter to utime()
Fred Drake <fdrake@acm.org>
parents: 12535
diff changeset
1042 2-tuple of numbers, of the form \code{(\var{atime}, \var{mtime})}
dc9d1b71cc38 Use \versionchanged to indicate when the second parameter to utime()
Fred Drake <fdrake@acm.org>
parents: 12535
diff changeset
1043 which is used to set the access and modified times, respectively.
15264
b51629980c88 Capitalize first letter of an explanation for a \versionchanged
Fred Drake <fdrake@acm.org>
parents: 15234
diff changeset
1044 \versionchanged[Added support for \code{None} for \var{times}]{2.0}
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1045 Availability: Macintosh, \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1046 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1047
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1048
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1049 \subsection{Process Management \label{os-process}}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1050
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1051 These functions may be used to create and manage processes.
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1052
14789
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1053 The various \function{exec*()} functions take a list of arguments for
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1054 the new program loaded into the process. In each case, the first of
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1055 these arguments is passed to the new program as its own name rather
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1056 than as an argument a user may have typed on a command line. For the
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1057 C programmer, this is the \code{argv[0]} passed to a program's
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1058 \cfunction{main()}. For example, \samp{os.execv('/bin/echo', ['foo',
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1059 'bar'])} will only print \samp{bar} on standard output; \samp{foo}
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1060 will seem to be ignored.
be2df9935edd Added explanation of the use of the first program argument passed to the
Fred Drake <fdrake@acm.org>
parents: 13927
diff changeset
1061
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1062
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1063 \begin{funcdesc}{abort}{}
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1064 Generate a \constant{SIGABRT} signal to the current process. On
21857
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1065 \UNIX, the default behavior is to produce a core dump; on Windows, the
11534
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1066 process immediately returns an exit code of \code{3}. Be aware that
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1067 programs which use \function{signal.signal()} to register a handler
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1068 for \constant{SIGABRT} will behave differently.
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1069 Availability: \UNIX, Windows.
68364bf002f1 Document the new stuff in the os module.
Fred Drake <fdrake@acm.org>
parents: 11292
diff changeset
1070 \end{funcdesc}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1071
20529
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1072 \begin{funcdesc}{execl}{path, arg0, arg1, \moreargs}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1073 \funcline{execle}{path, arg0, arg1, \moreargs, env}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1074 \funcline{execlp}{file, arg0, arg1, \moreargs}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1075 \funcline{execlpe}{file, arg0, arg1, \moreargs, env}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1076 \funcline{execv}{path, args}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1077 \funcline{execve}{path, args, env}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1078 \funcline{execvp}{file, args}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1079 \funcline{execvpe}{file, args, env}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1080 These functions all execute a new program, replacing the current
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1081 process; they do not return. On \UNIX, the new executable is loaded
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1082 into the current process, and will have the same process ID as the
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1083 caller. Errors will be reported as \exception{OSError} exceptions.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1084
20529
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1085 The \character{l} and \character{v} variants of the
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1086 \function{exec*()} functions differ in how command-line arguments are
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1087 passed. The \character{l} variants are perhaps the easiest to work
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1088 with if the number of parameters is fixed when the code is written;
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1089 the individual parameters simply become additional parameters to the
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1090 \function{execl*()} functions. The \character{v} variants are good
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1091 when the number of parameters is variable, with the arguments being
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1092 passed in a list or tuple as the \var{args} parameter. In either
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1093 case, the arguments to the child process must start with the name of
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1094 the command being run.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1095
20529
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1096 The variants which include a \character{p} near the end
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1097 (\function{execlp()}, \function{execlpe()}, \function{execvp()},
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1098 and \function{execvpe()}) will use the \envvar{PATH} environment
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1099 variable to locate the program \var{file}. When the environment is
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1100 being replaced (using one of the \function{exec*e()} variants,
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1101 discussed in the next paragraph), the
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1102 new environment is used as the source of the \envvar{PATH} variable.
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1103 The other variants, \function{execl()}, \function{execle()},
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1104 \function{execv()}, and \function{execve()}, will not use the
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1105 \envvar{PATH} variable to locate the executable; \var{path} must
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1106 contain an appropriate absolute or relative path.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1107
20529
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1108 For \function{execle()}, \function{execlpe()}, \function{execve()},
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1109 and \function{execvpe()} (note that these all end in \character{e}),
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1110 the \var{env} parameter must be a mapping which is used to define the
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1111 environment variables for the new process; the \function{execl()},
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1112 \function{execlp()}, \function{execv()}, and \function{execvp()}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1113 all cause the new process to inherit the environment of the current
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1114 process.
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1115 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1116 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1117
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1118 \begin{funcdesc}{_exit}{n}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1119 Exit to the system with status \var{n}, without calling cleanup
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1120 handlers, flushing stdio buffers, etc.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1121 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1122
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1123 Note: the standard way to exit is \code{sys.exit(\var{n})}.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1124 \function{_exit()} should normally only be used in the child process
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1125 after a \function{fork()}.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1126 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1127
27144
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1128 The following exit codes are a defined, and can be used with
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1129 \function{_exit()}, although they are not required. These are
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1130 typically used for system programs written in Python, such as a
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1131 mail server's external command delivery program.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1132
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1133 \begin{datadesc}{EX_OK}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1134 Exit code that means no error occurred.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1135 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1136 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1137 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1138
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1139 \begin{datadesc}{EX_USAGE}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1140 Exit code that means the command was used incorrectly, such as when
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1141 the wrong number of arguments are given.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1142 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1143 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1144 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1145
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1146 \begin{datadesc}{EX_DATAERR}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1147 Exit code that means the input data was incorrect.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1148 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1149 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1150 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1151
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1152 \begin{datadesc}{EX_NOINPUT}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1153 Exit code that means an input file did not exist or was not readable.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1154 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1155 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1156 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1157
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1158 \begin{datadesc}{EX_NOUSER}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1159 Exit code that means a specified user did not exist.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1160 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1161 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1162 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1163
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1164 \begin{datadesc}{EX_NOHOST}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1165 Exit code that means a specified host did not exist.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1166 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1167 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1168 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1169
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1170 \begin{datadesc}{EX_UNAVAILABLE}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1171 Exit code that means that a required service is unavailable.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1172 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1173 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1174 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1175
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1176 \begin{datadesc}{EX_SOFTWARE}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1177 Exit code that means an internal software error was detected.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1178 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1179 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1180 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1181
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1182 \begin{datadesc}{EX_OSERR}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1183 Exit code that means an operating system error was detected, such as
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1184 the inability to fork or create a pipe.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1185 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1186 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1187 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1188
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1189 \begin{datadesc}{EX_OSFILE}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1190 Exit code that means some system file did not exist, could not be
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1191 opened, or had some other kind of error.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1192 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1193 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1194 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1195
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1196 \begin{datadesc}{EX_CANTCREAT}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1197 Exit code that means a user specified output file could not be created.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1198 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1199 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1200 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1201
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1202 \begin{datadesc}{EX_IOERR}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1203 Exit code that means that an error occurred while doing I/O on some file.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1204 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1205 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1206 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1207
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1208 \begin{datadesc}{EX_TEMPFAIL}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1209 Exit code that means a temporary failure occurred. This indicates
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1210 something that may not really be an error, such as a network
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1211 connection that couldn't be made during a retryable operation.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1212 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1213 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1214 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1215
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1216 \begin{datadesc}{EX_PROTOCOL}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1217 Exit code that means that a protocol exchange was illegal, invalid, or
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1218 not understood.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1219 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1220 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1221 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1222
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1223 \begin{datadesc}{EX_NOPERM}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1224 Exit code that means that there were insufficient permissions to
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1225 perform the operation (but not intended for file system problems).
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1226 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1227 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1228 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1229
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1230 \begin{datadesc}{EX_CONFIG}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1231 Exit code that means that some kind of configuration error occurred.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1232 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1233 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1234 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1235
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1236 \begin{datadesc}{EX_NOTFOUND}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1237 Exit code that means something like ``an entry was not found''.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1238 Availability: \UNIX.
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1239 \versionadded{2.3}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1240 \end{datadesc}
e204dff3fcbf Document EX_OK and friends.
Barry Warsaw <barry@python.org>
parents: 27107
diff changeset
1241
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1242 \begin{funcdesc}{fork}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1243 Fork a child process. Return \code{0} in the child, the child's
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1244 process id in the parent.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1245 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1246 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1247
13067
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
1248 \begin{funcdesc}{forkpty}{}
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
1249 Fork a child process, using a new pseudo-terminal as the child's
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
1250 controlling terminal. Return a pair of \code{(\var{pid}, \var{fd})},
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
1251 where \var{pid} is \code{0} in the child, the new child's process id
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
1252 in the parent, and \var{fd} is the file descriptor of the master end
13067
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
1253 of the pseudo-terminal. For a more portable approach, use the
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
1254 \refmodule{pty} module.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1255 Availability: Some flavors of \UNIX.
13067
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
1256 \end{funcdesc}
a679bdb43fad Thomas Wouters <thomas@xs4all.net>:
Fred Drake <fdrake@acm.org>
parents: 12550
diff changeset
1257
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1258 \begin{funcdesc}{kill}{pid, sig}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1259 \index{process!killing}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1260 \index{process!signalling}
21513
04612dc323df Add a reference to the signal module to the os.kill() description.
Fred Drake <fdrake@acm.org>
parents: 21505
diff changeset
1261 Kill the process \var{pid} with signal \var{sig}. Constants for the
04612dc323df Add a reference to the signal module to the os.kill() description.
Fred Drake <fdrake@acm.org>
parents: 21505
diff changeset
1262 specific signals available on the host platform are defined in the
04612dc323df Add a reference to the signal module to the os.kill() description.
Fred Drake <fdrake@acm.org>
parents: 21505
diff changeset
1263 \refmodule{signal} module.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1264 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1265 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1266
26811
edf304e60cc6 Document killpg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26810
diff changeset
1267 \begin{funcdesc}{killpg}{pgid, sig}
edf304e60cc6 Document killpg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26810
diff changeset
1268 \index{process!killing}
edf304e60cc6 Document killpg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26810
diff changeset
1269 \index{process!signalling}
edf304e60cc6 Document killpg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26810
diff changeset
1270 Kill the process group \var{pgid} with the signal \var{sig}.
edf304e60cc6 Document killpg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26810
diff changeset
1271 Availability: \UNIX.
edf304e60cc6 Document killpg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26810
diff changeset
1272 \versionadded{2.3}
edf304e60cc6 Document killpg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26810
diff changeset
1273 \end{funcdesc}
edf304e60cc6 Document killpg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26810
diff changeset
1274
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1275 \begin{funcdesc}{nice}{increment}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1276 Add \var{increment} to the process's ``niceness''. Return the new
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1277 niceness.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1278 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1279 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1280
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1281 \begin{funcdesc}{plock}{op}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1282 Lock program segments into memory. The value of \var{op}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1283 (defined in \code{<sys/lock.h>}) determines which segments are locked.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1284 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1285 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1286
18074
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
1287 \begin{funcdescni}{popen}{\unspecified}
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
1288 \funclineni{popen2}{\unspecified}
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
1289 \funclineni{popen3}{\unspecified}
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
1290 \funclineni{popen4}{\unspecified}
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
1291 Run child processes, returning opened pipes for communications. These
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
1292 functions are described in section \ref{os-newstreams}.
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
1293 \end{funcdescni}
410bbf5d98f9 Fixed parameter order for os.popen2(), os.popen3(), and os.popen(4). Added
Fred Drake <fdrake@acm.org>
parents: 18029
diff changeset
1294
19325
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1295 \begin{funcdesc}{spawnl}{mode, path, \moreargs}
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1296 \funcline{spawnle}{mode, path, \moreargs, env}
20529
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1297 \funcline{spawnlp}{mode, file, \moreargs}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1298 \funcline{spawnlpe}{mode, file, \moreargs, env}
19325
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1299 \funcline{spawnv}{mode, path, args}
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1300 \funcline{spawnve}{mode, path, args, env}
20529
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1301 \funcline{spawnvp}{mode, file, args}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1302 \funcline{spawnvpe}{mode, file, args, env}
19325
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1303 Execute the program \var{path} in a new process. If \var{mode} is
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1304 \constant{P_NOWAIT}, this function returns the process ID of the new
21279
643244f7f467 s/it/if/ in descriptions of spawn mode argument.
Tim Peters <tim.peters@gmail.com>
parents: 21108
diff changeset
1305 process; if \var{mode} is \constant{P_WAIT}, returns the process's
19325
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1306 exit code if it exits normally, or \code{-\var{signal}}, where
22764
3428229f12bb Explain that os.spawn*() return the process handle on Windows.
Fred Drake <fdrake@acm.org>
parents: 21857
diff changeset
1307 \var{signal} is the signal that killed the process. On Windows, the
3428229f12bb Explain that os.spawn*() return the process handle on Windows.
Fred Drake <fdrake@acm.org>
parents: 21857
diff changeset
1308 process ID will actually be the process handle, so can be used with
3428229f12bb Explain that os.spawn*() return the process handle on Windows.
Fred Drake <fdrake@acm.org>
parents: 21857
diff changeset
1309 the \function{waitpid()} function.
19325
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1310
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1311 The \character{l} and \character{v} variants of the
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1312 \function{spawn*()} functions differ in how command-line arguments are
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1313 passed. The \character{l} variants are perhaps the easiest to work
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1314 with if the number of parameters is fixed when the code is written;
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1315 the individual parameters simply become additional parameters to the
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1316 \function{spawnl*()} functions. The \character{v} variants are good
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1317 when the number of parameters is variable, with the arguments being
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1318 passed in a list or tuple as the \var{args} parameter. In either
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1319 case, the arguments to the child process must start with the name of
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1320 the command being run.
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1321
20529
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1322 The variants which include a second \character{p} near the end
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1323 (\function{spawnlp()}, \function{spawnlpe()}, \function{spawnvp()},
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1324 and \function{spawnvpe()}) will use the \envvar{PATH} environment
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1325 variable to locate the program \var{file}. When the environment is
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1326 being replaced (using one of the \function{spawn*e()} variants,
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1327 discussed in the next paragraph), the new environment is used as the
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1328 source of the \envvar{PATH} variable. The other variants,
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1329 \function{spawnl()}, \function{spawnle()}, \function{spawnv()}, and
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1330 \function{spawnve()}, will not use the \envvar{PATH} variable to
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1331 locate the executable; \var{path} must contain an appropriate absolute
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1332 or relative path.
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1333
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1334 For \function{spawnle()}, \function{spawnlpe()}, \function{spawnve()},
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1335 and \function{spawnvpe()} (note that these all end in \character{e}),
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1336 the \var{env} parameter must be a mapping which is used to define the
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1337 environment variables for the new process; the \function{spawnl()},
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1338 \function{spawnlp()}, \function{spawnv()}, and \function{spawnvp()}
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1339 all cause the new process to inherit the environment of the current
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1340 process.
dbfed3bf160e Straighten out the exec*() function descriptions a bit, and clarify a few
Fred Drake <fdrake@acm.org>
parents: 20511
diff changeset
1341
19325
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1342 As an example, the following calls to \function{spawnlp()} and
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1343 \function{spawnvpe()} are equivalent:
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1344
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1345 \begin{verbatim}
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1346 import os
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1347 os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1348
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1349 L = ['cp', 'index.html', '/dev/null']
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1350 os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1351 \end{verbatim}
db488cc9f259 Re-write the description of the os.spawn*() functions, and cover the
Fred Drake <fdrake@acm.org>
parents: 18812
diff changeset
1352
21505
3815a959819c Fix the availability statement for the spawn*() functions to reflect the
Fred Drake <fdrake@acm.org>
parents: 21279
diff changeset
1353 Availability: \UNIX, Windows. \function{spawnlp()},
3815a959819c Fix the availability statement for the spawn*() functions to reflect the
Fred Drake <fdrake@acm.org>
parents: 21279
diff changeset
1354 \function{spawnlpe()}, \function{spawnvp()} and \function{spawnvpe()}
3815a959819c Fix the availability statement for the spawn*() functions to reflect the
Fred Drake <fdrake@acm.org>
parents: 21279
diff changeset
1355 are not available on Windows.
18080
ff2d7c183715 Add the appropriate availability annotations for the popen*() family of
Fred Drake <fdrake@acm.org>
parents: 18074
diff changeset
1356 \versionadded{1.6}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1357 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1358
20337
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1359 \begin{datadesc}{P_NOWAIT}
10190
8f4ad14c3407 Remove "_" from the P_* symbols used with the spawn*() functions.
Fred Drake <fdrake@acm.org>
parents: 10092
diff changeset
1360 \dataline{P_NOWAITO}
20337
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1361 Possible values for the \var{mode} parameter to the \function{spawn*()}
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1362 family of functions. If either of these values is given, the
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1363 \function{spawn*()} functions will return as soon as the new process
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1364 has been created, with the process ID as the return value.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1365 Availability: \UNIX, Windows.
18080
ff2d7c183715 Add the appropriate availability annotations for the popen*() family of
Fred Drake <fdrake@acm.org>
parents: 18074
diff changeset
1366 \versionadded{1.6}
11877
5d0879e1ff37 Update portability information for the spawn*() functions and related
Fred Drake <fdrake@acm.org>
parents: 11578
diff changeset
1367 \end{datadesc}
5d0879e1ff37 Update portability information for the spawn*() functions and related
Fred Drake <fdrake@acm.org>
parents: 11578
diff changeset
1368
20337
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1369 \begin{datadesc}{P_WAIT}
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1370 Possible value for the \var{mode} parameter to the \function{spawn*()}
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1371 family of functions. If this is given as \var{mode}, the
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1372 \function{spawn*()} functions will not return until the new process
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1373 has run to completion and will return the exit code of the process the
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1374 run is successful, or \code{-\var{signal}} if a signal kills the
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1375 process.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1376 Availability: \UNIX, Windows.
20337
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1377 \versionadded{1.6}
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1378 \end{datadesc}
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1379
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1380 \begin{datadesc}{P_DETACH}
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1381 \dataline{P_OVERLAY}
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1382 Possible values for the \var{mode} parameter to the
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1383 \function{spawn*()} family of functions. These are less portable than
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1384 those listed above.
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1385 \constant{P_DETACH} is similar to \constant{P_NOWAIT}, but the new
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1386 process is detached from the console of the calling process.
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1387 If \constant{P_OVERLAY} is used, the current process will be replaced;
4bf3fce3f6ce Improve the documentation for the os.P_* constants used with the os.spawn*()
Fred Drake <fdrake@acm.org>
parents: 20264
diff changeset
1388 the \function{spawn*()} function will not return.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1389 Availability: Windows.
18080
ff2d7c183715 Add the appropriate availability annotations for the popen*() family of
Fred Drake <fdrake@acm.org>
parents: 18074
diff changeset
1390 \versionadded{1.6}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1391 \end{datadesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1392
14922
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1393 \begin{funcdesc}{startfile}{path}
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1394 Start a file with its associated application. This acts like
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1395 double-clicking the file in Windows Explorer, or giving the file name
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1396 as an argument to the \program{start} command from the interactive
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1397 command shell: the file is opened with whatever application (if any)
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1398 its extension is associated.
14922
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1399
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1400 \function{startfile()} returns as soon as the associated application
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1401 is launched. There is no option to wait for the application to close,
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1402 and no way to retrieve the application's exit status. The \var{path}
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1403 parameter is relative to the current directory. If you want to use an
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1404 absolute path, make sure the first character is not a slash
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1405 (\character{/}); the underlying Win32 \cfunction{ShellExecute()}
18812
0c3ad503ad6c Typo: Added missing "if".
Fred Drake <fdrake@acm.org>
parents: 18675
diff changeset
1406 function doesn't work if it is. Use the \function{os.path.normpath()}
14922
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1407 function to ensure that the path is properly encoded for Win32.
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1408 Availability: Windows.
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1409 \versionadded{2.0}
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1410 \end{funcdesc}
9a8700fdc52b os.startfile() documentation, based on text from Tim Peters.
Fred Drake <fdrake@acm.org>
parents: 14915
diff changeset
1411
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1412 \begin{funcdesc}{system}{command}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1413 Execute the command (a string) in a subshell. This is implemented by
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1414 calling the Standard C function \cfunction{system()}, and has the
10659
69fb81facb03 Small markup nits.
Fred Drake <fdrake@acm.org>
parents: 10346
diff changeset
1415 same limitations. Changes to \code{posix.environ}, \code{sys.stdin},
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1416 etc.\ are not reflected in the environment of the executed command.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1417 The return value is the exit status of the process encoded in the
10957
bdc1703ff92c At David Ascher's request, clarify that os.system() always returns 0
Fred Drake <fdrake@acm.org>
parents: 10878
diff changeset
1418 format specified for \function{wait()}, except on Windows 95 and 98,
11015
41385d50a10c Further clarfication of the system-dependence of the system() return
Fred Drake <fdrake@acm.org>
parents: 10977
diff changeset
1419 where it is always \code{0}. Note that \POSIX{} does not specify the
41385d50a10c Further clarfication of the system-dependence of the system() return
Fred Drake <fdrake@acm.org>
parents: 10977
diff changeset
1420 meaning of the return value of the C \cfunction{system()} function,
41385d50a10c Further clarfication of the system-dependence of the system() return
Fred Drake <fdrake@acm.org>
parents: 10977
diff changeset
1421 so the return value of the Python function is system-dependent.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1422 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1423 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1424
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1425 \begin{funcdesc}{times}{}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1426 Return a 5-tuple of floating point numbers indicating accumulated
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1427 (processor or other)
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1428 times, in seconds. The items are: user time, system time, children's
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1429 user time, children's system time, and elapsed real time since a fixed
10659
69fb81facb03 Small markup nits.
Fred Drake <fdrake@acm.org>
parents: 10346
diff changeset
1430 point in the past, in that order. See the \UNIX{} manual page
69fb81facb03 Small markup nits.
Fred Drake <fdrake@acm.org>
parents: 10346
diff changeset
1431 \manpage{times}{2} or the corresponding Windows Platform API
69fb81facb03 Small markup nits.
Fred Drake <fdrake@acm.org>
parents: 10346
diff changeset
1432 documentation.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1433 Availability: \UNIX, Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1434 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1435
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1436 \begin{funcdesc}{wait}{}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1437 Wait for completion of a child process, and return a tuple containing
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1438 its pid and exit status indication: a 16-bit number, whose low byte is
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1439 the signal number that killed the process, and whose high byte is the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1440 exit status (if the signal number is zero); the high bit of the low
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1441 byte is set if a core file was produced.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1442 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1443 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1444
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1445 \begin{funcdesc}{waitpid}{pid, options}
23408
c5c4c1121087 Fix markup error that suppressed space.
Fred Drake <fdrake@acm.org>
parents: 23327
diff changeset
1446 The details of this function differ on \UNIX{} and Windows.
21857
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1447
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1448 On \UNIX:
11191
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1449 Wait for completion of a child process given by process id \var{pid},
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1450 and return a tuple containing its process id and exit status
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1451 indication (encoded as for \function{wait()}). The semantics of the
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1452 call are affected by the value of the integer \var{options}, which
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1453 should be \code{0} for normal operation.
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1454
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1455 If \var{pid} is greater than \code{0}, \function{waitpid()} requests
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1456 status information for that specific process. If \var{pid} is
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1457 \code{0}, the request is for the status of any child in the process
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1458 group of the current process. If \var{pid} is \code{-1}, the request
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1459 pertains to any child of the current process. If \var{pid} is less
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1460 than \code{-1}, status is requested for any process in the process
01c51b268c04 Explain the possible range of values for the pid parameter to
Fred Drake <fdrake@acm.org>
parents: 11179
diff changeset
1461 group \code{-\var{pid}} (the absolute value of \var{pid}).
21857
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1462
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1463 On Windows:
22764
3428229f12bb Explain that os.spawn*() return the process handle on Windows.
Fred Drake <fdrake@acm.org>
parents: 21857
diff changeset
1464 Wait for completion of a process given by process handle \var{pid},
21857
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1465 and return a tuple containing \var{pid},
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1466 and its exit status shifted left by 8 bits (shifting makes cross-platform
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1467 use of the function easier).
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1468 A \var{pid} less than or equal to \code{0} has no special meaning on
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1469 Windows, and raises an exception.
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1470 The value of integer \var{options} has no effect.
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1471 \var{pid} can refer to any process whose id is known, not necessarily a
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1472 child process.
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1473 The \function{spawn()} functions called with \constant{P_NOWAIT}
22764
3428229f12bb Explain that os.spawn*() return the process handle on Windows.
Fred Drake <fdrake@acm.org>
parents: 21857
diff changeset
1474 return suitable process handles.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1475 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1476
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1477 \begin{datadesc}{WNOHANG}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1478 The option for \function{waitpid()} to avoid hanging if no child
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1479 process status is available immediately.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1480 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1481 \end{datadesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1482
23242
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1483 \begin{datadesc}{WCONTINUED}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1484 This option causes child processes to be reported if they have been
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1485 continued from a job control stop since their status was last
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1486 reported.
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1487 Availability: Some \UNIX{} systems.
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1488 \versionadded{2.3}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1489 \end{datadesc}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1490
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1491 \begin{datadesc}{WUNTRACED}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1492 This option causes child processes to be reported if they have been
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1493 stopped but their current state has not been reported since they were
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1494 stopped.
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1495 Availability: \UNIX.
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1496 \versionadded{2.3}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1497 \end{datadesc}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1498
12223
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
1499 The following functions take a process status code as returned by
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
1500 \function{system()}, \function{wait()}, or \function{waitpid()} as a
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
1501 parameter. They may be used to determine the disposition of a
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11877
diff changeset
1502 process.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1503
23242
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1504 \begin{funcdesc}{WCOREDUMP}{status}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1505 Returns \code{True} if a core dump was generated for the process,
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1506 otherwise it returns \code{False}.
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1507 Availability: \UNIX.
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1508 \versionadded{2.3}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1509 \end{funcdesc}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1510
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1511 \begin{funcdesc}{WIFCONTINUED}{status}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1512 Returns \code{True} if the process has been continued from a job
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1513 control stop, otherwise it returns \code{False}.
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1514 Availability: \UNIX.
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1515 \versionadded{2.3}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1516 \end{funcdesc}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1517
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1518 \begin{funcdesc}{WIFSTOPPED}{status}
23242
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1519 Returns \code{True} if the process has been stopped, otherwise it
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1520 returns \code{False}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1521 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1522 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1523
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1524 \begin{funcdesc}{WIFSIGNALED}{status}
23242
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1525 Returns \code{True} if the process exited due to a signal, otherwise
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1526 it returns \code{False}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1527 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1528 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1529
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1530 \begin{funcdesc}{WIFEXITED}{status}
23242
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1531 Returns \code{True} if the process exited using the \manpage{exit}{2}
4e234b87170b WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
Fred Drake <fdrake@acm.org>
parents: 23058
diff changeset
1532 system call, otherwise it returns \code{False}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1533 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1534 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1535
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1536 \begin{funcdesc}{WEXITSTATUS}{status}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1537 If \code{WIFEXITED(\var{status})} is true, return the integer
21857
9cff890b4fb0 Implement os.waitpid() for Windows, in a way that's compatible with Linux
Tim Peters <tim.peters@gmail.com>
parents: 21840
diff changeset
1538 parameter to the \manpage{exit}{2} system call. Otherwise, the return
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1539 value is meaningless.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1540 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1541 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1542
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1543 \begin{funcdesc}{WSTOPSIG}{status}
10346
4e2d18973b94 Fixed description of WSTOPSIG(), added WTERMSIG(). Problem reported
Fred Drake <fdrake@acm.org>
parents: 10312
diff changeset
1544 Return the signal which caused the process to stop.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1545 Availability: \UNIX.
10346
4e2d18973b94 Fixed description of WSTOPSIG(), added WTERMSIG(). Problem reported
Fred Drake <fdrake@acm.org>
parents: 10312
diff changeset
1546 \end{funcdesc}
4e2d18973b94 Fixed description of WSTOPSIG(), added WTERMSIG(). Problem reported
Fred Drake <fdrake@acm.org>
parents: 10312
diff changeset
1547
4e2d18973b94 Fixed description of WSTOPSIG(), added WTERMSIG(). Problem reported
Fred Drake <fdrake@acm.org>
parents: 10312
diff changeset
1548 \begin{funcdesc}{WTERMSIG}{status}
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1549 Return the signal which caused the process to exit.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1550 Availability: \UNIX.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1551 \end{funcdesc}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1552
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1553
13625
fdfd1049f36e Rob W. W. Hooft's spelling fixes for the Library Reference. I hope
Thomas Wouters <thomas@python.org>
parents: 13582
diff changeset
1554 \subsection{Miscellaneous System Information \label{os-path}}
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1555
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1556
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1557 \begin{funcdesc}{confstr}{name}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1558 Return string-valued system configuration values.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1559 \var{name} specifies the configuration value to retrieve; it may be a
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1560 string which is the name of a defined system value; these names are
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1561 specified in a number of standards (\POSIX, \UNIX 95, \UNIX 98, and
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1562 others). Some platforms define additional names as well. The names
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1563 known to the host operating system are given in the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1564 \code{confstr_names} dictionary. For configuration variables not
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1565 included in that mapping, passing an integer for \var{name} is also
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1566 accepted.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1567 Availability: \UNIX.
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1568
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1569 If the configuration value specified by \var{name} isn't defined, the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1570 empty string is returned.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1571
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1572 If \var{name} is a string and is not known, \exception{ValueError} is
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1573 raised. If a specific value for \var{name} is not supported by the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1574 host system, even if it is included in \code{confstr_names}, an
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1575 \exception{OSError} is raised with \constant{errno.EINVAL} for the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1576 error number.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1577 \end{funcdesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1579 \begin{datadesc}{confstr_names}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1580 Dictionary mapping names accepted by \function{confstr()} to the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1581 integer values defined for those names by the host operating system.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1582 This can be used to determine the set of names known to the system.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1583 Availability: \UNIX.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1584 \end{datadesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1585
26810
9d0e62c9a128 Patch #657889: Implement posix.getloadavg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26554
diff changeset
1586 \begin{funcdesc}{getloadavg}{}
9d0e62c9a128 Patch #657889: Implement posix.getloadavg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26554
diff changeset
1587 Return the number of processes in the system run queue averaged over
9d0e62c9a128 Patch #657889: Implement posix.getloadavg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26554
diff changeset
1588 the last 1, 5, and 15 minutes or raises OSError if the load average
9d0e62c9a128 Patch #657889: Implement posix.getloadavg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26554
diff changeset
1589 was unobtainable.
9d0e62c9a128 Patch #657889: Implement posix.getloadavg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26554
diff changeset
1590
9d0e62c9a128 Patch #657889: Implement posix.getloadavg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26554
diff changeset
1591 \versionadded{2.3}
9d0e62c9a128 Patch #657889: Implement posix.getloadavg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26554
diff changeset
1592 \end{funcdesc}
9d0e62c9a128 Patch #657889: Implement posix.getloadavg.
Martin v. Löwis <martin@v.loewis.de>
parents: 26554
diff changeset
1593
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1594 \begin{funcdesc}{sysconf}{name}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1595 Return integer-valued system configuration values.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1596 If the configuration value specified by \var{name} isn't defined,
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1597 \code{-1} is returned. The comments regarding the \var{name}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1598 parameter for \function{confstr()} apply here as well; the dictionary
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1599 that provides information on the known names is given by
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1600 \code{sysconf_names}.
21062
bc02c3b09626 Clean up some markup cruft. A number of the macros that take no
Fred Drake <fdrake@acm.org>
parents: 20529
diff changeset
1601 Availability: \UNIX.
11578
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1602 \end{funcdesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1603
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1604 \begin{datadesc}{sysconf_names}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1605 Dictionary mapping names accepted by \function{sysconf()} to the
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1606 integer values defined for those names by the host operating system.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1607 This can be used to determine the set of names known to the system.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1608 Availability: \UNIX.
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1609 \end{datadesc}
4c3e55c828d3 Document getgroups(), getlogin(), fpathconf(), pathconf(),
Fred Drake <fdrake@acm.org>
parents: 11534
diff changeset
1610
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1611
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1612 The follow data values are used to support path manipulation
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1613 operations. These are defined for all platforms.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1614
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1615 Higher-level operations on pathnames are defined in the
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1616 \refmodule{os.path} module.
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1617
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1618
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1619 \begin{datadesc}{curdir}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1620 The constant string used by the operating system to refer to the current
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1621 directory.
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
1622 For example: \code{'.'} for \POSIX{} or \code{':'} for the Macintosh.
27897
cf1efca82b18 Migrate definitions of several platform-dependent path-related variables
Skip Montanaro <skip@pobox.com>
parents: 27890
diff changeset
1623 Also available via \module{os.path}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1624 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1625
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1626 \begin{datadesc}{pardir}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1627 The constant string used by the operating system to refer to the parent
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1628 directory.
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
1629 For example: \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh.
27897
cf1efca82b18 Migrate definitions of several platform-dependent path-related variables
Skip Montanaro <skip@pobox.com>
parents: 27890
diff changeset
1630 Also available via \module{os.path}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1631 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1632
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1633 \begin{datadesc}{sep}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1634 The character used by the operating system to separate pathname components,
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
1635 for example, \character{/} for \POSIX{} or \character{:} for the
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
1636 Macintosh. Note that knowing this is not sufficient to be able to
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
1637 parse or concatenate pathnames --- use \function{os.path.split()} and
8850
c351523ebc05 Markup nits.
Fred Drake <fdrake@acm.org>
parents: 8849
diff changeset
1638 \function{os.path.join()} --- but it is occasionally useful.
27897
cf1efca82b18 Migrate definitions of several platform-dependent path-related variables
Skip Montanaro <skip@pobox.com>
parents: 27890
diff changeset
1639 Also available via \module{os.path}.
1471
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1640 \end{datadesc}
2ec96140a36b Restructured library documentation
Guido van Rossum <guido@python.org>
parents:
diff changeset
1641
6205
e554b9f4a3aa Added os.altsep; this is '/' on DOS/Windows, and None on systems with
Guido van Rossum <guido@python.org>
parents: 5818
diff changeset
1642 \begin{datadesc}{altsep}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1643 An alternative character used by the operating system to separate pathname
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1644 components, or \code{None} if only one separator character exists. This is
25709
1a9f47885260 Remove mentionings of DOS.
Martin v. Löwis <martin@v.loewis.de>
parents: 25694
diff changeset
1645 set to \character{/} on Windows systems where \code{sep} is a
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1646 backslash.
27897
cf1efca82b18 Migrate definitions of several platform-dependent path-related variables
Skip Montanaro <skip@pobox.com>
parents: 27890
diff changeset
1647 Also available via \module{os.path}.
6205
e554b9f4a3aa Added os.altsep; this is '/' on DOS/Windows, and None on systems with
Guido van Rossum <guido@python.org>
parents: 5818
diff changeset
1648 \end{datadesc}
e554b9f4a3aa Added os.altsep; this is '/' on DOS/Windows, and None on systems with
Guido van Rossum <guido@python.org>
parents: 5818
diff changeset
1649
27888
31e8581bcf25 add missing description of os.extsep
Skip Montanaro <skip@pobox.com>
parents: 27745
diff changeset
1650 \begin{datadesc}{extsep}
27890
e7d59db6839a extsep description:
Fred Drake <fdrake@acm.org>
parents: 27888
diff changeset
1651 The character which separates the base filename from the extension;
e7d59db6839a extsep description:
Fred Drake <fdrake@acm.org>
parents: 27888
diff changeset
1652 for example, the \character{.} in \file{os.py}.
27897
cf1efca82b18 Migrate definitions of several platform-dependent path-related variables
Skip Montanaro <skip@pobox.com>
parents: 27890
diff changeset
1653 Also available via \module{os.path}.
27890
e7d59db6839a extsep description:
Fred Drake <fdrake@acm.org>
parents: 27888
diff changeset
1654 \versionadded{2.2}
27888
31e8581bcf25 add missing description of os.extsep
Skip Montanaro <skip@pobox.com>
parents: 27745
diff changeset
1655 \end{datadesc}
31e8581bcf25 add missing description of os.extsep
Skip Montanaro <skip@pobox.com>
parents: 27745
diff changeset
1656
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
1657 \begin{datadesc}{pathsep}
18574
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1658 The character conventionally used by the operating system to separate
346dcafc878b Minor changes to match the style guide.
Fred Drake <fdrake@acm.org>
parents: 18416
diff changeset
1659 search patch components (as in \envvar{PATH}), such as \character{:} for
25709
1a9f47885260 Remove mentionings of DOS.
Martin v. Löwis <martin@v.loewis.de>
parents: 25694
diff changeset
1660 \POSIX{} or \character{;} for Windows.
27897
cf1efca82b18 Migrate definitions of several platform-dependent path-related variables
Skip Montanaro <skip@pobox.com>
parents: 27890
diff changeset
1661 Also available via \module{os.path}.
8597
7bc714144b98 Documented os.linesep (line separator).
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
1662 \end{datadesc}
7bc714144b98 Documented os.linesep (line separator).
Guido van Rossum <guido@python.org>
parents: 7877
diff changeset
1663
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
1664 \begin{datadesc}{defpath}
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
1665 The default search path used by \function{exec*p*()} and
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
1666 \function{spawn*p*()} if the environment doesn't have a \code{'PATH'}
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
1667 key.
27897
cf1efca82b18 Migrate definitions of several platform-dependent path-related variables
Skip Montanaro <skip@pobox.com>
parents: 27890
diff changeset
1668 Also available via \module{os.path}.
2576
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
1669 \end{datadesc}
f47bc5554418 mass changes; fix titles; add examples; correct typos; clarifications;
Guido van Rossum <guido@python.org>
parents: 2527
diff changeset
1670
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1671 \begin{datadesc}{linesep}
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1672 The string used to separate (or, rather, terminate) lines on the
18416
33b4357aebb8 Fix up a few style nits -- avoid "e.g." and "i.e." -- these make
Fred Drake <fdrake@acm.org>
parents: 18080
diff changeset
1673 current platform. This may be a single character, such as \code{'\e
21108
12668d0af8f7 Various cleanups & markup fixes, mostly relating to the stat and statvfs
Fred Drake <fdrake@acm.org>
parents: 21062
diff changeset
1674 n'} for \POSIX{} or \code{'\e r'} for Mac OS, or multiple characters,
25709
1a9f47885260 Remove mentionings of DOS.
Martin v. Löwis <martin@v.loewis.de>
parents: 25694
diff changeset
1675 for example, \code{'\e r\e n'} for Windows.
10083
4894dcea126b Fix the os/posix documentation issue.
Fred Drake <fdrake@acm.org>
parents: 9736
diff changeset
1676 \end{datadesc}