1 /* childinfo.h: shared child info for cygwin
3 Copyright 2000 Red Hat, Inc.
5 This file is part of Cygwin.
7 This software is a copyrighted work licensed under the terms of the
8 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
15 PROC_MAGIC = 0xaf08f000,
16 PROC_FORK = PROC_MAGIC + 1,
17 PROC_EXEC = PROC_MAGIC + 2,
18 PROC_SPAWN = PROC_MAGIC + 3,
19 PROC_FORK1 = PROC_MAGIC + 4, // Newer versions provide stack
20 // location information
21 PROC_SPAWN1 = PROC_MAGIC + 5
24 #define PROC_MAGIC_MASK 0xff00f000
25 #define PROC_MAGIC_GENERIC 0xaf00f000
26 #define PROC_MAGIC_VER_MASK 0x0ff0000
28 #define EXEC_MAGIC_SIZE sizeof(child_info)
32 DWORD zero[1]; // must be zeroed
33 DWORD cb; // size of this record
34 DWORD type; // type of record
35 int cygpid; // cygwin pid of child process
36 HANDLE subproc_ready; // used for synchronization with parent
39 HANDLE parent_alive; // handle of thread used to track children
42 class child_info_fork: public child_info
45 HANDLE forker_finished;// for synchronization with child
46 DWORD stacksize; // size of parent stack
50 jmp_buf jmp; // where child will jump to
51 void *stacktop; // location of top of parent stack
52 void *stackbottom; // location of bottom of parent stack
57 class cygheap_exec_info
72 class child_info_spawn: public child_info
78 cygheap_exec_info *moreinfo;
80 child_info_spawn (): parent (NULL), cygheap (NULL),
81 cygheap_max (NULL), moreinfo (NULL) {}
88 if (moreinfo->old_title)
89 cfree (moreinfo->old_title);
90 if (moreinfo->environ)
92 for (char **e = moreinfo->environ; *e; e++)
94 cfree (moreinfo->environ);
96 CloseHandle (moreinfo->myself_pinfo);
102 void __stdcall init_child_info (DWORD, child_info *, int, HANDLE);
104 extern child_info_fork *child_proc_info;