#ifndef UNIXPROCESS_MD.H #define UNIXPROCESS_MD.H #include /* These numbers must be the same as the Enum in UNIXProcess.java * Must be a better way of doing this. */ #define MODE_CLONE 1 #define MODE_FORK 2 #define MODE_VFORK 3 #define MODE_SPAWN 4 typedef struct _ChildStuff { int in[2]; int out[2]; int err[2]; int fail[2]; int childenv[2]; int fds[3]; int mode; const char **argv; int argc; const char **envv; const char *pdir; int redirectErrorStream; void *clone_stack; } ChildStuff; /* following used in addition when mode is SPAWN */ typedef struct _SpawnInfo { int nargv; /* number of argv array elements */ int argvBytes; /* total number of bytes in argv array */ int nenvv; /* number of envv array elements */ int envvBytes; /* total number of bytes in envv array */ int dirlen; /* length of home directory string */ int parentPathLen; /* length of parentPath string */ int nparentPathv; /* number of elements in parentPathv array */ int parentPathvBytes; /* total number of bytes in parentPathv array */ } SpawnInfo; extern const char *xx_parentPath; extern const char * const *xx_parentPathv; ssize_t xx_readFully(int fd, void *buf, size_t nbyte); void xx_initVectorFromBlock(const char**vector, const char* block, int count); int xx_childProcess(void *arg); const char * const * xx_splitPath(const char *path); #endif