3 Copyright 1997, 1998, 2000, 2001, 2002 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);
53 inline bool unregister ()
57 EnterCriticalSection (&st->lock);
60 st->release_winapi_lock ();
61 LeaveCriticalSection (&st->lock);
67 inline void set (sigthread &t, DWORD ebp, bool is_exception = 0)
69 DWORD oframe = t.frame;
72 t.exception = is_exception;
76 inline void init (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0))
78 if (!t.frame && t.id == GetCurrentThreadId ())
84 sigframe (): st (NULL) {}
85 sigframe (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0)) {init (t, ebp);}
91 int call_signal_handler ();
94 extern sigthread mainthread;
95 extern HANDLE signal_arrived;
97 BOOL __stdcall my_parent_is_alive ();
98 extern "C" int __stdcall sig_dispatch_pending (int force = FALSE);
99 extern "C" void __stdcall set_process_mask (sigset_t newmask);
100 extern "C" void __stdcall reset_signal_arrived ();
101 int __stdcall sig_handle (int, bool);
102 void __stdcall sig_clear (int);
103 void __stdcall sig_set_pending (int);
104 int __stdcall handle_sigsuspend (sigset_t);
106 int __stdcall proc_subproc (DWORD, DWORD);
109 void __stdcall proc_terminate ();
110 void __stdcall sigproc_init ();
111 void __stdcall subproc_init ();
112 void __stdcall sigproc_terminate ();
113 BOOL __stdcall proc_exists (_pinfo *) __attribute__ ((regparm(1)));
114 BOOL __stdcall pid_exists (pid_t) __attribute__ ((regparm(1)));
115 int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0),
116 bool exception = 0) __attribute__ ((regparm(3)));
117 void __stdcall signal_fixup_after_fork ();
118 void __stdcall signal_fixup_after_exec (bool);
120 extern char myself_nowait_dummy[];
121 extern char myself_nowait_nonmain_dummy[];
123 #define WAIT_SIG_EXITING (WAIT_OBJECT_0 + 1)
125 #define myself_nowait ((_pinfo *)myself_nowait_dummy)
126 #define myself_nowait_nonmain ((_pinfo *)myself_nowait_nonmain_dummy)