blob: 803d90b729931e4263ad745033849b76f37e9156 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{os} ---
Fred Drake215fe2f1999-02-02 19:02:35 +00002 Miscellaneous OS interfaces}
Fred Drakeb91e9341998-07-23 17:59:49 +00003
Fred Drakeec6baaf1999-04-21 18:13:31 +00004\declaremodule{standard}{os}
Fred Drakeb91e9341998-07-23 17:59:49 +00005\modulesynopsis{Miscellaneous OS interfaces.}
6
Fred Drakec4f15af1998-03-10 03:17:26 +00007
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00008This module provides a more portable way of using operating system
9(OS) dependent functionality than importing an OS dependent built-in
Fred Drake2f979011999-06-11 18:28:37 +000010module like \refmodule{posix} or \module{nt}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000011
Fred Drake215fe2f1999-02-02 19:02:35 +000012This module searches for an OS dependent built-in module like
Fred Drake2f979011999-06-11 18:28:37 +000013\module{mac} or \refmodule{posix} and exports the same functions and data
Fred Drake215fe2f1999-02-02 19:02:35 +000014as found there. The design of all Python's built-in OS dependent
15modules is such that as long as the same functionality is available,
16it uses the same interface; e.g., the function
Fred Drakeec6baaf1999-04-21 18:13:31 +000017\code{os.stat(\var{path})} returns stat information about \var{path} in
18the same format (which happens to have originated with the
19\POSIX{} interface).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000020
21Extensions peculiar to a particular OS are also available through the
Fred Drakec4f15af1998-03-10 03:17:26 +000022\module{os} module, but using them is of course a threat to
23portability!
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000024
Fred Drakec4f15af1998-03-10 03:17:26 +000025Note that after the first time \module{os} is imported, there is
26\emph{no} performance penalty in using functions from \module{os}
27instead of directly from the OS dependent built-in module, so there
28should be \emph{no} reason not to use \module{os}!
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000029
Fred Drake215fe2f1999-02-02 19:02:35 +000030
Fred Drake859dc531999-07-01 13:54:40 +000031% Frank Stajano <fstajano@uk.research.att.com> complained that it
32% wasn't clear that the entries described in the subsections were all
33% available at the module level (most uses of subsections are
34% different); I think this is only a problem for the HTML version,
35% where the relationship may not be as clear.
36%
37\ifhtml
38The \module{os} module contains many functions and data values.
39The items below and in the following sub-sections are all available
40directly from the \module{os} module.
41\fi
42
43
Fred Drake215fe2f1999-02-02 19:02:35 +000044\begin{excdesc}{error}
45This exception is raised when a function returns a
46system-related error (e.g., not for illegal argument types). This is
47also known as the built-in exception \exception{OSError}. The
48accompanying value is a pair containing the numeric error code from
49\cdata{errno} and the corresponding string, as would be printed by the
50C function \cfunction{perror()}. See the module
51\refmodule{errno}\refbimodindex{errno}, which contains names for the
52error codes defined by the underlying operating system.
53
54When exceptions are classes, this exception carries two attributes,
55\member{errno} and \member{strerror}. The first holds the value of
56the C \cdata{errno} variable, and the latter holds the corresponding
57error message from \cfunction{strerror()}. For exceptions that
58involve a file system path (e.g. \function{chdir()} or
59\function{unlink()}), the exception instance will contain a third
60attribute, \member{filename}, which is the file name passed to the
61function.
62
63When exceptions are strings, the string for the exception is
64\code{'OSError'}.
65\end{excdesc}
Guido van Rossum470be141995-03-17 16:07:09 +000066
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000067\begin{datadesc}{name}
Guido van Rossum470be141995-03-17 16:07:09 +000068The name of the OS dependent module imported. The following names
69have currently been registered: \code{'posix'}, \code{'nt'},
Fred Drake933d5a71999-09-17 14:38:39 +000070\code{'dos'}, \code{'mac'}, \code{'os2'}, \code{'ce'}, \code{'java'}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000071\end{datadesc}
72
73\begin{datadesc}{path}
74The corresponding OS dependent standard module for pathname
Fred Drake215fe2f1999-02-02 19:02:35 +000075operations, e.g., \module{posixpath} or \module{macpath}. Thus, given
76the proper imports, \code{os.path.split(\var{file})} is equivalent to but
77more portable than \code{posixpath.split(\var{file})}. Note that this
78is also a valid module: it may be imported directly as
79\refmodule{os.path}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000080\end{datadesc}
81
Fred Drake215fe2f1999-02-02 19:02:35 +000082
83
84\subsection{Process Parameters \label{os-procinfo}}
85
86These functions and data items provide information and operate on the
87current process and user.
88
Fred Drake215fe2f1999-02-02 19:02:35 +000089\begin{datadesc}{environ}
Fred Drake0e1de8b1999-04-29 12:57:32 +000090A mapping object representing the string environment. For example,
91\code{environ['HOME']} is the pathname of your home directory (on some
92platforms), and is equivalent to \code{getenv("HOME")} in C.
Fred Drake215fe2f1999-02-02 19:02:35 +000093
94If the platform supports the \function{putenv()} function, this
95mapping may be used to modify the environment as well as query the
96environment. \function{putenv()} will be called automatically when
97the mapping is modified.
98
99If \function{putenv()} is not provided, this mapping may be passed to
100the appropriate process-creation functions to cause child processes to
101use a modified environment.
102\end{datadesc}
103
Fred Drake6db897c1999-07-12 16:49:30 +0000104\begin{funcdescni}{chdir}{path}
105\funclineni{getcwd}{}
106These functions are described in ``Files and Directories'' (section
107\ref{os-file-dir}).
108\end{funcdescni}
Fred Drake215fe2f1999-02-02 19:02:35 +0000109
Fred Drake18f7a451999-12-09 22:11:43 +0000110\begin{funcdesc}{ctermid}{}
111Return the filename corresponding to the controlling terminal of the
112process.
113Availability: \UNIX{}.
114\end{funcdesc}
115
Fred Drake215fe2f1999-02-02 19:02:35 +0000116\begin{funcdesc}{getegid}{}
117Return the current process' effective group id.
118Availability: \UNIX{}.
119\end{funcdesc}
120
121\begin{funcdesc}{geteuid}{}
Fred Drake6b330ba81999-05-25 13:42:26 +0000122\index{user!effective id}
Fred Drake215fe2f1999-02-02 19:02:35 +0000123Return the current process' effective user id.
124Availability: \UNIX{}.
125\end{funcdesc}
126
127\begin{funcdesc}{getgid}{}
Fred Drake6b330ba81999-05-25 13:42:26 +0000128\index{process!group}
Fred Drake215fe2f1999-02-02 19:02:35 +0000129Return the current process' group id.
130Availability: \UNIX{}.
131\end{funcdesc}
132
Fred Drake88f6ca21999-12-15 19:39:04 +0000133\begin{funcdesc}{getgroups}{}
134Return list of supplemental group ids associated with the current
135process.
136Availability: \UNIX{}.
137\end{funcdesc}
138
139\begin{funcdesc}{getlogin}{}
140Return the actual login name for the current process, even if there
141are multiple login names which map to the same user id.
142Availability: \UNIX{}.
143\end{funcdesc}
144
Fred Drake215fe2f1999-02-02 19:02:35 +0000145\begin{funcdesc}{getpgrp}{}
146\index{process!group}
147Return the current process group id.
148Availability: \UNIX{}.
149\end{funcdesc}
150
151\begin{funcdesc}{getpid}{}
152\index{process!id}
153Return the current process id.
154Availability: \UNIX{}, Windows.
155\end{funcdesc}
156
157\begin{funcdesc}{getppid}{}
158\index{process!id of parent}
159Return the parent's process id.
160Availability: \UNIX{}.
161\end{funcdesc}
162
163\begin{funcdesc}{getuid}{}
Fred Drake6b330ba81999-05-25 13:42:26 +0000164\index{user!id}
Fred Drake215fe2f1999-02-02 19:02:35 +0000165Return the current process' user id.
166Availability: \UNIX{}.
167\end{funcdesc}
168
169\begin{funcdesc}{putenv}{varname, value}
170\index{environment variables!setting}
171Set the environment variable named \var{varname} to the string
172\var{value}. Such changes to the environment affect subprocesses
173started with \function{os.system()}, \function{popen()} or
174\function{fork()} and \function{execv()}.
175Availability: most flavors of \UNIX{}, Windows.
176
177When \function{putenv()} is
178supported, assignments to items in \code{os.environ} are automatically
179translated into corresponding calls to \function{putenv()}; however,
180calls to \function{putenv()} don't update \code{os.environ}, so it is
181actually preferable to assign to items of \code{os.environ}.
182\end{funcdesc}
183
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +0000184\begin{funcdesc}{setegid}{egid}
185Set the current process's effective group id.
186Availability: \UNIX{}.
187\end{funcdesc}
188
189\begin{funcdesc}{seteuid}{euid}
190Set the current process's effective user id.
191Availability: \UNIX{}.
192\end{funcdesc}
193
Fred Drake215fe2f1999-02-02 19:02:35 +0000194\begin{funcdesc}{setgid}{gid}
195Set the current process' group id.
196Availability: \UNIX{}.
197\end{funcdesc}
198
199\begin{funcdesc}{setpgrp}{}
200Calls the system call \cfunction{setpgrp()} or \cfunction{setpgrp(0,
2010)} depending on which version is implemented (if any). See the
202\UNIX{} manual for the semantics.
203Availability: \UNIX{}.
204\end{funcdesc}
205
206\begin{funcdesc}{setpgid}{pid, pgrp}
207Calls the system call \cfunction{setpgid()}. See the \UNIX{} manual
208for the semantics.
209Availability: \UNIX{}.
210\end{funcdesc}
211
Andrew M. Kuchling8d2f2b22000-07-13 01:26:58 +0000212\begin{funcdesc}{setreuid}{ruid, euid}
213Set the current process's real and effective user ids.
214Availability: \UNIX{}.
215\end{funcdesc}
216
217\begin{funcdesc}{setregid}{rgid, egid}
218Set the current process's real and effective group ids.
219Availability: \UNIX{}.
220\end{funcdesc}
221
Fred Drake215fe2f1999-02-02 19:02:35 +0000222\begin{funcdesc}{setsid}{}
223Calls the system call \cfunction{setsid()}. See the \UNIX{} manual
224for the semantics.
225Availability: \UNIX{}.
226\end{funcdesc}
227
228\begin{funcdesc}{setuid}{uid}
Fred Drake6b330ba81999-05-25 13:42:26 +0000229\index{user!id, setting}
Fred Drake215fe2f1999-02-02 19:02:35 +0000230Set the current process' user id.
231Availability: \UNIX{}.
232\end{funcdesc}
233
234% placed in this section since it relates to errno.... a little weak ;-(
235\begin{funcdesc}{strerror}{code}
236Return the error message corresponding to the error code in
237\var{code}.
238Availability: \UNIX{}, Windows.
239\end{funcdesc}
240
241\begin{funcdesc}{umask}{mask}
242Set the current numeric umask and returns the previous umask.
243Availability: \UNIX{}, Windows.
244\end{funcdesc}
245
246\begin{funcdesc}{uname}{}
247Return a 5-tuple containing information identifying the current
248operating system. The tuple contains 5 strings:
249\code{(\var{sysname}, \var{nodename}, \var{release}, \var{version},
250\var{machine})}. Some systems truncate the nodename to 8
251characters or to the leading component; a better way to get the
252hostname is \function{socket.gethostname()}
253\withsubitem{(in module socket)}{\ttindex{gethostname()}}
254or even
255\withsubitem{(in module socket)}{\ttindex{gethostbyaddr()}}
256\code{socket.gethostbyaddr(socket.gethostname())}.
257Availability: recent flavors of \UNIX{}.
258\end{funcdesc}
259
260
261
262\subsection{File Object Creation \label{os-newstreams}}
263
264These functions create new file objects.
265
266
267\begin{funcdesc}{fdopen}{fd\optional{, mode\optional{, bufsize}}}
268Return an open file object connected to the file descriptor \var{fd}.
Fred Drake8c9fc001999-08-05 13:41:31 +0000269\index{I/O control!buffering}
Fred Drake215fe2f1999-02-02 19:02:35 +0000270The \var{mode} and \var{bufsize} arguments have the same meaning as
271the corresponding arguments to the built-in \function{open()}
272function.
273Availability: Macintosh, \UNIX{}, Windows.
274\end{funcdesc}
275
276\begin{funcdesc}{popen}{command\optional{, mode\optional{, bufsize}}}
277Open a pipe to or from \var{command}. The return value is an open
278file object connected to the pipe, which can be read or written
279depending on whether \var{mode} is \code{'r'} (default) or \code{'w'}.
280The \var{bufsize} argument has the same meaning as the corresponding
281argument to the built-in \function{open()} function. The exit status of
282the command (encoded in the format specified for \function{wait()}) is
283available as the return value of the \method{close()} method of the file
284object, except that when the exit status is zero (termination without
Fred Drake38e5d272000-04-03 20:13:55 +0000285errors), \code{None} is returned. \strong{Note:} This function
286behaves unreliably under Windows due to the native implementation of
287\cfunction{popen()}.
Fred Drake215fe2f1999-02-02 19:02:35 +0000288Availability: \UNIX{}, Windows.
289\end{funcdesc}
290
Fred Drake18f7a451999-12-09 22:11:43 +0000291\begin{funcdesc}{tmpfile}{}
292Return a new file object opened in update mode (\samp{w+}). The file
293has no directory entries associated with it and will be automatically
294deleted once there are no file descriptors for the file.
295Availability: \UNIX{}.
296\end{funcdesc}
Fred Drake215fe2f1999-02-02 19:02:35 +0000297
298
299\subsection{File Descriptor Operations \label{os-fd-ops}}
300
301These functions operate on I/O streams referred to
302using file descriptors.
303
304
305\begin{funcdesc}{close}{fd}
306Close file descriptor \var{fd}.
307Availability: Macintosh, \UNIX{}, Windows.
308
309Note: this function is intended for low-level I/O and must be applied
310to a file descriptor as returned by \function{open()} or
311\function{pipe()}. To close a ``file object'' returned by the
312built-in function \function{open()} or by \function{popen()} or
313\function{fdopen()}, use its \method{close()} method.
314\end{funcdesc}
315
316\begin{funcdesc}{dup}{fd}
317Return a duplicate of file descriptor \var{fd}.
318Availability: Macintosh, \UNIX{}, Windows.
319\end{funcdesc}
320
321\begin{funcdesc}{dup2}{fd, fd2}
322Duplicate file descriptor \var{fd} to \var{fd2}, closing the latter
323first if necessary.
324Availability: \UNIX{}, Windows.
325\end{funcdesc}
326
Fred Drake88f6ca21999-12-15 19:39:04 +0000327\begin{funcdesc}{fpathconf}{fd, name}
328Return system configration information relevant to an open file.
329\var{name} specifies the configuration value to retrieve; it may be a
330string which is the name of a defined system value; these names are
331specified in a number of standards (\POSIX.1, Unix95, Unix98, and
332others). Some platforms define additional names as well. The names
333known to the host operating system are given in the
334\code{pathconf_names} dictionary. For configuration variables not
335included in that mapping, passing an integer for \var{name} is also
336accepted.
337Availability: \UNIX{}.
338
339If \var{name} is a string and is not known, \exception{ValueError} is
340raised. If a specific value for \var{name} is not supported by the
341host system, even if it is included in \code{pathconf_names}, an
342\exception{OSError} is raised with \constant{errno.EINVAL} for the
343error number.
344\end{funcdesc}
345
Fred Drake215fe2f1999-02-02 19:02:35 +0000346\begin{funcdesc}{fstat}{fd}
347Return status for file descriptor \var{fd}, like \function{stat()}.
348Availability: \UNIX{}, Windows.
349\end{funcdesc}
350
351\begin{funcdesc}{fstatvfs}{fd}
352Return information about the filesystem containing the file associated
353with file descriptor \var{fd}, like \function{statvfs()}.
354Availability: \UNIX{}.
355\end{funcdesc}
356
357\begin{funcdesc}{ftruncate}{fd, length}
358Truncate the file corresponding to file descriptor \var{fd},
359so that it is at most \var{length} bytes in size.
360Availability: \UNIX{}.
361\end{funcdesc}
362
363\begin{funcdesc}{lseek}{fd, pos, how}
364Set the current position of file descriptor \var{fd} to position
365\var{pos}, modified by \var{how}: \code{0} to set the position
366relative to the beginning of the file; \code{1} to set it relative to
367the current position; \code{2} to set it relative to the end of the
368file.
369Availability: Macintosh, \UNIX{}, Windows.
370\end{funcdesc}
371
372\begin{funcdesc}{open}{file, flags\optional{, mode}}
373Open the file \var{file} and set various flags according to
374\var{flags} and possibly its mode according to \var{mode}.
375The default \var{mode} is \code{0777} (octal), and the current umask
376value is first masked out. Return the file descriptor for the newly
377opened file.
378Availability: Macintosh, \UNIX{}, Windows.
379
380For a description of the flag and mode values, see the C run-time
381documentation; flag constants (like \constant{O_RDONLY} and
382\constant{O_WRONLY}) are defined in this module too (see below).
383
384Note: this function is intended for low-level I/O. For normal usage,
385use the built-in function \function{open()}, which returns a ``file
386object'' with \method{read()} and \method{write()} methods (and many
387more).
388\end{funcdesc}
389
Fred Drakec82634c2000-06-28 17:27:48 +0000390\begin{funcdesc}{openpty}{}
391Open a new pseudo-terminal pair. Return a pair of file descriptors
392\code{(\var{master}, \var{slave})} for the pty and the tty,
393respectively. For a (slightly) more portable approach, use the
394\refmodule{pty}\refstmodindex{pty} module.
395Availability: Some flavors of \UNIX{}
396\end{funcdesc}
397
Fred Drake215fe2f1999-02-02 19:02:35 +0000398\begin{funcdesc}{pipe}{}
399Create a pipe. Return a pair of file descriptors \code{(\var{r},
400\var{w})} usable for reading and writing, respectively.
401Availability: \UNIX{}, Windows.
402\end{funcdesc}
403
404\begin{funcdesc}{read}{fd, n}
405Read at most \var{n} bytes from file descriptor \var{fd}.
406Return a string containing the bytes read.
407Availability: Macintosh, \UNIX{}, Windows.
408
409Note: this function is intended for low-level I/O and must be applied
410to a file descriptor as returned by \function{open()} or
411\function{pipe()}. To read a ``file object'' returned by the
412built-in function \function{open()} or by \function{popen()} or
413\function{fdopen()}, or \code{sys.stdin}, use its
414\method{read()} or \method{readline()} methods.
415\end{funcdesc}
416
417\begin{funcdesc}{tcgetpgrp}{fd}
418Return the process group associated with the terminal given by
419\var{fd} (an open file descriptor as returned by \function{open()}).
420Availability: \UNIX{}.
421\end{funcdesc}
422
423\begin{funcdesc}{tcsetpgrp}{fd, pg}
424Set the process group associated with the terminal given by
425\var{fd} (an open file descriptor as returned by \function{open()})
426to \var{pg}.
427Availability: \UNIX{}.
428\end{funcdesc}
429
430\begin{funcdesc}{ttyname}{fd}
431Return a string which specifies the terminal device associated with
432file-descriptor \var{fd}. If \var{fd} is not associated with a terminal
433device, an exception is raised.
434Availability: \UNIX{}.
435\end{funcdesc}
436
437\begin{funcdesc}{write}{fd, str}
438Write the string \var{str} to file descriptor \var{fd}.
439Return the number of bytes actually written.
440Availability: Macintosh, \UNIX{}, Windows.
441
442Note: this function is intended for low-level I/O and must be applied
443to a file descriptor as returned by \function{open()} or
444\function{pipe()}. To write a ``file object'' returned by the
445built-in function \function{open()} or by \function{popen()} or
446\function{fdopen()}, or \code{sys.stdout} or \code{sys.stderr}, use
447its \method{write()} method.
448\end{funcdesc}
449
450
451The following data items are available for use in constructing the
452\var{flags} parameter to the \function{open()} function.
453
454\begin{datadesc}{O_RDONLY}
455\dataline{O_WRONLY}
456\dataline{O_RDWR}
457\dataline{O_NDELAY}
458\dataline{O_NONBLOCK}
459\dataline{O_APPEND}
460\dataline{O_DSYNC}
461\dataline{O_RSYNC}
462\dataline{O_SYNC}
463\dataline{O_NOCTTY}
464\dataline{O_CREAT}
465\dataline{O_EXCL}
466\dataline{O_TRUNC}
467Options for the \var{flag} argument to the \function{open()} function.
468These can be bit-wise OR'd together.
469Availability: Macintosh, \UNIX{}, Windows.
470\end{datadesc}
471
472
473\subsection{Files and Directories \label{os-file-dir}}
474
475\begin{funcdesc}{access}{path, mode}
Fred Drake38e5d272000-04-03 20:13:55 +0000476Check read/write/execute permissions for this process or existence of
477file \var{path}. \var{mode} should be \constant{F_OK} to test the
478existence of \var{path}, or it can be the inclusive OR of one or more
479of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to test
480permissions. Return \code{1} if access is allowed, \code{0} if not.
481See the \UNIX{} man page \manpage{access}{2} for more information.
Fred Drake215fe2f1999-02-02 19:02:35 +0000482Availability: \UNIX{}.
483\end{funcdesc}
484
Fred Drake38e5d272000-04-03 20:13:55 +0000485\begin{datadesc}{F_OK}
486 Value to pass as the \var{mode} parameter of \function{access()} to
487 test the existence of \var{path}.
488\end{datadesc}
489
490\begin{datadesc}{R_OK}
491 Value to include in the \var{mode} parameter of \function{access()}
492 to test the readability of \var{path}.
493\end{datadesc}
494
495\begin{datadesc}{W_OK}
496 Value to include in the \var{mode} parameter of \function{access()}
497 to test the writability of \var{path}.
498\end{datadesc}
499
500\begin{datadesc}{X_OK}
501 Value to include in the \var{mode} parameter of \function{access()}
502 to determine if \var{path} can be executed.
503\end{datadesc}
504
Fred Drake6db897c1999-07-12 16:49:30 +0000505\begin{funcdesc}{chdir}{path}
506\index{directory!changing}
507Change the current working directory to \var{path}.
508Availability: Macintosh, \UNIX{}, Windows.
509\end{funcdesc}
510
511\begin{funcdesc}{getcwd}{}
512Return a string representing the current working directory.
513Availability: Macintosh, \UNIX{}, Windows.
514\end{funcdesc}
515
Fred Drake215fe2f1999-02-02 19:02:35 +0000516\begin{funcdesc}{chmod}{path, mode}
517Change the mode of \var{path} to the numeric \var{mode}.
518Availability: \UNIX{}, Windows.
519\end{funcdesc}
520
521\begin{funcdesc}{chown}{path, uid, gid}
522Change the owner and group id of \var{path} to the numeric \var{uid}
523and \var{gid}.
524Availability: \UNIX{}.
525\end{funcdesc}
526
527\begin{funcdesc}{link}{src, dst}
528Create a hard link pointing to \var{src} named \var{dst}.
529Availability: \UNIX{}.
530\end{funcdesc}
531
532\begin{funcdesc}{listdir}{path}
533Return a list containing the names of the entries in the directory.
534The list is in arbitrary order. It does not include the special
535entries \code{'.'} and \code{'..'} even if they are present in the
536directory.
537Availability: Macintosh, \UNIX{}, Windows.
538\end{funcdesc}
539
540\begin{funcdesc}{lstat}{path}
541Like \function{stat()}, but do not follow symbolic links.
542Availability: \UNIX{}.
543\end{funcdesc}
544
545\begin{funcdesc}{mkfifo}{path\optional{, mode}}
546Create a FIFO (a named pipe) named \var{path} with numeric mode
547\var{mode}. The default \var{mode} is \code{0666} (octal). The current
548umask value is first masked out from the mode.
549Availability: \UNIX{}.
550
551FIFOs are pipes that can be accessed like regular files. FIFOs exist
552until they are deleted (for example with \function{os.unlink()}).
553Generally, FIFOs are used as rendezvous between ``client'' and
554``server'' type processes: the server opens the FIFO for reading, and
555the client opens it for writing. Note that \function{mkfifo()}
556doesn't open the FIFO --- it just creates the rendezvous point.
557\end{funcdesc}
558
559\begin{funcdesc}{mkdir}{path\optional{, mode}}
560Create a directory named \var{path} with numeric mode \var{mode}.
561The default \var{mode} is \code{0777} (octal). On some systems,
562\var{mode} is ignored. Where it is used, the current umask value is
563first masked out.
564Availability: Macintosh, \UNIX{}, Windows.
565\end{funcdesc}
566
567\begin{funcdesc}{makedirs}{path\optional{, mode}}
568\index{directory!creating}
569Recursive directory creation function. Like \function{mkdir()},
570but makes all intermediate-level directories needed to contain the
571leaf directory. Throws an \exception{error} exception if the leaf
572directory already exists or cannot be created. The default \var{mode}
573is \code{0777} (octal).
574\versionadded{1.5.2}
575\end{funcdesc}
576
Fred Drake88f6ca21999-12-15 19:39:04 +0000577\begin{funcdesc}{pathconf}{path, name}
578Return system configration information relevant to a named file.
579\var{name} specifies the configuration value to retrieve; it may be a
580string which is the name of a defined system value; these names are
581specified in a number of standards (\POSIX.1, Unix95, Unix98, and
582others). Some platforms define additional names as well. The names
583known to the host operating system are given in the
584\code{pathconf_names} dictionary. For configuration variables not
585included in that mapping, passing an integer for \var{name} is also
586accepted.
587Availability: \UNIX{}.
588
589If \var{name} is a string and is not known, \exception{ValueError} is
590raised. If a specific value for \var{name} is not supported by the
591host system, even if it is included in \code{pathconf_names}, an
592\exception{OSError} is raised with \constant{errno.EINVAL} for the
593error number.
594\end{funcdesc}
595
596\begin{datadesc}{pathconf_names}
597Dictionary mapping names accepted by \function{pathconf()} and
598\function{fpathconf()} to the integer values defined for those names
599by the host operating system. This can be used to determine the set
600of names known to the system.
601Availability: \UNIX.
602\end{datadesc}
603
Fred Drake215fe2f1999-02-02 19:02:35 +0000604\begin{funcdesc}{readlink}{path}
605Return a string representing the path to which the symbolic link
606points.
607Availability: \UNIX{}.
608\end{funcdesc}
609
610\begin{funcdesc}{remove}{path}
611Remove the file \var{path}. See \function{rmdir()} below to remove a
612directory. This is identical to the \function{unlink()} function
613documented below.
614Availability: Macintosh, \UNIX{}, Windows.
615\end{funcdesc}
616
617\begin{funcdesc}{removedirs}{path}
618\index{directory!deleting}
619Recursive directory removal function. Works like
620\function{rmdir()} except that, if the leaf directory is
621successfully removed, directories corresponding to rightmost path
622segments will be pruned way until either the whole path is consumed or
623an error is raised (which is ignored, because it generally means that
624a parent directory is not empty). Throws an \exception{error}
625exception if the leaf directory could not be successfully removed.
626\versionadded{1.5.2}
627\end{funcdesc}
628
629\begin{funcdesc}{rename}{src, dst}
630Rename the file or directory \var{src} to \var{dst}.
631Availability: Macintosh, \UNIX{}, Windows.
632\end{funcdesc}
633
634\begin{funcdesc}{renames}{old, new}
635Recursive directory or file renaming function.
636Works like \function{rename()}, except creation of any intermediate
637directories needed to make the new pathname good is attempted first.
638After the rename, directories corresponding to rightmost path segments
639of the old name will be pruned away using \function{removedirs()}.
640
641Note: this function can fail with the new directory structure made if
642you lack permissions needed to remove the leaf directory or file.
643\versionadded{1.5.2}
644\end{funcdesc}
645
646\begin{funcdesc}{rmdir}{path}
647Remove the directory \var{path}.
648Availability: Macintosh, \UNIX{}, Windows.
649\end{funcdesc}
650
651\begin{funcdesc}{stat}{path}
652Perform a \cfunction{stat()} system call on the given path. The
653return value is a tuple of at least 10 integers giving the most
654important (and portable) members of the \emph{stat} structure, in the
655order
656\code{st_mode},
657\code{st_ino},
658\code{st_dev},
659\code{st_nlink},
660\code{st_uid},
661\code{st_gid},
662\code{st_size},
663\code{st_atime},
664\code{st_mtime},
665\code{st_ctime}.
666More items may be added at the end by some implementations.
667(On MS Windows, some items are filled with dummy values.)
668Availability: Macintosh, \UNIX{}, Windows.
669
670Note: The standard module \refmodule{stat}\refstmodindex{stat} defines
671functions and constants that are useful for extracting information
672from a \ctype{stat} structure.
673\end{funcdesc}
674
675\begin{funcdesc}{statvfs}{path}
676Perform a \cfunction{statvfs()} system call on the given path. The
Guido van Rossum0c9608c1999-02-03 16:32:37 +0000677return value is a tuple of 10 integers giving the most common
Fred Drake215fe2f1999-02-02 19:02:35 +0000678members of the \ctype{statvfs} structure, in the order
679\code{f_bsize},
680\code{f_frsize},
681\code{f_blocks},
682\code{f_bfree},
683\code{f_bavail},
684\code{f_files},
685\code{f_ffree},
686\code{f_favail},
Fred Drake215fe2f1999-02-02 19:02:35 +0000687\code{f_flag},
688\code{f_namemax}.
689Availability: \UNIX{}.
690
691Note: The standard module \module{statvfs}\refstmodindex{statvfs}
692defines constants that are useful for extracting information
693from a \ctype{statvfs} structure.
694\end{funcdesc}
695
696\begin{funcdesc}{symlink}{src, dst}
697Create a symbolic link pointing to \var{src} named \var{dst}.
698Availability: \UNIX{}.
699\end{funcdesc}
700
Fred Drake18f7a451999-12-09 22:11:43 +0000701\begin{funcdesc}{tempnam}{\optional{dir\optional{, prefix}}}
702Return a unique path name that is reasonable for creating a temporary
703file. This will be an absolute path that names a potential directory
704entry in the directory \var{dir} or a common location for temporary
705files if \var{dir} is omitted or \code{None}. If given and not
706\code{None}, \var{prefix} is used to provide a short prefix to the
707filename. Applications are responsible for properly creating and
708managing files created using paths returned by \function{tempnam()};
709no automatic cleanup is provided.
710\end{funcdesc}
711
712\begin{funcdesc}{tmpnam}{}
713Return a unique path name that is reasonable for creating a temporary
714file. This will be an absolute path that names a potential directory
715entry in a common location for temporary files. Applications are
716responsible for properly creating and managing files created using
717paths returned by \function{tmpnam()}; no automatic cleanup is
718provided.
719\end{funcdesc}
720
721\begin{datadesc}{TMP_MAX}
722The maximum number of unique names that \function{tmpnam()} will
723generate before reusing names.
724\end{datadesc}
725
Fred Drake215fe2f1999-02-02 19:02:35 +0000726\begin{funcdesc}{unlink}{path}
727Remove the file \var{path}. This is the same function as
728\function{remove()}; the \function{unlink()} name is its traditional
729\UNIX{} name.
730Availability: Macintosh, \UNIX{}, Windows.
731\end{funcdesc}
732
Barry Warsaw93a8eac2000-05-01 16:18:22 +0000733\begin{funcdesc}{utime}{path, times}
734Set the access and modified times of the file specified by \var{path}.
735If \var{times} is \code{None}, then the file's access and modified
736times are set to the current time. Otherwise, \var{times} must be a
Fred Drakee06d0252000-05-02 17:29:35 +00007372-tuple of numbers, of the form \code{(\var{atime}, \var{mtime})}
738which is used to set the access and modified times, respectively.
Fred Drake30f76ff2000-06-30 16:06:19 +0000739\versionchanged[added support for \code{None} for \var{times}]{2.0}
Fred Drake215fe2f1999-02-02 19:02:35 +0000740Availability: Macintosh, \UNIX{}, Windows.
741\end{funcdesc}
742
743
744\subsection{Process Management \label{os-process}}
745
Fred Drake18f7a451999-12-09 22:11:43 +0000746These functions may be used to create and manage processes.
Fred Drake215fe2f1999-02-02 19:02:35 +0000747
748
Fred Drake18f7a451999-12-09 22:11:43 +0000749\begin{funcdesc}{abort}{}
750Generate a \constant{SIGABRT} signal to the current process. On
751\UNIX, the default behavior is to produce a core dump; on Windows, the
752process immediately returns an exit code of \code{3}. Be aware that
753programs which use \function{signal.signal()} to register a handler
754for \constant{SIGABRT} will behave differently.
755Availability: \UNIX, Windows.
756\end{funcdesc}
757
Fred Drake215fe2f1999-02-02 19:02:35 +0000758\begin{funcdesc}{execl}{path, arg0, arg1, ...}
759This is equivalent to
760\samp{execv(\var{path}, (\var{arg0}, \var{arg1}, ...))}.
761Availability: \UNIX{}, Windows.
762\end{funcdesc}
763
764\begin{funcdesc}{execle}{path, arg0, arg1, ..., env}
765This is equivalent to
766\samp{execve(\var{path}, (\var{arg0}, \var{arg1}, ...), \var{env})}.
767Availability: \UNIX{}, Windows.
768\end{funcdesc}
769
770\begin{funcdesc}{execlp}{path, arg0, arg1, ...}
771This is equivalent to
772\samp{execvp(\var{path}, (\var{arg0}, \var{arg1}, ...))}.
773Availability: \UNIX{}, Windows.
774\end{funcdesc}
775
776\begin{funcdesc}{execv}{path, args}
777Execute the executable \var{path} with argument list \var{args},
778replacing the current process (i.e., the Python interpreter).
779The argument list may be a tuple or list of strings.
780Availability: \UNIX{}, Windows.
781\end{funcdesc}
782
783\begin{funcdesc}{execve}{path, args, env}
784Execute the executable \var{path} with argument list \var{args},
785and environment \var{env},
786replacing the current process (i.e., the Python interpreter).
787The argument list may be a tuple or list of strings.
788The environment must be a dictionary mapping strings to strings.
789Availability: \UNIX{}, Windows.
790\end{funcdesc}
791
792\begin{funcdesc}{execvp}{path, args}
793This is like \samp{execv(\var{path}, \var{args})} but duplicates
794the shell's actions in searching for an executable file in a list of
795directories. The directory list is obtained from
796\code{environ['PATH']}.
797Availability: \UNIX{}, Windows.
798\end{funcdesc}
799
800\begin{funcdesc}{execvpe}{path, args, env}
801This is a cross between \function{execve()} and \function{execvp()}.
802The directory list is obtained from \code{\var{env}['PATH']}.
803Availability: \UNIX{}, Windows.
804\end{funcdesc}
805
806\begin{funcdesc}{_exit}{n}
807Exit to the system with status \var{n}, without calling cleanup
808handlers, flushing stdio buffers, etc.
809Availability: \UNIX{}, Windows.
810
811Note: the standard way to exit is \code{sys.exit(\var{n})}.
812\function{_exit()} should normally only be used in the child process
813after a \function{fork()}.
814\end{funcdesc}
815
816\begin{funcdesc}{fork}{}
817Fork a child process. Return \code{0} in the child, the child's
818process id in the parent.
819Availability: \UNIX{}.
820\end{funcdesc}
821
Fred Drakec82634c2000-06-28 17:27:48 +0000822\begin{funcdesc}{forkpty}{}
823Fork a child process, using a new pseudo-terminal as the child's
824controlling terminal. Return a pair of \code{(\var{pid}, \var{fd})},
825where \var{pid} is \code{0} in the child, the new child's process id
826in the parent, and \code{fd} is the file descriptor of the master end
827of the pseudo-terminal. For a more portable approach, use the
828\refmodule{pty} module.
829Availability: Some flavors of \UNIX{}
830\end{funcdesc}
831
Fred Drake215fe2f1999-02-02 19:02:35 +0000832\begin{funcdesc}{kill}{pid, sig}
833\index{process!killing}
834\index{process!signalling}
835Kill the process \var{pid} with signal \var{sig}.
836Availability: \UNIX{}.
837\end{funcdesc}
838
839\begin{funcdesc}{nice}{increment}
840Add \var{increment} to the process's ``niceness''. Return the new
841niceness.
842Availability: \UNIX{}.
843\end{funcdesc}
844
845\begin{funcdesc}{plock}{op}
846Lock program segments into memory. The value of \var{op}
847(defined in \code{<sys/lock.h>}) determines which segments are locked.
Fred Drake39063631999-02-26 14:05:02 +0000848Availability: \UNIX{}.
Fred Drake215fe2f1999-02-02 19:02:35 +0000849\end{funcdesc}
850
851\begin{funcdesc}{spawnv}{mode, path, args}
852Execute the program \var{path} in a new process, passing the arguments
853specified in \var{args} as command-line parameters. \var{args} may be
854a list or a tuple. \var{mode} is a magic operational constant. See
855the Visual \Cpp{} Runtime Library documentation for further
Fred Drake22702081999-07-02 14:01:03 +0000856information; the constants are exposed to the Python programmer as
857listed below.
Fred Drake15861b22000-02-29 05:19:38 +0000858Availability: \UNIX{}, Windows.
Fred Drake215fe2f1999-02-02 19:02:35 +0000859\versionadded{1.5.2}
860\end{funcdesc}
861
862\begin{funcdesc}{spawnve}{mode, path, args, env}
863Execute the program \var{path} in a new process, passing the arguments
864specified in \var{args} as command-line parameters and the contents of
865the mapping \var{env} as the environment. \var{args} may be a list or
866a tuple. \var{mode} is a magic operational constant. See the Visual
Fred Drake22702081999-07-02 14:01:03 +0000867\Cpp{} Runtime Library documentation for further information; the
868constants are exposed to the Python programmer as listed below.
Fred Drake15861b22000-02-29 05:19:38 +0000869Availability: \UNIX{}, Windows.
Fred Drake215fe2f1999-02-02 19:02:35 +0000870\versionadded{1.5.2}
871\end{funcdesc}
872
Fred Drake9329e5e1999-02-16 19:40:19 +0000873\begin{datadesc}{P_WAIT}
874\dataline{P_NOWAIT}
875\dataline{P_NOWAITO}
Fred Drake215fe2f1999-02-02 19:02:35 +0000876Possible values for the \var{mode} parameter to \function{spawnv()}
877and \function{spawnve()}.
Fred Drake15861b22000-02-29 05:19:38 +0000878Availability: \UNIX{}, Windows.
879\versionadded{1.5.2}
880\end{datadesc}
881
882\begin{datadesc}{P_OVERLAY}
883\dataline{P_DETACH}
884Possible values for the \var{mode} parameter to \function{spawnv()}
885and \function{spawnve()}. These are less portable than those listed
886above.
Fred Drake215fe2f1999-02-02 19:02:35 +0000887Availability: Windows.
888\versionadded{1.5.2}
889\end{datadesc}
890
891\begin{funcdesc}{system}{command}
892Execute the command (a string) in a subshell. This is implemented by
893calling the Standard C function \cfunction{system()}, and has the
Fred Drakeec6baaf1999-04-21 18:13:31 +0000894same limitations. Changes to \code{posix.environ}, \code{sys.stdin},
Fred Drake215fe2f1999-02-02 19:02:35 +0000895etc.\ are not reflected in the environment of the executed command.
896The return value is the exit status of the process encoded in the
Fred Drake7a621281999-06-10 15:07:05 +0000897format specified for \function{wait()}, except on Windows 95 and 98,
Fred Drakea88ef001999-06-18 19:11:25 +0000898where it is always \code{0}. Note that \POSIX{} does not specify the
899meaning of the return value of the C \cfunction{system()} function,
900so the return value of the Python function is system-dependent.
Fred Drake215fe2f1999-02-02 19:02:35 +0000901Availability: \UNIX{}, Windows.
902\end{funcdesc}
903
904\begin{funcdesc}{times}{}
905Return a 5-tuple of floating point numbers indicating accumulated (CPU
906or other)
907times, in seconds. The items are: user time, system time, children's
908user time, children's system time, and elapsed real time since a fixed
Fred Drakeec6baaf1999-04-21 18:13:31 +0000909point in the past, in that order. See the \UNIX{} manual page
910\manpage{times}{2} or the corresponding Windows Platform API
911documentation.
Fred Drake215fe2f1999-02-02 19:02:35 +0000912Availability: \UNIX{}, Windows.
913\end{funcdesc}
914
915\begin{funcdesc}{wait}{}
916Wait for completion of a child process, and return a tuple containing
917its pid and exit status indication: a 16-bit number, whose low byte is
918the signal number that killed the process, and whose high byte is the
919exit status (if the signal number is zero); the high bit of the low
920byte is set if a core file was produced.
921Availability: \UNIX{}.
922\end{funcdesc}
923
924\begin{funcdesc}{waitpid}{pid, options}
Fred Drake31e5e371999-08-13 13:36:33 +0000925Wait for completion of a child process given by process id \var{pid},
926and return a tuple containing its process id and exit status
927indication (encoded as for \function{wait()}). The semantics of the
928call are affected by the value of the integer \var{options}, which
929should be \code{0} for normal operation.
Fred Drake215fe2f1999-02-02 19:02:35 +0000930Availability: \UNIX{}.
Fred Drake31e5e371999-08-13 13:36:33 +0000931
932If \var{pid} is greater than \code{0}, \function{waitpid()} requests
933status information for that specific process. If \var{pid} is
934\code{0}, the request is for the status of any child in the process
935group of the current process. If \var{pid} is \code{-1}, the request
936pertains to any child of the current process. If \var{pid} is less
937than \code{-1}, status is requested for any process in the process
938group \code{-\var{pid}} (the absolute value of \var{pid}).
Fred Drake215fe2f1999-02-02 19:02:35 +0000939\end{funcdesc}
940
941\begin{datadesc}{WNOHANG}
942The option for \function{waitpid()} to avoid hanging if no child
943process status is available immediately.
944Availability: \UNIX{}.
945\end{datadesc}
946
Fred Drake38e5d272000-04-03 20:13:55 +0000947The following functions take a process status code as returned by
948\function{system()}, \function{wait()}, or \function{waitpid()} as a
949parameter. They may be used to determine the disposition of a
950process.
Fred Drake215fe2f1999-02-02 19:02:35 +0000951
952\begin{funcdesc}{WIFSTOPPED}{status}
953Return true if the process has been stopped.
954Availability: \UNIX{}.
955\end{funcdesc}
956
957\begin{funcdesc}{WIFSIGNALED}{status}
958Return true if the process exited due to a signal.
959Availability: \UNIX{}.
960\end{funcdesc}
961
962\begin{funcdesc}{WIFEXITED}{status}
963Return true if the process exited using the \manpage{exit}{2} system
964call.
965Availability: \UNIX{}.
966\end{funcdesc}
967
968\begin{funcdesc}{WEXITSTATUS}{status}
969If \code{WIFEXITED(\var{status})} is true, return the integer
970parameter to the \manpage{exit}{2} system call. Otherwise, the return
971value is meaningless.
972Availability: \UNIX{}.
973\end{funcdesc}
974
975\begin{funcdesc}{WSTOPSIG}{status}
Fred Drake35c3ffd1999-03-04 14:08:10 +0000976Return the signal which caused the process to stop.
977Availability: \UNIX{}.
978\end{funcdesc}
979
980\begin{funcdesc}{WTERMSIG}{status}
Fred Drake215fe2f1999-02-02 19:02:35 +0000981Return the signal which caused the process to exit.
982Availability: \UNIX{}.
983\end{funcdesc}
984
985
Fred Drake88f6ca21999-12-15 19:39:04 +0000986\subsection{Miscellanenous System Information \label{os-path}}
987
988
989\begin{funcdesc}{confstr}{name}
990Return string-valued system configuration values.
991\var{name} specifies the configuration value to retrieve; it may be a
992string which is the name of a defined system value; these names are
993specified in a number of standards (\POSIX, Unix95, Unix98, and
994others). Some platforms define additional names as well. The names
995known to the host operating system are given in the
996\code{confstr_names} dictionary. For configuration variables not
997included in that mapping, passing an integer for \var{name} is also
998accepted.
999Availability: \UNIX{}.
1000
1001If the configuration value specified by \var{name} isn't defined, the
1002empty string is returned.
1003
1004If \var{name} is a string and is not known, \exception{ValueError} is
1005raised. If a specific value for \var{name} is not supported by the
1006host system, even if it is included in \code{confstr_names}, an
1007\exception{OSError} is raised with \constant{errno.EINVAL} for the
1008error number.
1009\end{funcdesc}
1010
1011\begin{datadesc}{confstr_names}
1012Dictionary mapping names accepted by \function{confstr()} to the
1013integer values defined for those names by the host operating system.
1014This can be used to determine the set of names known to the system.
1015Availability: \UNIX.
1016\end{datadesc}
1017
1018\begin{funcdesc}{sysconf}{name}
1019Return integer-valued system configuration values.
1020If the configuration value specified by \var{name} isn't defined,
1021\code{-1} is returned. The comments regarding the \var{name}
1022parameter for \function{confstr()} apply here as well; the dictionary
1023that provides information on the known names is given by
1024\code{sysconf_names}.
1025Availability: \UNIX{}.
1026\end{funcdesc}
1027
1028\begin{datadesc}{sysconf_names}
1029Dictionary mapping names accepted by \function{sysconf()} to the
1030integer values defined for those names by the host operating system.
1031This can be used to determine the set of names known to the system.
1032Availability: \UNIX.
1033\end{datadesc}
1034
Fred Drake215fe2f1999-02-02 19:02:35 +00001035
1036The follow data values are used to support path manipulation
1037operations. These are defined for all platforms.
1038
1039Higher-level operations on pathnames are defined in the
1040\refmodule{os.path} module.
1041
1042
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001043\begin{datadesc}{curdir}
1044The constant string used by the OS to refer to the current directory,
Fred Drake1a3c2a01998-08-06 15:18:23 +00001045e.g.\ \code{'.'} for \POSIX{} or \code{':'} for the Macintosh.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001046\end{datadesc}
1047
1048\begin{datadesc}{pardir}
1049The constant string used by the OS to refer to the parent directory,
Fred Drake1a3c2a01998-08-06 15:18:23 +00001050e.g.\ \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001051\end{datadesc}
1052
1053\begin{datadesc}{sep}
Guido van Rossumb2afc811997-08-29 22:37:44 +00001054The character used by the OS to separate pathname components,
Fred Drake1a3c2a01998-08-06 15:18:23 +00001055e.g.\ \character{/} for \POSIX{} or \character{:} for the Macintosh.
1056Note that knowing this is not sufficient to be able to parse or
1057concatenate pathnames --- use \function{os.path.split()} and
1058\function{os.path.join()} --- but it is occasionally useful.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001059\end{datadesc}
1060
Guido van Rossumb2afc811997-08-29 22:37:44 +00001061\begin{datadesc}{altsep}
1062An alternative character used by the OS to separate pathname components,
1063or \code{None} if only one separator character exists. This is set to
Fred Drake215fe2f1999-02-02 19:02:35 +00001064\character{/} on DOS and Windows systems where \code{sep} is a backslash.
Guido van Rossumb2afc811997-08-29 22:37:44 +00001065\end{datadesc}
1066
Guido van Rossum470be141995-03-17 16:07:09 +00001067\begin{datadesc}{pathsep}
1068The character conventionally used by the OS to separate search patch
Fred Drake1a3c2a01998-08-06 15:18:23 +00001069components (as in \envvar{PATH}), e.g.\ \character{:} for \POSIX{} or
Fred Drake215fe2f1999-02-02 19:02:35 +00001070\character{;} for DOS and Windows.
Guido van Rossum9c59ce91998-06-30 15:54:27 +00001071\end{datadesc}
1072
Guido van Rossum470be141995-03-17 16:07:09 +00001073\begin{datadesc}{defpath}
Fred Drake1a3c2a01998-08-06 15:18:23 +00001074The default search path used by \function{exec*p*()} if the environment
Guido van Rossum470be141995-03-17 16:07:09 +00001075doesn't have a \code{'PATH'} key.
1076\end{datadesc}
1077
Fred Drake215fe2f1999-02-02 19:02:35 +00001078\begin{datadesc}{linesep}
1079The string used to separate (or, rather, terminate) lines on the
Fred Drakeec6baaf1999-04-21 18:13:31 +00001080current platform. This may be a single character,
1081e.g.\ \code{'\e n'} for \POSIX{} or \code{'\e r'} for MacOS, or multiple
1082characters, e.g.\ \code{'\e r\e n'} for MS-DOS and MS Windows.
Fred Drake215fe2f1999-02-02 19:02:35 +00001083\end{datadesc}