/* sigproc.h
- Copyright 1997, 1998, 2000, 2001, 2002 Red Hat, Inc.
+ Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
This file is part of Cygwin.
#define _SIGPROC_H
#include <signal.h>
-#define EXIT_SIGNAL 0x010000
-#define EXIT_REPARENTING 0x020000
-#define EXIT_NOCLOSEALL 0x040000
-
#ifdef NSIG
enum
{
__SIGFLUSH = -(NSIG + 1),
__SIGSTRACE = -(NSIG + 2),
__SIGCOMMUNE = -(NSIG + 3),
- __SIGPENDING = -(NSIG + 4)
+ __SIGPENDING = -(NSIG + 4),
+ __SIGDELETE = -(NSIG + 5),
+ __SIGFLUSHFAST = -(NSIG + 6),
+ __SIGHOLD = -(NSIG + 7),
+ __SIGNOHOLD = -(NSIG + 8)
};
#endif
enum procstuff
{
- PROC_ADDCHILD = 1, // add a new subprocess to list
- PROC_CHILDTERMINATED = 2, // a child died
- PROC_CLEARWAIT = 3, // clear all waits - signal arrived
- PROC_WAIT = 4, // setup for wait() for subproc
- PROC_NOTHING = 5 // nothing, really
+ PROC_ADDCHILD = 1, // add a new subprocess to list
+ PROC_DETACHED_CHILD = 2, // set up a detached child
+ PROC_CLEARWAIT = 3, // clear all waits - signal arrived
+ PROC_WAIT = 4, // setup for wait() for subproc
+ PROC_NOTHING = 5 // nothing, really
};
-typedef struct struct_waitq
-{
- int pid;
- int options;
- int status;
- HANDLE ev;
- void *rusage; /* pointer to potential rusage */
- struct struct_waitq *next;
- HANDLE thread_ev;
-} waitq;
-
-struct sigthread
+struct sigpacket
{
- DWORD id;
- DWORD frame;
- CRITICAL_SECTION lock;
- LONG winapi_lock;
- BOOL exception;
- bool get_winapi_lock (int test = 0);
- void release_winapi_lock ();
- void init (const char *s);
-};
-
-class sigframe
-{
-private:
- sigthread *st;
- inline bool unregister ()
- {
- if (!st)
- return 0;
- EnterCriticalSection (&st->lock);
- st->frame = 0;
- st->exception = 0;
- st->release_winapi_lock ();
- LeaveCriticalSection (&st->lock);
- st = NULL;
- return 1;
- }
-
-public:
- inline void set (sigthread &t, DWORD ebp, bool is_exception = 0)
- {
- DWORD oframe = t.frame;
- st = &t;
- t.frame = ebp;
- t.exception = is_exception;
- if (!oframe)
- t.get_winapi_lock ();
- }
- inline void init (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0), bool is_exception = 0)
+ siginfo_t si;
+ pid_t pid;
+ class _cygtls *tls;
+ sigset_t *mask;
+ union
{
- if (is_exception || (!t.frame && t.id == GetCurrentThreadId ()))
- set (t, ebp, is_exception);
- else
- st = NULL;
- }
-
- sigframe (): st (NULL) {}
- sigframe (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0)) {init (t, ebp);}
- ~sigframe ()
- {
- unregister ();
- }
-
- int call_signal_handler ();
+ HANDLE wakeup;
+ struct sigpacket *next;
+ };
+ int __stdcall process () __attribute__ ((regparm (1)));
};
-extern sigthread mainthread;
extern HANDLE signal_arrived;
extern HANDLE sigCONT;
-BOOL __stdcall my_parent_is_alive ();
-int __stdcall sig_dispatch_pending ();
-extern "C" void __stdcall set_process_mask (sigset_t newmask);
+void __stdcall sig_dispatch_pending (bool fast = false);
+#ifdef _PINFO_H
+extern "C" void __stdcall set_signal_mask (sigset_t newmask, sigset_t = myself->getsigmask ());
+#endif
+int __stdcall handle_sigprocmask (int sig, const sigset_t *set,
+ sigset_t *oldset, sigset_t& opmask)
+ __attribute__ ((regparm (3)));
+
extern "C" void __stdcall reset_signal_arrived ();
-int __stdcall sig_handle (int, sigset_t) __attribute__ ((regparm (2)));
void __stdcall sig_clear (int) __attribute__ ((regparm (1)));
void __stdcall sig_set_pending (int) __attribute__ ((regparm (1)));
int __stdcall handle_sigsuspend (sigset_t);
class _pinfo;
void __stdcall proc_terminate ();
void __stdcall sigproc_init ();
-void __stdcall subproc_init ();
void __stdcall sigproc_terminate ();
-BOOL __stdcall proc_exists (_pinfo *) __attribute__ ((regparm(1)));
-BOOL __stdcall pid_exists (pid_t) __attribute__ ((regparm(1)));
-int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0),
- bool exception = 0) __attribute__ ((regparm(3)));
-void __stdcall signal_fixup_after_fork ();
+bool __stdcall pid_exists (pid_t) __attribute__ ((regparm(1)));
+int __stdcall sig_send (_pinfo *, siginfo_t&, class _cygtls *tls = NULL) __attribute__ ((regparm (3)));
+int __stdcall sig_send (_pinfo *, int) __attribute__ ((regparm (2)));
void __stdcall signal_fixup_after_exec ();
void __stdcall wait_for_sigthread ();
void __stdcall sigalloc ();
+void __stdcall create_signal_arrived ();
+
+int kill_pgrp (pid_t, siginfo_t&);
+int killsys (pid_t, int);
extern char myself_nowait_dummy[];
-extern char myself_nowait_nonmain_dummy[];
-#define WAIT_SIG_PRIORITY THREAD_PRIORITY_TIME_CRITICAL
+extern struct sigaction *global_sigs;
+
+#define WAIT_SIG_PRIORITY THREAD_PRIORITY_NORMAL
#define myself_nowait ((_pinfo *)myself_nowait_dummy)
-#define myself_nowait_nonmain ((_pinfo *)myself_nowait_nonmain_dummy)
#endif /*_SIGPROC_H*/