3 Copyright 1997, 1998, 2000, 2001 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
13 #define EXIT_SIGNAL 0x010000
14 #define EXIT_REPARENTING 0x020000
15 #define EXIT_NOCLOSEALL 0x040000
19 PROC_ADDCHILD = 1, // add a new subprocess to list
20 PROC_CHILDTERMINATED = 2, // a child died
21 PROC_CLEARWAIT = 3, // clear all waits - signal arrived
22 PROC_WAIT = 4, // setup for wait() for subproc
23 PROC_NOTHING = 5 // nothing, really
26 typedef struct struct_waitq
32 void *rusage; /* pointer to potential rusage */
33 struct struct_waitq *next;
41 CRITICAL_SECTION lock;
44 bool get_winapi_lock (int test = 0);
45 void release_winapi_lock ();
46 void init (const char *s);
57 EnterCriticalSection (&st->lock);
60 st->release_winapi_lock ();
61 LeaveCriticalSection (&st->lock);
67 void set (sigthread &t, DWORD ebp, bool is_exception = 0)
69 DWORD oframe = t.frame;
72 t.exception = is_exception;
77 sigframe (): st (NULL) {}
78 sigframe (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0))
80 if (!t.frame && t.id == GetCurrentThreadId ())
90 int call_signal_handler ();
93 extern sigthread mainthread;
94 extern HANDLE signal_arrived;
96 BOOL __stdcall my_parent_is_alive ();
97 extern "C" int __stdcall sig_dispatch_pending (int force = FALSE);
98 extern "C" void __stdcall set_process_mask (sigset_t newmask);
99 extern "C" void __stdcall reset_signal_arrived ();
100 int __stdcall sig_handle (int);
101 void __stdcall sig_clear (int);
102 void __stdcall sig_set_pending (int);
103 int __stdcall handle_sigsuspend (sigset_t);
105 int __stdcall proc_subproc (DWORD, DWORD);
108 void __stdcall proc_terminate ();
109 void __stdcall sigproc_init ();
110 void __stdcall subproc_init ();
111 void __stdcall sigproc_terminate ();
112 BOOL __stdcall proc_exists (_pinfo *) __attribute__ ((regparm(1)));
113 BOOL __stdcall pid_exists (pid_t) __attribute__ ((regparm(1)));
114 int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0),
115 bool exception = 0) __attribute__ ((regparm(3)));
116 void __stdcall signal_fixup_after_fork ();
117 void __stdcall signal_fixup_after_exec (bool);
119 extern char myself_nowait_dummy[];
120 extern char myself_nowait_nonmain_dummy[];
122 #define WAIT_SIG_EXITING (WAIT_OBJECT_0 + 1)
124 #define myself_nowait ((_pinfo *)myself_nowait_dummy)
125 #define myself_nowait_nonmain ((_pinfo *)myself_nowait_nonmain_dummy)