newlib/winsup/cygwin/sigproc.h
Christopher Faylor ec300c9979 * errno.cc (seterrno_from_win_error): Fix debugging output.
* fhandler.cc (fhandler_base::fstat): Move to inline method in fhandler.h.
(fhandler_base::set_io_handle): Ditto.
* fhandler.h (fhandler_base): Make some methods inline.
* fhandler_console.cc (fhandler_console::write_normal): Make buffer larger.
* sigproc.h (sigframe::sigframe): Actually use set ebp parameter correctly.
* spawn.cc (spawn_guts): Set dwProcessId when exec'ing.  Just exit immediately
after reparenting.
* syscalls.cc: Sprinkle sigframe stuff throughout.
* wait.cc (wait4): Set signal frame here.
* dcrt0.cc (__api_fatal): Don't rely on small_printf to display errors.  Always
display problems to the console, if possible.
2000-10-12 04:38:29 +00:00

117 lines
2.7 KiB
C++

/* sigproc.h
Copyright 1997, 1998, 2000 Cygnus Solutions.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#include <signal.h>
#define EXIT_SIGNAL 0x010000
#define EXIT_REPARENTING 0x020000
#define EXIT_NOCLOSEALL 0x040000
enum procstuff
{
PROC_ADDCHILD = 1, // add a new subprocess to list
PROC_CHILDSTOPPED = 2, // a child stopped
PROC_CHILDTERMINATED = 3, // a child died
PROC_CLEARWAIT = 4, // clear all waits - signal arrived
PROC_WAIT = 5 // setup for wait() for subproc
};
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
{
DWORD id;
DWORD frame;
muto *lock;
sigthread () : id (0), frame (0), lock (0) {}
void init (const char *s);
};
class sigframe
{
private:
sigthread *st;
public:
void set (sigthread &t, DWORD ebp)
{
t.lock->acquire ();
st = &t;
t.frame = ebp;
t.lock->release ();
}
sigframe () {st = NULL;}
sigframe (sigthread &t, DWORD ebp = (DWORD) __builtin_frame_address (0))
{
if (!t.frame && t.id == GetCurrentThreadId ())
set (t, ebp);
else
st = NULL;
}
~sigframe ()
{
if (st)
{
st->lock->acquire ();
st->frame = 0;
st->lock->release ();
st = NULL;
}
}
};
extern sigthread mainthread;
extern HANDLE signal_arrived;
/* non-NULL if this process is a child of a cygwin process */
extern HANDLE parent_alive;
BOOL __stdcall my_parent_is_alive ();
extern "C" int __stdcall sig_dispatch_pending (int force = FALSE);
extern "C" void __stdcall set_process_mask (sigset_t newmask);
int __stdcall sig_handle (int);
void __stdcall sig_clear (int);
void __stdcall sig_set_pending (int);
int __stdcall handle_sigsuspend (sigset_t);
int __stdcall proc_subproc (DWORD, DWORD);
class _pinfo;
void __stdcall proc_terminate ();
void __stdcall sigproc_init ();
void __stdcall subproc_init ();
void __stdcall sigproc_terminate ();
BOOL __stdcall proc_exists (_pinfo *);
BOOL __stdcall pid_exists (pid_t);
int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_address (0));
void __stdcall signal_fixup_after_fork ();
extern char myself_nowait_dummy[];
extern char myself_nowait_nonmain_dummy[];
extern HANDLE hExeced; // Process handle of new window
// process created by spawn_guts()
#define WAIT_SIG_EXITING (WAIT_OBJECT_0 + 1)
#define allow_sig_dispatch(n) __allow_sig_dispatch (__FILE__, __LINE__, (n))
#define myself_nowait ((_pinfo *)myself_nowait_dummy)
#define myself_nowait_nonmain ((_pinfo *)myself_nowait_nonmain_dummy)