/* begincopyright Copyright (c) 1988 Xerox Corporation. All rights reserved. Use and copying of this software and preparation of derivative works based upon this software are permitted. Any distribution of this software or derivative works must comply with all applicable United States export control laws. This software is made available AS IS, and Xerox Corporation makes no warranty about the software, its performance or its conformity to any specification. Any person obtaining a copy of this software is requested to send their name and post office or electronic mail address to: PCR Coordinator Xerox PARC 3333 Coyote Hill Rd. Palo Alto, CA 94304 endcopyright */ /* * PCR←Exec.h * * CHauser, August 31, 1993 * $Id$ $Date$ * * Basic public type definitions for PCR Exec * */ #ifndef ←←PCR←Exec←h #define ←←PCR←Exec←h 1 #include <config/PCR←Arch.h> #include <config/PCR←StdDefs.h> #include <th/PCR←Th.h> #include <sig/PCR←Sig.h> /* * WaitHandles are returned by Exec. Client can hold or * drop as it sees fit. Client can test/wait for completion using * PCR←Exec←Join(handle, valp, sigmask, timeout); */ struct PCR←Exec←Rep { PCR←ERes exec←in; /* connected to exec'ee's stdIn: -1 if redirected by the exec */ PCR←ERes exec←out; /* connected to exec'ee's stdOut: ditto */ PCR←ERes exec←err; /* connected to exec'ee's stdErr: ditto; may be the same as exec←out */ PCR←Th←T *exec←proxy; /* not for direct client use: Exec←Join */ int exec←serversock; /* not for client use; used by the exec←proxy thread */ }; typedef struct PCR←Exec←Rep *PCR←Exec←Handle; /* * Environ is a null-terminated list of strings * appropriate for the exec-ee's envp argument. */ typedef char *PCR←Exec←Environ[]; /* * Execle and Execve use the local exec server, created during PCR startup. * If it wasn't started or isn't working they return NIL. * If wd is an absolute path it becomes the working directory of the new process. * If wd is NIL or relative, the working directory of the new process will be * the working directory of the exec'ing thread or relative to that. * path is absolute or relative to the working directory of the new process. * If envp is non-NIL, *envp[] will be used to build the environment of the new process. * If NIL, the new environment will be inherited from the exec server. * If stdIn (resp. stdOut, stdErr) is non-NIL, the standard input (resp. standard * output, standard error) descriptor of the forked process will be directed to the * file named by stdIn. If stdIn is NIL (resp. etc.) the standard input descriptor * will be directed to a descriptor accessible from the returned Exec←Handle. (see * GetStdIn, etc. below. * If separateStdErr is not true the standard error descriptor will be the same as the * standard output descriptor (even if a filename is suppled for stdErr). */ extern PCR←Exec←Handle PCR←Exec←Execle( const char *wd, const char *path, const PCR←Exec←Environ envp, const char *stdIn, const char *stdOut, PCR←Bool separateStdErr, const char *stdErr, const char* name, ... ); extern PCR←Exec←Handle PCR←Exec←Execve( const char *wd, const char *path, const PCR←Exec←Environ envp, const char *stdIn, const char *stdOut, PCR←Bool separateStdErr, const char *stdErr, const char *argv[] ); /* * JOINs with the exec'ed process. If statusp != NIL, the exit status is stored there. * Other arguments and results as for PCR←Th←Join */ extern PCR←ERes PCR←Exec←Join(PCR←Exec←Handle handle, int *statusp, const PCR←sigset←t *sigMask, PCR←Msec wakeup ); /* * exec a (Bourne) shell to synchronously execute the command: out and err to /dev/tty, in from /dev/null * returns the exit status of the shell a la the wait() system call */ int PCR←Exec←System( const char *cmd ); /* * to be added: contacting and using remote exec servers (using host/port/key addressing) */ #endif /* ←←PCR←Exec←h */