blob: df933c530d958b53c8f3dd9789efec575ca5fdef [file] [log] [blame]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001\section{Built-in Module \sectcode{posix}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-posix}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00003\bimodindex{posix}
4
5This module provides access to operating system functionality that is
Guido van Rossum6bb1adc1995-03-13 10:03:32 +00006standardized by the C Standard and the POSIX standard (a thinly disguised
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00007\UNIX{} interface).
Guido van Rossum470be141995-03-17 16:07:09 +00008
9\strong{Do not import this module directly.} Instead, import the
10module \code{os}, which provides a \emph{portable} version of this
11interface. On \UNIX{}, the \code{os} module provides a superset of
12the \code{posix} interface. On non-\UNIX{} operating systems the
13\code{posix} module is not available, but a subset is always available
14through the \code{os} interface. Once \code{os} is imported, there is
15\emph{no} performance penalty in using it instead of
Guido van Rossum9c43c591997-08-08 21:05:09 +000016\code{posix}. In addition, \code{os} provides some additional
17functionality, such as automatically calling \code{putenv()}
18when an entry is \code{os.environ} is changed.
Guido van Rossum470be141995-03-17 16:07:09 +000019\stmodindex{os}
20
Guido van Rossum282290f1997-08-27 14:54:25 +000021The descriptions below are very terse; refer to the corresponding
22\UNIX{} manual (or POSIX documentation) entry for more information.
23Arguments called \var{path} refer to a pathname given as a string.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000024
25Errors are reported as exceptions; the usual exceptions are given
26for type errors, while errors reported by the system calls raise
27\code{posix.error}, described below.
28
29Module \code{posix} defines the following data items:
30
31\renewcommand{\indexsubitem}{(data in module posix)}
32\begin{datadesc}{environ}
33A dictionary representing the string environment at the time
34the interpreter was started.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000035For example,
36\code{posix.environ['HOME']}
37is the pathname of your home directory, equivalent to
38\code{getenv("HOME")}
39in C.
Guido van Rossum9c43c591997-08-08 21:05:09 +000040
Guido van Rossum470be141995-03-17 16:07:09 +000041Modifying this dictionary does not affect the string environment
42passed on by \code{execv()}, \code{popen()} or \code{system()}; if you
43need to change the environment, pass \code{environ} to \code{execve()}
44or add variable assignments and export statements to the command
Guido van Rossum9c43c591997-08-08 21:05:09 +000045string for \code{system()} or \code{popen()}.
46
47\emph{However:} If you are using this module via the \code{os} module
48(as you should -- see the introduction above), \code{environ} is a
49a mapping object that behaves almost like a dictionary but invokes
50\code{putenv()} automatically called whenever an item is changed.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000051\end{datadesc}
52
53\renewcommand{\indexsubitem}{(exception in module posix)}
54\begin{excdesc}{error}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000055This exception is raised when a POSIX function returns a
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000056POSIX-related error (e.g., not for illegal argument types). Its
57string value is \code{'posix.error'}. The accompanying value is a
58pair containing the numeric error code from \code{errno} and the
59corresponding string, as would be printed by the C function
60\code{perror()}.
61\end{excdesc}
62
Guido van Rossum4bbe9c01995-03-30 16:00:36 +000063It defines the following functions and constants:
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000064
65\renewcommand{\indexsubitem}{(in module posix)}
66\begin{funcdesc}{chdir}{path}
67Change the current working directory to \var{path}.
68\end{funcdesc}
69
70\begin{funcdesc}{chmod}{path\, mode}
71Change the mode of \var{path} to the numeric \var{mode}.
72\end{funcdesc}
73
Guido van Rossum31cce971995-01-04 19:17:34 +000074\begin{funcdesc}{chown}{path\, uid, gid}
75Change the owner and group id of \var{path} to the numeric \var{uid}
76and \var{gid}.
77(Not on MS-DOS.)
78\end{funcdesc}
79
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000080\begin{funcdesc}{close}{fd}
81Close file descriptor \var{fd}.
Guido van Rossum28379701995-01-12 12:38:22 +000082
83Note: this function is intended for low-level I/O and must be applied
84to a file descriptor as returned by \code{posix.open()} or
85\code{posix.pipe()}. To close a ``file object'' returned by the
86built-in function \code{open} or by \code{posix.popen} or
87\code{posix.fdopen}, use its \code{close()} method.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000088\end{funcdesc}
89
90\begin{funcdesc}{dup}{fd}
91Return a duplicate of file descriptor \var{fd}.
92\end{funcdesc}
93
94\begin{funcdesc}{dup2}{fd\, fd2}
95Duplicate file descriptor \var{fd} to \var{fd2}, closing the latter
96first if necessary. Return \code{None}.
97\end{funcdesc}
98
99\begin{funcdesc}{execv}{path\, args}
100Execute the executable \var{path} with argument list \var{args},
101replacing the current process (i.e., the Python interpreter).
102The argument list may be a tuple or list of strings.
103(Not on MS-DOS.)
104\end{funcdesc}
105
106\begin{funcdesc}{execve}{path\, args\, env}
107Execute the executable \var{path} with argument list \var{args},
108and environment \var{env},
109replacing the current process (i.e., the Python interpreter).
110The argument list may be a tuple or list of strings.
111The environment must be a dictionary mapping strings to strings.
112(Not on MS-DOS.)
113\end{funcdesc}
114
115\begin{funcdesc}{_exit}{n}
116Exit to the system with status \var{n}, without calling cleanup
117handlers, flushing stdio buffers, etc.
118(Not on MS-DOS.)
119
120Note: the standard way to exit is \code{sys.exit(\var{n})}.
121\code{posix._exit()} should normally only be used in the child process
122after a \code{fork()}.
123\end{funcdesc}
124
Guido van Rossum28379701995-01-12 12:38:22 +0000125\begin{funcdesc}{fdopen}{fd\optional{\, mode\optional{\, bufsize}}}
126Return an open file object connected to the file descriptor \var{fd}.
127The \var{mode} and \var{bufsize} arguments have the same meaning as
128the corresponding arguments to the built-in \code{open()} function.
Guido van Rossumc5c67bc1994-02-15 15:59:23 +0000129\end{funcdesc}
130
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000131\begin{funcdesc}{fork}{}
132Fork a child process. Return 0 in the child, the child's process id
133in the parent.
134(Not on MS-DOS.)
135\end{funcdesc}
136
137\begin{funcdesc}{fstat}{fd}
138Return status for file descriptor \var{fd}, like \code{stat()}.
139\end{funcdesc}
140
Guido van Rossumf967bf61997-06-02 17:28:51 +0000141\begin{funcdesc}{ftruncate}{fd\, length}
142Truncate the file corresponding to file descriptor \var{fd},
143so that it is at most \var{length} bytes in size.
144\end{funcdesc}
145
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000146\begin{funcdesc}{getcwd}{}
147Return a string representing the current working directory.
148\end{funcdesc}
149
150\begin{funcdesc}{getegid}{}
151Return the current process's effective group id.
152(Not on MS-DOS.)
153\end{funcdesc}
154
155\begin{funcdesc}{geteuid}{}
156Return the current process's effective user id.
157(Not on MS-DOS.)
158\end{funcdesc}
159
160\begin{funcdesc}{getgid}{}
161Return the current process's group id.
162(Not on MS-DOS.)
163\end{funcdesc}
164
Guido van Rossum1e8b63e1996-06-26 19:22:46 +0000165\begin{funcdesc}{getpgrp}{}
166Return the current process group id.
167(Not on MS-DOS.)
168\end{funcdesc}
169
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000170\begin{funcdesc}{getpid}{}
171Return the current process id.
172(Not on MS-DOS.)
173\end{funcdesc}
174
175\begin{funcdesc}{getppid}{}
176Return the parent's process id.
177(Not on MS-DOS.)
178\end{funcdesc}
179
180\begin{funcdesc}{getuid}{}
181Return the current process's user id.
182(Not on MS-DOS.)
183\end{funcdesc}
184
185\begin{funcdesc}{kill}{pid\, sig}
186Kill the process \var{pid} with signal \var{sig}.
187(Not on MS-DOS.)
188\end{funcdesc}
189
190\begin{funcdesc}{link}{src\, dst}
191Create a hard link pointing to \var{src} named \var{dst}.
192(Not on MS-DOS.)
193\end{funcdesc}
194
195\begin{funcdesc}{listdir}{path}
196Return a list containing the names of the entries in the directory.
Guido van Rossum8c07bb41996-02-12 23:16:08 +0000197The list is in arbitrary order. It does not include the special
198entries \code{'.'} and \code{'..'} even if they are present in the
199directory.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000200\end{funcdesc}
201
202\begin{funcdesc}{lseek}{fd\, pos\, how}
203Set the current position of file descriptor \var{fd} to position
204\var{pos}, modified by \var{how}: 0 to set the position relative to
205the beginning of the file; 1 to set it relative to the current
206position; 2 to set it relative to the end of the file.
207\end{funcdesc}
208
209\begin{funcdesc}{lstat}{path}
210Like \code{stat()}, but do not follow symbolic links. (On systems
211without symbolic links, this is identical to \code{posix.stat}.)
212\end{funcdesc}
213
Guido van Rossum1e8b63e1996-06-26 19:22:46 +0000214\begin{funcdesc}{mkfifo}{path\optional{\, mode}}
215Create a FIFO (a POSIX named pipe) named \var{path} with numeric mode
216\var{mode}. The default \var{mode} is 0666 (octal). The current
217umask value is first masked out from the mode.
218(Not on MS-DOS.)
219
220FIFOs are pipes that can be accessed like regular files. FIFOs exist
221until they are deleted (for example with \code{os.unlink}).
222Generally, FIFOs are used as rendez-vous between ``client'' and
223``server'' type processes: the server opens the FIFO for reading, and
224the client opens it for writing. Note that \code{mkfifo()} doesn't
225open the FIFO -- it just creates the rendez-vous point.
226\end{funcdesc}
227
228\begin{funcdesc}{mkdir}{path\optional{\, mode}}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000229Create a directory named \var{path} with numeric mode \var{mode}.
Guido van Rossum1e8b63e1996-06-26 19:22:46 +0000230The default \var{mode} is 0777 (octal). On some systems, \var{mode}
231is ignored. Where it is used, the current umask value is first
232masked out.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000233\end{funcdesc}
234
235\begin{funcdesc}{nice}{increment}
236Add \var{incr} to the process' ``niceness''. Return the new niceness.
237(Not on MS-DOS.)
238\end{funcdesc}
239
Barry Warsawfa5a6cf1996-12-19 22:38:56 +0000240\begin{funcdesc}{open}{file\, flags\optional{\, mode}}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000241Open the file \var{file} and set various flags according to
242\var{flags} and possibly its mode according to \var{mode}.
Barry Warsawfa5a6cf1996-12-19 22:38:56 +0000243The default \var{mode} is 0777 (octal), and the current umask value is
244first masked out. Return the file descriptor for the newly opened
245file.
Guido van Rossum28379701995-01-12 12:38:22 +0000246
Guido van Rossum9c43c591997-08-08 21:05:09 +0000247For a description of the flag and mode values, see the \UNIX{} or C
248run-time documentation; flag constants (like \code{O_RDONLY} and
249\code{O_WRONLY}) are defined in this module too (see below).
250
Guido van Rossum28379701995-01-12 12:38:22 +0000251Note: this function is intended for low-level I/O. For normal usage,
252use the built-in function \code{open}, which returns a ``file object''
253with \code{read()} and \code{write()} methods (and many more).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000254\end{funcdesc}
255
256\begin{funcdesc}{pipe}{}
257Create a pipe. Return a pair of file descriptors \code{(r, w)}
258usable for reading and writing, respectively.
259(Not on MS-DOS.)
260\end{funcdesc}
261
Guido van Rossum38e50881996-07-21 02:21:49 +0000262\begin{funcdesc}{plock}{op}
263Lock program segments into memory. The value of \var{op}
264(defined in \code{<sys/lock.h>}) determines which segments are locked.
265(Not on MS-DOS.)
266\end{funcdesc}
267
Guido van Rossum28379701995-01-12 12:38:22 +0000268\begin{funcdesc}{popen}{command\optional{\, mode\optional{\, bufsize}}}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000269Open a pipe to or from \var{command}. The return value is an open
270file object connected to the pipe, which can be read or written
Guido van Rossum28379701995-01-12 12:38:22 +0000271depending on whether \var{mode} is \code{'r'} (default) or \code{'w'}.
272The \var{bufsize} argument has the same meaning as the corresponding
Guido van Rossum7e691de1997-05-09 02:22:59 +0000273argument to the built-in \code{open()} function. The exit status of
274the command (encoded in the format specified for \code{wait()}) is
275available as the return value of the \code{close()} method of the file
276object.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000277(Not on MS-DOS.)
278\end{funcdesc}
279
Guido van Rossumf967bf61997-06-02 17:28:51 +0000280\begin{funcdesc}{putenv}{varname\, value}
281Set the environment variable named \var{varname} to the string \var{value}.
282Such changes to the environment affect
283subprocesses started with \code{os.system()}, \code{os.popen()} or
284\code{os.fork()} and \code{os.execv()}. (Not on all systems.)
285
286When \code{putenv()} is
287supported, assignments to items in \code{os.environ} are automatically
288translated into corresponding calls to \code{os.putenv()}; however,
289calls to \code{os.putenv()} don't update \code{os.environ}, so it is
290actually preferable to assign to items of \code{os.environ}.
291\end{funcdesc}
292
Guido van Rossum0bfd1461997-10-05 18:54:52 +0000293\begin{funcdesc}{strerror}{code}
294Return the error message corresponding to the error code in \var{code}.
295\end{funcdesc}
296
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000297\begin{funcdesc}{read}{fd\, n}
298Read at most \var{n} bytes from file descriptor \var{fd}.
299Return a string containing the bytes read.
Guido van Rossum28379701995-01-12 12:38:22 +0000300
301Note: this function is intended for low-level I/O and must be applied
302to a file descriptor as returned by \code{posix.open()} or
303\code{posix.pipe()}. To read a ``file object'' returned by the
304built-in function \code{open} or by \code{posix.popen} or
305\code{posix.fdopen}, or \code{sys.stdin}, use its
306\code{read()} or \code{readline()} methods.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000307\end{funcdesc}
308
309\begin{funcdesc}{readlink}{path}
310Return a string representing the path to which the symbolic link
311points. (On systems without symbolic links, this always raises
312\code{posix.error}.)
313\end{funcdesc}
314
Guido van Rossum8c07bb41996-02-12 23:16:08 +0000315\begin{funcdesc}{remove}{path}
316Remove the file \var{path}. See \code{rmdir} below to remove a directory.
Guido van Rossumf967bf61997-06-02 17:28:51 +0000317This is identical to the \code{unlink} function documented below.
Guido van Rossum8c07bb41996-02-12 23:16:08 +0000318\end{funcdesc}
319
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000320\begin{funcdesc}{rename}{src\, dst}
321Rename the file or directory \var{src} to \var{dst}.
322\end{funcdesc}
323
324\begin{funcdesc}{rmdir}{path}
325Remove the directory \var{path}.
326\end{funcdesc}
327
328\begin{funcdesc}{setgid}{gid}
329Set the current process's group id.
330(Not on MS-DOS.)
331\end{funcdesc}
332
Guido van Rossum1e8b63e1996-06-26 19:22:46 +0000333\begin{funcdesc}{setpgrp}{}
334Calls the system call \code{setpgrp()} or \code{setpgrp(0, 0)}
Fred Drake4b3f0311996-12-13 22:04:31 +0000335depending on which version is implemented (if any). See the \UNIX{}
Guido van Rossum1e8b63e1996-06-26 19:22:46 +0000336manual for the semantics.
337(Not on MS-DOS.)
338\end{funcdesc}
339
340\begin{funcdesc}{setpgid}{pid\, pgrp}
Fred Drake4b3f0311996-12-13 22:04:31 +0000341Calls the system call \code{setpgid()}. See the \UNIX{} manual for
Guido van Rossum1e8b63e1996-06-26 19:22:46 +0000342the semantics.
343(Not on MS-DOS.)
344\end{funcdesc}
345
346\begin{funcdesc}{setsid}{}
Fred Drake4b3f0311996-12-13 22:04:31 +0000347Calls the system call \code{setsid()}. See the \UNIX{} manual for the
Guido van Rossum1e8b63e1996-06-26 19:22:46 +0000348semantics.
349(Not on MS-DOS.)
350\end{funcdesc}
351
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000352\begin{funcdesc}{setuid}{uid}
353Set the current process's user id.
354(Not on MS-DOS.)
355\end{funcdesc}
356
357\begin{funcdesc}{stat}{path}
358Perform a {\em stat} system call on the given path. The return value
359is a tuple of at least 10 integers giving the most important (and
360portable) members of the {\em stat} structure, in the order
361\code{st_mode},
362\code{st_ino},
363\code{st_dev},
364\code{st_nlink},
365\code{st_uid},
366\code{st_gid},
367\code{st_size},
368\code{st_atime},
369\code{st_mtime},
370\code{st_ctime}.
371More items may be added at the end by some implementations.
372(On MS-DOS, some items are filled with dummy values.)
373
374Note: The standard module \code{stat} defines functions and constants
375that are useful for extracting information from a stat structure.
376\end{funcdesc}
377
378\begin{funcdesc}{symlink}{src\, dst}
379Create a symbolic link pointing to \var{src} named \var{dst}. (On
380systems without symbolic links, this always raises
381\code{posix.error}.)
382\end{funcdesc}
383
384\begin{funcdesc}{system}{command}
385Execute the command (a string) in a subshell. This is implemented by
386calling the Standard C function \code{system()}, and has the same
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000387limitations. Changes to \code{posix.environ}, \code{sys.stdin} etc.\ are
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000388not reflected in the environment of the executed command. The return
Guido van Rossum7e691de1997-05-09 02:22:59 +0000389value is the exit status of the process encoded in the format
390specified for \code{wait()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000391\end{funcdesc}
392
Guido van Rossum1e8b63e1996-06-26 19:22:46 +0000393\begin{funcdesc}{tcgetpgrp}{fd}
394Return the process group associated with the terminal given by
395\var{fd} (an open file descriptor as returned by \code{posix.open()}).
396(Not on MS-DOS.)
397\end{funcdesc}
398
399\begin{funcdesc}{tcsetpgrp}{fd\, pg}
400Set the process group associated with the terminal given by
401\var{fd} (an open file descriptor as returned by \code{posix.open()})
402to \var{pg}.
403(Not on MS-DOS.)
404\end{funcdesc}
405
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000406\begin{funcdesc}{times}{}
Guido van Rossum1e150611995-09-13 17:36:35 +0000407Return a 5-tuple of floating point numbers indicating accumulated (CPU
408or other)
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000409times, in seconds. The items are: user time, system time, children's
Guido van Rossum1e150611995-09-13 17:36:35 +0000410user time, children's system time, and elapsed real time since a fixed
411point in the past, in that order. See the \UNIX{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000412manual page {\it times}(2). (Not on MS-DOS.)
413\end{funcdesc}
414
415\begin{funcdesc}{umask}{mask}
416Set the current numeric umask and returns the previous umask.
417(Not on MS-DOS.)
418\end{funcdesc}
419
420\begin{funcdesc}{uname}{}
421Return a 5-tuple containing information identifying the current
422operating system. The tuple contains 5 strings:
423\code{(\var{sysname}, \var{nodename}, \var{release}, \var{version}, \var{machine})}.
424Some systems truncate the nodename to 8
Guido van Rossum6bb1adc1995-03-13 10:03:32 +0000425characters or to the leading component; a better way to get the
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000426hostname is \code{socket.gethostname()}. (Not on MS-DOS, nor on older
427\UNIX{} systems.)
428\end{funcdesc}
429
430\begin{funcdesc}{unlink}{path}
Guido van Rossum8c07bb41996-02-12 23:16:08 +0000431Remove the file \var{path}. This is the same function as \code{remove};
432the \code{unlink} name is its traditional \UNIX{} name.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000433\end{funcdesc}
434
Fred Drake455838a1997-06-06 21:57:35 +0000435\begin{funcdesc}{utime}{path\, {\rm (}atime, mtime{\rm )}}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000436Set the access and modified time of the file to the given values.
437(The second argument is a tuple of two items.)
438\end{funcdesc}
439
440\begin{funcdesc}{wait}{}
441Wait for completion of a child process, and return a tuple containing
Guido van Rossum7e691de1997-05-09 02:22:59 +0000442its pid and exit status indication: a 16-bit number, whose low byte is
443the signal number that killed the process, and whose high byte is the
444exit status (if the signal number is zero); the high bit of the low
445byte is set if a core file was produced. (Not on MS-DOS.)
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000446\end{funcdesc}
447
448\begin{funcdesc}{waitpid}{pid\, options}
449Wait for completion of a child process given by proces id, and return
Guido van Rossum7e691de1997-05-09 02:22:59 +0000450a tuple containing its pid and exit status indication (encoded as for
451\code{wait()}). The semantics of the call are affected by the value of
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000452the integer options, which should be 0 for normal operation. (If the
Guido van Rossum96628a91995-04-10 11:34:00 +0000453system does not support \code{waitpid()}, this always raises
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000454\code{posix.error}. Not on MS-DOS.)
455\end{funcdesc}
456
457\begin{funcdesc}{write}{fd\, str}
458Write the string \var{str} to file descriptor \var{fd}.
459Return the number of bytes actually written.
Guido van Rossum28379701995-01-12 12:38:22 +0000460
461Note: this function is intended for low-level I/O and must be applied
462to a file descriptor as returned by \code{posix.open()} or
463\code{posix.pipe()}. To write a ``file object'' returned by the
464built-in function \code{open} or by \code{posix.popen} or
465\code{posix.fdopen}, or \code{sys.stdout} or \code{sys.stderr}, use
466its \code{write()} method.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000467\end{funcdesc}
Guido van Rossum4bbe9c01995-03-30 16:00:36 +0000468
469\begin{datadesc}{WNOHANG}
470The option for \code{waitpid()} to avoid hanging if no child process
471status is available immediately.
472\end{datadesc}
Barry Warsawe5a43a41996-12-19 23:50:34 +0000473
474
475\begin{datadesc}{O_RDONLY}
476\end{datadesc}
477\begin{datadesc}{O_WRONLY}
478\end{datadesc}
479\begin{datadesc}{O_RDWR}
480\end{datadesc}
481\begin{datadesc}{O_NDELAY}
482\end{datadesc}
483\begin{datadesc}{O_NONBLOCK}
484\end{datadesc}
485\begin{datadesc}{O_APPEND}
486\end{datadesc}
487\begin{datadesc}{O_DSYNC}
488\end{datadesc}
489\begin{datadesc}{O_RSYNC}
490\end{datadesc}
491\begin{datadesc}{O_SYNC}
492\end{datadesc}
493\begin{datadesc}{O_NOCTTY}
494\end{datadesc}
495\begin{datadesc}{O_CREAT}
496\end{datadesc}
497\begin{datadesc}{O_EXCL}
498\end{datadesc}
499\begin{datadesc}{O_TRUNC}
500Options for the \code{flag} argument to the \code{open()} function.
501These can be bit-wise OR'd together.
502\end{datadesc}