[Python-checkins] CVS: python/dist/src/Doc/lib libos.tex,1.76,1.77

Tim Peters tim_one@users.sourceforge.net
Fri, 01 Feb 2002 03:27:45 -0800


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv3161/python/Doc/lib

Modified Files:
	libos.tex 
Log Message:
Implement os.waitpid() for Windows, in a way that's compatible with Linux
where their capabilities intersect.  Would be nice if people using non-
MSVC compilers (Borland etc) took a whack at doing something similar for
them (this code relies on the MS _cwait function).


Index: libos.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** libos.tex	2002/01/30 05:49:46	1.76
--- libos.tex	2002/02/01 11:27:43	1.77
***************
*** 97,101 ****
  
  If \function{putenv()} is not provided, this mapping may be passed to
! the appropriate process-creation functions to cause child processes to 
  use a modified environment.
  \end{datadesc}
--- 97,101 ----
  
  If \function{putenv()} is not provided, this mapping may be passed to
! the appropriate process-creation functions to cause child processes to
  use a modified environment.
  \end{datadesc}
***************
*** 185,189 ****
  translated into corresponding calls to \function{putenv()}; however,
  calls to \function{putenv()} don't update \code{os.environ}, so it is
! actually preferable to assign to items of \code{os.environ}.  
  \end{funcdesc}
  
--- 185,189 ----
  translated into corresponding calls to \function{putenv()}; however,
  calls to \function{putenv()} don't update \code{os.environ}, so it is
! actually preferable to assign to items of \code{os.environ}.
  \end{funcdesc}
  
***************
*** 414,418 ****
  
  \begin{funcdesc}{ftruncate}{fd, length}
! Truncate the file corresponding to file descriptor \var{fd}, 
  so that it is at most \var{length} bytes in size.
  Availability: \UNIX.
--- 414,418 ----
  
  \begin{funcdesc}{ftruncate}{fd, length}
! Truncate the file corresponding to file descriptor \var{fd},
  so that it is at most \var{length} bytes in size.
  Availability: \UNIX.
***************
*** 910,914 ****
  \begin{funcdesc}{abort}{}
  Generate a \constant{SIGABRT} signal to the current process.  On
! \UNIX, the default behavior is to produce a core dump; on Windows, the 
  process immediately returns an exit code of \code{3}.  Be aware that
  programs which use \function{signal.signal()} to register a handler
--- 910,914 ----
  \begin{funcdesc}{abort}{}
  Generate a \constant{SIGABRT} signal to the current process.  On
! \UNIX, the default behavior is to produce a core dump; on Windows, the
  process immediately returns an exit code of \code{3}.  Be aware that
  programs which use \function{signal.signal()} to register a handler
***************
*** 1167,1170 ****
--- 1167,1173 ----
  
  \begin{funcdesc}{waitpid}{pid, options}
+ The details of this function differ on \UNIX and Windows.
+ 
+ On \UNIX:
  Wait for completion of a child process given by process id \var{pid},
  and return a tuple containing its process id and exit status
***************
*** 1172,1176 ****
  call are affected by the value of the integer \var{options}, which
  should be \code{0} for normal operation.
- Availability: \UNIX.
  
  If \var{pid} is greater than \code{0}, \function{waitpid()} requests
--- 1175,1178 ----
***************
*** 1181,1184 ****
--- 1183,1199 ----
  than \code{-1}, status is requested for any process in the process
  group \code{-\var{pid}} (the absolute value of \var{pid}).
+ 
+ On Windows:
+ Wait for completion of a process given by process id \var{pid},
+ and return a tuple containing \var{pid},
+ and its exit status shifted left by 8 bits (shifting makes cross-platform
+ use of the function easier).
+ A \var{pid} less than or equal to \code{0} has no special meaning on
+ Windows, and raises an exception.
+ The value of integer \var{options} has no effect.
+ \var{pid} can refer to any process whose id is known, not necessarily a
+ child process.
+ The \function{spawn()} functions called with \constant{P_NOWAIT}
+ return suitable process ids.
  \end{funcdesc}
  
***************
*** 1212,1216 ****
  \begin{funcdesc}{WEXITSTATUS}{status}
  If \code{WIFEXITED(\var{status})} is true, return the integer
! parameter to the \manpage{exit}{2} system call.  Otherwise, the return 
  value is meaningless.
  Availability: \UNIX.
--- 1227,1231 ----
  \begin{funcdesc}{WEXITSTATUS}{status}
  If \code{WIFEXITED(\var{status})} is true, return the integer
! parameter to the \manpage{exit}{2} system call.  Otherwise, the return
  value is meaningless.
  Availability: \UNIX.