diff options
author | cinap_lenrek <cinap_lenrek@localhost> | 2011-05-03 11:25:13 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@localhost> | 2011-05-03 11:25:13 +0000 |
commit | 458120dd40db6b4df55a4e96b650e16798ef06a0 (patch) | |
tree | 8f82685be24fef97e715c6f5ca4c68d34d5074ee /sys/src/cmd/python/Doc/lib/libposix.tex | |
parent | 3a742c699f6806c1145aea5149bf15de15a0afd7 (diff) |
add hg and python
Diffstat (limited to 'sys/src/cmd/python/Doc/lib/libposix.tex')
-rw-r--r-- | sys/src/cmd/python/Doc/lib/libposix.tex | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/sys/src/cmd/python/Doc/lib/libposix.tex b/sys/src/cmd/python/Doc/lib/libposix.tex new file mode 100644 index 000000000..aee6c0db3 --- /dev/null +++ b/sys/src/cmd/python/Doc/lib/libposix.tex @@ -0,0 +1,97 @@ +\section{\module{posix} --- + The most common \POSIX{} system calls} + +\declaremodule{builtin}{posix} + \platform{Unix} +\modulesynopsis{The most common \POSIX\ system calls (normally used + via module \refmodule{os}).} + + +This module provides access to operating system functionality that is +standardized by the C Standard and the \POSIX{} standard (a thinly +disguised \UNIX{} interface). + +\strong{Do not import this module directly.} Instead, import the +module \refmodule{os}, which provides a \emph{portable} version of this +interface. On \UNIX, the \refmodule{os} module provides a superset of +the \module{posix} interface. On non-\UNIX{} operating systems the +\module{posix} module is not available, but a subset is always +available through the \refmodule{os} interface. Once \refmodule{os} is +imported, there is \emph{no} performance penalty in using it instead +of \module{posix}. In addition, \refmodule{os}\refstmodindex{os} +provides some additional functionality, such as automatically calling +\function{putenv()} when an entry in \code{os.environ} is changed. + +The descriptions below are very terse; refer to the corresponding +\UNIX{} manual (or \POSIX{} documentation) entry for more information. +Arguments called \var{path} refer to a pathname given as a string. + +Errors are reported as exceptions; the usual exceptions are given for +type errors, while errors reported by the system calls raise +\exception{error} (a synonym for the standard exception +\exception{OSError}), described below. + + +\subsection{Large File Support \label{posix-large-files}} +\sectionauthor{Steve Clift}{clift@mail.anacapa.net} +\index{large files} +\index{file!large files} + + +Several operating systems (including AIX, HPUX, Irix and Solaris) +provide support for files that are larger than 2 Gb from a C +programming model where \ctype{int} and \ctype{long} are 32-bit +values. This is typically accomplished by defining the relevant size +and offset types as 64-bit values. Such files are sometimes referred +to as \dfn{large files}. + +Large file support is enabled in Python when the size of an +\ctype{off_t} is larger than a \ctype{long} and the \ctype{long long} +type is available and is at least as large as an \ctype{off_t}. Python +longs are then used to represent file sizes, offsets and other values +that can exceed the range of a Python int. It may be necessary to +configure and compile Python with certain compiler flags to enable +this mode. For example, it is enabled by default with recent versions +of Irix, but with Solaris 2.6 and 2.7 you need to do something like: + +\begin{verbatim} +CFLAGS="`getconf LFS_CFLAGS`" OPT="-g -O2 $CFLAGS" \ + ./configure +\end{verbatim} % $ <-- bow to font-lock + +On large-file-capable Linux systems, this might work: + +\begin{verbatim} +CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' OPT="-g -O2 $CFLAGS" \ + ./configure +\end{verbatim} % $ <-- bow to font-lock + + +\subsection{Module Contents \label{posix-contents}} + + +Module \module{posix} defines the following data item: + +\begin{datadesc}{environ} +A dictionary representing the string environment at the time the +interpreter was started. For example, \code{environ['HOME']} is the +pathname of your home directory, equivalent to +\code{getenv("HOME")} in C. + +Modifying this dictionary does not affect the string environment +passed on by \function{execv()}, \function{popen()} or +\function{system()}; if you need to change the environment, pass +\code{environ} to \function{execve()} or add variable assignments and +export statements to the command string for \function{system()} or +\function{popen()}. + +\note{The \refmodule{os} module provides an alternate +implementation of \code{environ} which updates the environment on +modification. Note also that updating \code{os.environ} will render +this dictionary obsolete. Use of the \refmodule{os} module version of +this is recommended over direct access to the \module{posix} module.} +\end{datadesc} + +Additional contents of this module should only be accessed via the +\refmodule{os} module; refer to the documentation for that module for +further information. |