sl@0: /*-
sl@0:  * Copyright (c) 1991, 1993
sl@0:  *	The Regents of the University of California.  All rights reserved.
sl@0:  *
sl@0:  * Redistribution and use in source and binary forms, with or without
sl@0:  * modification, are permitted provided that the following conditions
sl@0:  * are met:
sl@0:  * 1. Redistributions of source code must retain the above copyright
sl@0:  *    notice, this list of conditions and the following disclaimer.
sl@0:  * 2. Redistributions in binary form must reproduce the above copyright
sl@0:  *    notice, this list of conditions and the following disclaimer in the
sl@0:  *    documentation and/or other materials provided with the distribution.
sl@0:  * 4. Neither the name of the University nor the names of its contributors
sl@0:  *    may be used to endorse or promote products derived from this software
sl@0:  *    without specific prior written permission.
sl@0:  *
sl@0:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0:  * SUCH DAMAGE.
sl@0:  *
sl@0:  * Portions Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0:  *	@(#)signal.h	8.3 (Berkeley) 3/30/94
sl@0:  * $FreeBSD: src/include/signal.h,v 1.24 2003/03/31 23:30:41 jeff Exp $
sl@0:  */
sl@0: 
sl@0: #ifndef _SIGNAL_H_
sl@0: #define	_SIGNAL_H_
sl@0: 
sl@0: #include <sys/cdefs.h>
sl@0: #include <sys/types.h>
sl@0: #include <sys/signal.h>
sl@0: 
sl@0: __BEGIN_DECLS
sl@0: 
sl@0: struct timespec;
sl@0: /* The following definitions have been taken from siglist.c file
sl@0:  * Once signals are implemented then these definitions must be moved to that
sl@0:  * file. (sys_signame,sys_siglist,sys_nsig)  */
sl@0: 
sl@0: static const char *const sys_signame[NSIG] = {
sl@0: 	"Signal 0",
sl@0: 	"hup",				/* SIGHUP */
sl@0: 	"int",				/* SIGINT */
sl@0: 	"quit",				/* SIGQUIT */
sl@0: 	"ill",				/* SIGILL */
sl@0: 	"trap",				/* SIGTRAP */
sl@0: 	"abrt",				/* SIGABRT */
sl@0: 	"emt",				/* SIGEMT */
sl@0: 	"fpe",				/* SIGFPE */
sl@0: 	"kill",				/* SIGKILL */
sl@0: 	"bus",				/* SIGBUS */
sl@0: 	"segv",				/* SIGSEGV */
sl@0: 	"sys",				/* SIGSYS */
sl@0: 	"pipe",				/* SIGPIPE */
sl@0: 	"alrm",				/* SIGALRM */
sl@0: 	"term",				/* SIGTERM */
sl@0: 	"urg",				/* SIGURG */
sl@0: 	"stop",				/* SIGSTOP */
sl@0: 	"tstp",				/* SIGTSTP */
sl@0: 	"cont",				/* SIGCONT */
sl@0: 	"chld",				/* SIGCHLD */
sl@0: 	"ttin",				/* SIGTTIN */
sl@0: 	"ttou",				/* SIGTTOU */
sl@0: 	"io",				/* SIGIO */
sl@0: 	"xcpu",				/* SIGXCPU */
sl@0: 	"xfsz",				/* SIGXFSZ */
sl@0: 	"vtalrm",			/* SIGVTALRM */
sl@0: 	"prof",				/* SIGPROF */
sl@0: 	"winch",			/* SIGWINCH */
sl@0: 	"info",				/* SIGINFO */
sl@0: 	"usr1",				/* SIGUSR1 */
sl@0: 	"usr2"				/* SIGUSR2 */
sl@0: };
sl@0: 
sl@0: static const char *const sys_siglist[NSIG] = {
sl@0: 	"Signal 0",
sl@0: 	"Hangup",			/* SIGHUP */
sl@0: 	"Interrupt",			/* SIGINT */
sl@0: 	"Quit",				/* SIGQUIT */
sl@0: 	"Illegal instruction",		/* SIGILL */
sl@0: 	"Trace/BPT trap",		/* SIGTRAP */
sl@0: 	"Abort trap",			/* SIGABRT */
sl@0: 	"EMT trap",			/* SIGEMT */
sl@0: 	"Floating point exception",	/* SIGFPE */
sl@0: 	"Killed",			/* SIGKILL */
sl@0: 	"Bus error",			/* SIGBUS */
sl@0: 	"Segmentation fault",		/* SIGSEGV */
sl@0: 	"Bad system call",		/* SIGSYS */
sl@0: 	"Broken pipe",			/* SIGPIPE */
sl@0: 	"Alarm clock",			/* SIGALRM */
sl@0: 	"Terminated",			/* SIGTERM */
sl@0: 	"Urgent I/O condition",		/* SIGURG */
sl@0: 	"Suspended (signal)",		/* SIGSTOP */
sl@0: 	"Suspended",			/* SIGTSTP */
sl@0: 	"Continued",			/* SIGCONT */
sl@0: 	"Child exited",			/* SIGCHLD */
sl@0: 	"Stopped (tty input)",		/* SIGTTIN */
sl@0: 	"Stopped (tty output)",		/* SIGTTOU */
sl@0: 	"I/O possible",			/* SIGIO */
sl@0: 	"Cputime limit exceeded",	/* SIGXCPU */
sl@0: 	"Filesize limit exceeded",	/* SIGXFSZ */
sl@0: 	"Virtual timer expired",	/* SIGVTALRM */
sl@0: 	"Profiling timer expired",	/* SIGPROF */
sl@0: 	"Window size changes",		/* SIGWINCH */
sl@0: 	"Information request",		/* SIGINFO */
sl@0: 	"User defined signal 1",	/* SIGUSR1 */
sl@0: 	"User defined signal 2"		/* SIGUSR2 */
sl@0: };
sl@0: 
sl@0: #if !defined (SIG_BLOCK)
sl@0: 	#define SIG_UNBLOCK 1
sl@0: 	#define SIG_BLOCK   2
sl@0: 	#define SIG_SETMASK 3
sl@0: #endif
sl@0: 
sl@0: /* Type for data associated with a signal.  */
sl@0: union sigval
sl@0: {
sl@0: 	int    sival_int;
sl@0: 	void  *sival_ptr;
sl@0: };
sl@0: 
sl@0: typedef struct __siginfo_t
sl@0: {
sl@0: 	int           si_signo;
sl@0: 	int           si_code;
sl@0: 	int           si_errno;
sl@0: 	pid_t         si_pid;
sl@0: 	uid_t         si_uid;
sl@0: 	void         *si_addr;
sl@0: 	int           si_status;
sl@0: 	long          si_band;
sl@0: 	union sigval  si_value;
sl@0: } siginfo_t;
sl@0: 
sl@0: 
sl@0: typedef struct sigevent
sl@0: {
sl@0: 	union sigval           sigev_value;  
sl@0:     int sigev_signo;
sl@0:     int sigev_notify;
sl@0: 
sl@0:     void (*sigev_notify_function) (union sigval);       /* Function to start.  */
sl@0:     void *sigev_notify_attributes;                  /* Really pthread_attr_t.  */
sl@0: } sigevent_t;
sl@0: 
sl@0: /* `sigev_notify' values.  */
sl@0: enum
sl@0: {
sl@0:   SIGEV_SIGNAL = 0,             /* Notify via signal.  */
sl@0: # define SIGEV_SIGNAL   SIGEV_SIGNAL
sl@0:   SIGEV_NONE,                   /* Other notification: meaningless.  */
sl@0: # define SIGEV_NONE     SIGEV_NONE
sl@0:   SIGEV_THREAD,                 /* Deliver via thread creation.  */
sl@0: # define SIGEV_THREAD   SIGEV_THREAD
sl@0: 
sl@0:   SIGEV_THREAD_ID = 4           /* Send signal to specific thread.  */
sl@0: #define SIGEV_THREAD_ID SIGEV_THREAD_ID
sl@0: };
sl@0: 
sl@0: static const int sys_nsig = sizeof(sys_siglist) / sizeof(sys_siglist[0]);
sl@0: 
sl@0: IMPORT_C int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
sl@0: 
sl@0: IMPORT_C int sigemptyset(sigset_t* set);
sl@0: 
sl@0: #ifdef SYMBIAN_OE_POSIX_SIGNALS
sl@0: IMPORT_C int kill(pid_t pid, int sig);
sl@0: IMPORT_C int raise(int sig);
sl@0: IMPORT_C int sigqueue(pid_t pid, int sig, const union sigval value);
sl@0: 
sl@0: IMPORT_C int sigfillset(sigset_t *set);
sl@0: IMPORT_C int sigaddset(sigset_t *set, int signo);
sl@0: IMPORT_C int sigdelset(sigset_t *set, int signo);
sl@0: IMPORT_C int sigismember(const sigset_t *set, int signo);
sl@0: IMPORT_C int sigandset(sigset_t * set, const sigset_t * left, const sigset_t * right);
sl@0: IMPORT_C int sigorset(sigset_t * set, const sigset_t * left, const sigset_t * right);
sl@0: IMPORT_C int sigisemptyset(const sigset_t * set);
sl@0: 
sl@0: IMPORT_C int sigprocmask(int how, const sigset_t* set,sigset_t* oset);
sl@0: IMPORT_C int sighold(int signo);
sl@0: IMPORT_C int sigrelse(int signo);
sl@0: IMPORT_C int sigpause(int signo);
sl@0: 
sl@0: IMPORT_C int sigwait(const sigset_t *set, int *sig);
sl@0: IMPORT_C int sigtimedwait(const sigset_t *set, siginfo_t *info,
sl@0:        const struct timespec *timeout);
sl@0: IMPORT_C int sigwaitinfo(const sigset_t *set, siginfo_t *info);
sl@0: 
sl@0: IMPORT_C void (*bsd_signal(int, void (*)(int)))(int);
sl@0: IMPORT_C void (*sigset(int, void (*)(int)))(int);
sl@0: IMPORT_C void (*signal(int, void (*)(int)))(int);
sl@0: IMPORT_C int sigpending(sigset_t *set);
sl@0: IMPORT_C int sigignore(int sig);
sl@0: IMPORT_C void psignal(int sig, const char *s);
sl@0: 
sl@0: IMPORT_C int sigenable();
sl@0: 
sl@0: #endif
sl@0: __END_DECLS
sl@0: 
sl@0: #endif /* !_SIGNAL_H_ */