os/ossrv/genericopenlibs/openenvcore/include/signal.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*-
sl@0
     2
 * Copyright (c) 1991, 1993
sl@0
     3
 *	The Regents of the University of California.  All rights reserved.
sl@0
     4
 *
sl@0
     5
 * Redistribution and use in source and binary forms, with or without
sl@0
     6
 * modification, are permitted provided that the following conditions
sl@0
     7
 * are met:
sl@0
     8
 * 1. Redistributions of source code must retain the above copyright
sl@0
     9
 *    notice, this list of conditions and the following disclaimer.
sl@0
    10
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    11
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    12
 *    documentation and/or other materials provided with the distribution.
sl@0
    13
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    14
 *    may be used to endorse or promote products derived from this software
sl@0
    15
 *    without specific prior written permission.
sl@0
    16
 *
sl@0
    17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    27
 * SUCH DAMAGE.
sl@0
    28
 *
sl@0
    29
 * Portions Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
    30
 *	@(#)signal.h	8.3 (Berkeley) 3/30/94
sl@0
    31
 * $FreeBSD: src/include/signal.h,v 1.24 2003/03/31 23:30:41 jeff Exp $
sl@0
    32
 */
sl@0
    33
sl@0
    34
#ifndef _SIGNAL_H_
sl@0
    35
#define	_SIGNAL_H_
sl@0
    36
sl@0
    37
#include <sys/cdefs.h>
sl@0
    38
#include <sys/types.h>
sl@0
    39
#include <sys/signal.h>
sl@0
    40
sl@0
    41
__BEGIN_DECLS
sl@0
    42
sl@0
    43
struct timespec;
sl@0
    44
/* The following definitions have been taken from siglist.c file
sl@0
    45
 * Once signals are implemented then these definitions must be moved to that
sl@0
    46
 * file. (sys_signame,sys_siglist,sys_nsig)  */
sl@0
    47
sl@0
    48
static const char *const sys_signame[NSIG] = {
sl@0
    49
	"Signal 0",
sl@0
    50
	"hup",				/* SIGHUP */
sl@0
    51
	"int",				/* SIGINT */
sl@0
    52
	"quit",				/* SIGQUIT */
sl@0
    53
	"ill",				/* SIGILL */
sl@0
    54
	"trap",				/* SIGTRAP */
sl@0
    55
	"abrt",				/* SIGABRT */
sl@0
    56
	"emt",				/* SIGEMT */
sl@0
    57
	"fpe",				/* SIGFPE */
sl@0
    58
	"kill",				/* SIGKILL */
sl@0
    59
	"bus",				/* SIGBUS */
sl@0
    60
	"segv",				/* SIGSEGV */
sl@0
    61
	"sys",				/* SIGSYS */
sl@0
    62
	"pipe",				/* SIGPIPE */
sl@0
    63
	"alrm",				/* SIGALRM */
sl@0
    64
	"term",				/* SIGTERM */
sl@0
    65
	"urg",				/* SIGURG */
sl@0
    66
	"stop",				/* SIGSTOP */
sl@0
    67
	"tstp",				/* SIGTSTP */
sl@0
    68
	"cont",				/* SIGCONT */
sl@0
    69
	"chld",				/* SIGCHLD */
sl@0
    70
	"ttin",				/* SIGTTIN */
sl@0
    71
	"ttou",				/* SIGTTOU */
sl@0
    72
	"io",				/* SIGIO */
sl@0
    73
	"xcpu",				/* SIGXCPU */
sl@0
    74
	"xfsz",				/* SIGXFSZ */
sl@0
    75
	"vtalrm",			/* SIGVTALRM */
sl@0
    76
	"prof",				/* SIGPROF */
sl@0
    77
	"winch",			/* SIGWINCH */
sl@0
    78
	"info",				/* SIGINFO */
sl@0
    79
	"usr1",				/* SIGUSR1 */
sl@0
    80
	"usr2"				/* SIGUSR2 */
sl@0
    81
};
sl@0
    82
sl@0
    83
static const char *const sys_siglist[NSIG] = {
sl@0
    84
	"Signal 0",
sl@0
    85
	"Hangup",			/* SIGHUP */
sl@0
    86
	"Interrupt",			/* SIGINT */
sl@0
    87
	"Quit",				/* SIGQUIT */
sl@0
    88
	"Illegal instruction",		/* SIGILL */
sl@0
    89
	"Trace/BPT trap",		/* SIGTRAP */
sl@0
    90
	"Abort trap",			/* SIGABRT */
sl@0
    91
	"EMT trap",			/* SIGEMT */
sl@0
    92
	"Floating point exception",	/* SIGFPE */
sl@0
    93
	"Killed",			/* SIGKILL */
sl@0
    94
	"Bus error",			/* SIGBUS */
sl@0
    95
	"Segmentation fault",		/* SIGSEGV */
sl@0
    96
	"Bad system call",		/* SIGSYS */
sl@0
    97
	"Broken pipe",			/* SIGPIPE */
sl@0
    98
	"Alarm clock",			/* SIGALRM */
sl@0
    99
	"Terminated",			/* SIGTERM */
sl@0
   100
	"Urgent I/O condition",		/* SIGURG */
sl@0
   101
	"Suspended (signal)",		/* SIGSTOP */
sl@0
   102
	"Suspended",			/* SIGTSTP */
sl@0
   103
	"Continued",			/* SIGCONT */
sl@0
   104
	"Child exited",			/* SIGCHLD */
sl@0
   105
	"Stopped (tty input)",		/* SIGTTIN */
sl@0
   106
	"Stopped (tty output)",		/* SIGTTOU */
sl@0
   107
	"I/O possible",			/* SIGIO */
sl@0
   108
	"Cputime limit exceeded",	/* SIGXCPU */
sl@0
   109
	"Filesize limit exceeded",	/* SIGXFSZ */
sl@0
   110
	"Virtual timer expired",	/* SIGVTALRM */
sl@0
   111
	"Profiling timer expired",	/* SIGPROF */
sl@0
   112
	"Window size changes",		/* SIGWINCH */
sl@0
   113
	"Information request",		/* SIGINFO */
sl@0
   114
	"User defined signal 1",	/* SIGUSR1 */
sl@0
   115
	"User defined signal 2"		/* SIGUSR2 */
sl@0
   116
};
sl@0
   117
sl@0
   118
#if !defined (SIG_BLOCK)
sl@0
   119
	#define SIG_UNBLOCK 1
sl@0
   120
	#define SIG_BLOCK   2
sl@0
   121
	#define SIG_SETMASK 3
sl@0
   122
#endif
sl@0
   123
sl@0
   124
/* Type for data associated with a signal.  */
sl@0
   125
union sigval
sl@0
   126
{
sl@0
   127
	int    sival_int;
sl@0
   128
	void  *sival_ptr;
sl@0
   129
};
sl@0
   130
sl@0
   131
typedef struct __siginfo_t
sl@0
   132
{
sl@0
   133
	int           si_signo;
sl@0
   134
	int           si_code;
sl@0
   135
	int           si_errno;
sl@0
   136
	pid_t         si_pid;
sl@0
   137
	uid_t         si_uid;
sl@0
   138
	void         *si_addr;
sl@0
   139
	int           si_status;
sl@0
   140
	long          si_band;
sl@0
   141
	union sigval  si_value;
sl@0
   142
} siginfo_t;
sl@0
   143
sl@0
   144
sl@0
   145
typedef struct sigevent
sl@0
   146
{
sl@0
   147
	union sigval           sigev_value;  
sl@0
   148
    int sigev_signo;
sl@0
   149
    int sigev_notify;
sl@0
   150
sl@0
   151
    void (*sigev_notify_function) (union sigval);       /* Function to start.  */
sl@0
   152
    void *sigev_notify_attributes;                  /* Really pthread_attr_t.  */
sl@0
   153
} sigevent_t;
sl@0
   154
sl@0
   155
/* `sigev_notify' values.  */
sl@0
   156
enum
sl@0
   157
{
sl@0
   158
  SIGEV_SIGNAL = 0,             /* Notify via signal.  */
sl@0
   159
# define SIGEV_SIGNAL   SIGEV_SIGNAL
sl@0
   160
  SIGEV_NONE,                   /* Other notification: meaningless.  */
sl@0
   161
# define SIGEV_NONE     SIGEV_NONE
sl@0
   162
  SIGEV_THREAD,                 /* Deliver via thread creation.  */
sl@0
   163
# define SIGEV_THREAD   SIGEV_THREAD
sl@0
   164
sl@0
   165
  SIGEV_THREAD_ID = 4           /* Send signal to specific thread.  */
sl@0
   166
#define SIGEV_THREAD_ID SIGEV_THREAD_ID
sl@0
   167
};
sl@0
   168
sl@0
   169
static const int sys_nsig = sizeof(sys_siglist) / sizeof(sys_siglist[0]);
sl@0
   170
sl@0
   171
IMPORT_C int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
sl@0
   172
sl@0
   173
IMPORT_C int sigemptyset(sigset_t* set);
sl@0
   174
sl@0
   175
#ifdef SYMBIAN_OE_POSIX_SIGNALS
sl@0
   176
IMPORT_C int kill(pid_t pid, int sig);
sl@0
   177
IMPORT_C int raise(int sig);
sl@0
   178
IMPORT_C int sigqueue(pid_t pid, int sig, const union sigval value);
sl@0
   179
sl@0
   180
IMPORT_C int sigfillset(sigset_t *set);
sl@0
   181
IMPORT_C int sigaddset(sigset_t *set, int signo);
sl@0
   182
IMPORT_C int sigdelset(sigset_t *set, int signo);
sl@0
   183
IMPORT_C int sigismember(const sigset_t *set, int signo);
sl@0
   184
IMPORT_C int sigandset(sigset_t * set, const sigset_t * left, const sigset_t * right);
sl@0
   185
IMPORT_C int sigorset(sigset_t * set, const sigset_t * left, const sigset_t * right);
sl@0
   186
IMPORT_C int sigisemptyset(const sigset_t * set);
sl@0
   187
sl@0
   188
IMPORT_C int sigprocmask(int how, const sigset_t* set,sigset_t* oset);
sl@0
   189
IMPORT_C int sighold(int signo);
sl@0
   190
IMPORT_C int sigrelse(int signo);
sl@0
   191
IMPORT_C int sigpause(int signo);
sl@0
   192
sl@0
   193
IMPORT_C int sigwait(const sigset_t *set, int *sig);
sl@0
   194
IMPORT_C int sigtimedwait(const sigset_t *set, siginfo_t *info,
sl@0
   195
       const struct timespec *timeout);
sl@0
   196
IMPORT_C int sigwaitinfo(const sigset_t *set, siginfo_t *info);
sl@0
   197
sl@0
   198
IMPORT_C void (*bsd_signal(int, void (*)(int)))(int);
sl@0
   199
IMPORT_C void (*sigset(int, void (*)(int)))(int);
sl@0
   200
IMPORT_C void (*signal(int, void (*)(int)))(int);
sl@0
   201
IMPORT_C int sigpending(sigset_t *set);
sl@0
   202
IMPORT_C int sigignore(int sig);
sl@0
   203
IMPORT_C void psignal(int sig, const char *s);
sl@0
   204
sl@0
   205
IMPORT_C int sigenable();
sl@0
   206
sl@0
   207
#endif
sl@0
   208
__END_DECLS
sl@0
   209
sl@0
   210
#endif /* !_SIGNAL_H_ */