/*
 * $Date: $
 * $Source: $
 * $Revision: $
 * $State: $
 *
 * $Log: $
 */

#ifndef _EMU_LINUX_SIGNAL_H
#define _EMU_LINUX_SIGNAL_H

#include <signal.h> 

#include "extern.h"
#include "arch/types.h"

extern void linux_signal_init(void);
extern int  dosemu_sigaction(int, struct sigaction *, struct sigaction *);

/* DANG_BEGIN_REMARK
 * We assume system call restarting... under linux 0.99pl8 and earlier,
 * this was the default.  SA_RESTART was defined in 0.99pl8 to explicitly
 * request restarting (and thus does nothing).  However, if this ever
 * changes, I want to be safe
 * DANG_END_REMARK
 */
#ifndef SA_RESTART
#define SA_RESTART 0
#error SA_RESTART Not defined
#endif

/* DANG_BEGIN_FUNCTION NEWSETQSIG
 *
 * arguments:
 * sig - the signal to have a handler installed to.
 * fun - the signal handler function to install
 *
 * description:
 * All signals that wish to be handled properly in context with the
 * execution of vm86() mode or use non-reentrant functions should add
 * themselves to the sa_mask in newsetqsig() and use NEWSETQSIG().
 * They will also need to be set up in an order, such as SIGIO.
 *
 * DANG_END_FUNCTION
 */
void newsetqsig(int sig, __sighandler_t fun);
void setsig(int sig, __sighandler_t fun);
void newsetsig(int sig, __sighandler_t fun);

#define NEWSETQSIG(sig,fun)	newsetqsig(sig,(__sighandler_t)fun)
#define SETSIG(sig,fun)		setsig(sig,(__sighandler_t)fun)
#define NEWSETSIG(sig,fun)	newsetsig(sig,(__sighandler_t)fun)

/*
 * Right now, dosemu only supports two serial ports.
 */
#define SIG_SER		SIGTTIN
#define SIG_TIME	SIGPROF

/* signals for Linux's process control of consoles */
#define SIG_RELEASE     SIGWINCH
#define SIG_ACQUIRE     SIGUSR1

EXTERN fd_set   fds_sigio;
EXTERN fd_set   fds_no_sigio;
EXTERN long     use_sigio     INIT(0);
EXTERN int      not_use_sigio INIT(0);
EXTERN Bit8u   *cstack[16384];

#endif /* _EMU_LINUX_SIGNAL_H */
