epoc32/include/stdapis/signal.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 /*-
     1 /*-
     2  * Copyright (c) Symbian Software Ltd 2006-2007.  All rights reserved.
       
     3  * Copyright (c) 1991, 1993
     2  * Copyright (c) 1991, 1993
     4  *	The Regents of the University of California.  All rights reserved.
     3  *	The Regents of the University of California.  All rights reserved.
     5  *
     4  *
     6  * Redistribution and use in source and binary forms, with or without
     5  * Redistribution and use in source and binary forms, with or without
     7  * modification, are permitted provided that the following conditions
     6  * modification, are permitted provided that the following conditions
    25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    26  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    27  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    28  * SUCH DAMAGE.
    27  * SUCH DAMAGE.
    29  *
    28  *
       
    29  * Portions Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
    30  *	@(#)signal.h	8.3 (Berkeley) 3/30/94
    30  *	@(#)signal.h	8.3 (Berkeley) 3/30/94
    31  * $FreeBSD: src/include/signal.h,v 1.24 2003/03/31 23:30:41 jeff Exp $
    31  * $FreeBSD: src/include/signal.h,v 1.24 2003/03/31 23:30:41 jeff Exp $
    32  */
    32  */
    33 
    33 
    34 #ifndef _SIGNAL_H_
    34 #ifndef _SIGNAL_H_
    35 #define	_SIGNAL_H_
    35 #define	_SIGNAL_H_
    36 
    36 
    37 #include <sys/cdefs.h>
    37 #include <sys/cdefs.h>
    38 #include <sys/_types.h>
    38 #include <sys/types.h>
    39 #include <sys/signal.h>
    39 #include <sys/signal.h>
    40 
    40 
    41 __BEGIN_DECLS
    41 __BEGIN_DECLS
    42 
    42 
    43 struct timespec;
    43 struct timespec;
    44 /* The following definitions have been taken from siglist.c file 
    44 /* The following definitions have been taken from siglist.c file
    45  * Once signals are implemented then these definitions must be moved to that
    45  * Once signals are implemented then these definitions must be moved to that
    46  * file. (sys_signame,sys_siglist,sys_nsig)  */
    46  * file. (sys_signame,sys_siglist,sys_nsig)  */
    47 
    47 
    48 static const char *const sys_signame[NSIG] = {
    48 static const char *const sys_signame[NSIG] = {
    49 	"Signal 0",
    49 	"Signal 0",
   112 	"Window size changes",		/* SIGWINCH */
   112 	"Window size changes",		/* SIGWINCH */
   113 	"Information request",		/* SIGINFO */
   113 	"Information request",		/* SIGINFO */
   114 	"User defined signal 1",	/* SIGUSR1 */
   114 	"User defined signal 1",	/* SIGUSR1 */
   115 	"User defined signal 2"		/* SIGUSR2 */
   115 	"User defined signal 2"		/* SIGUSR2 */
   116 };
   116 };
       
   117 
       
   118 #if !defined (SIG_BLOCK)
       
   119 	#define SIG_UNBLOCK 1
       
   120 	#define SIG_BLOCK   2
       
   121 	#define SIG_SETMASK 3
       
   122 #endif
       
   123 
       
   124 /* Type for data associated with a signal.  */
       
   125 union sigval
       
   126 {
       
   127 	int    sival_int;
       
   128 	void  *sival_ptr;
       
   129 };
       
   130 
       
   131 typedef struct __siginfo_t
       
   132 {
       
   133 	int           si_signo;
       
   134 	int           si_code;
       
   135 	int           si_errno;
       
   136 	pid_t         si_pid;
       
   137 	uid_t         si_uid;
       
   138 	void         *si_addr;
       
   139 	int           si_status;
       
   140 	long          si_band;
       
   141 	union sigval  si_value;
       
   142 } siginfo_t;
       
   143 
       
   144 
       
   145 typedef struct sigevent
       
   146 {
       
   147 	union sigval           sigev_value;  
       
   148     int sigev_signo;
       
   149     int sigev_notify;
       
   150 
       
   151     void (*sigev_notify_function) (union sigval);       /* Function to start.  */
       
   152     void *sigev_notify_attributes;                  /* Really pthread_attr_t.  */
       
   153 } sigevent_t;
       
   154 
       
   155 /* `sigev_notify' values.  */
       
   156 enum
       
   157 {
       
   158   SIGEV_SIGNAL = 0,             /* Notify via signal.  */
       
   159 # define SIGEV_SIGNAL   SIGEV_SIGNAL
       
   160   SIGEV_NONE,                   /* Other notification: meaningless.  */
       
   161 # define SIGEV_NONE     SIGEV_NONE
       
   162   SIGEV_THREAD,                 /* Deliver via thread creation.  */
       
   163 # define SIGEV_THREAD   SIGEV_THREAD
       
   164 
       
   165   SIGEV_THREAD_ID = 4           /* Send signal to specific thread.  */
       
   166 #define SIGEV_THREAD_ID SIGEV_THREAD_ID
       
   167 };
       
   168 
   117 static const int sys_nsig = sizeof(sys_siglist) / sizeof(sys_siglist[0]);
   169 static const int sys_nsig = sizeof(sys_siglist) / sizeof(sys_siglist[0]);
   118 
   170 
   119 IMPORT_C int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
   171 IMPORT_C int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
   120 
   172 
   121 IMPORT_C int sigemptyset(sigset_t* set);
   173 IMPORT_C int sigemptyset(sigset_t* set);
   122 
   174 
       
   175 #ifdef SYMBIAN_OE_POSIX_SIGNALS
       
   176 IMPORT_C int kill(pid_t pid, int sig);
       
   177 IMPORT_C int raise(int sig);
       
   178 IMPORT_C int sigqueue(pid_t pid, int sig, const union sigval value);
       
   179 
       
   180 IMPORT_C int sigfillset(sigset_t *set);
       
   181 IMPORT_C int sigaddset(sigset_t *set, int signo);
       
   182 IMPORT_C int sigdelset(sigset_t *set, int signo);
       
   183 IMPORT_C int sigismember(const sigset_t *set, int signo);
       
   184 IMPORT_C int sigandset(sigset_t * set, const sigset_t * left, const sigset_t * right);
       
   185 IMPORT_C int sigorset(sigset_t * set, const sigset_t * left, const sigset_t * right);
       
   186 IMPORT_C int sigisemptyset(const sigset_t * set);
       
   187 
       
   188 IMPORT_C int sigprocmask(int how, const sigset_t* set,sigset_t* oset);
       
   189 IMPORT_C int sighold(int signo);
       
   190 IMPORT_C int sigrelse(int signo);
       
   191 IMPORT_C int sigpause(int signo);
       
   192 
       
   193 IMPORT_C int sigwait(const sigset_t *set, int *sig);
       
   194 IMPORT_C int sigtimedwait(const sigset_t *set, siginfo_t *info,
       
   195        const struct timespec *timeout);
       
   196 IMPORT_C int sigwaitinfo(const sigset_t *set, siginfo_t *info);
       
   197 
       
   198 IMPORT_C void (*bsd_signal(int, void (*)(int)))(int);
       
   199 IMPORT_C void (*sigset(int, void (*)(int)))(int);
       
   200 IMPORT_C void (*signal(int, void (*)(int)))(int);
       
   201 IMPORT_C int sigpending(sigset_t *set);
       
   202 IMPORT_C int sigignore(int sig);
       
   203 IMPORT_C void psignal(int sig, const char *s);
       
   204 
       
   205 IMPORT_C int sigenable();
       
   206 
       
   207 #endif
   123 __END_DECLS
   208 __END_DECLS
   124 
   209 
   125 #endif /* !_SIGNAL_H_ */
   210 #endif /* !_SIGNAL_H_ */