读书人

UNIX编程(十)-信号

发布时间: 2012-07-25 09:43:06 作者: rapoo

UNIX编程(10)-信号

1.signal函数

?

*restrict act, struct sigaction *restrict oact);

?

Returns: 0 if OK, 1 on error

struct sigaction {
?????? void????? (*sa_handler)(int);?? /* addr of signal handler, */
?????????????????????????????????????? /* or SIG_IGN, or SIG_DFL */
?????? sigset_t sa_mask;?????????????? /* additional signals to block */
?????? int????? sa_flags;????????????? /* signal options, Figure 10.16 */

?????? /* alternate handler */
?????? void???? (*sa_sigaction)(int, siginfo_t *, void *);
??? };
11.sigsetjmp和siglongjmp函数

?

?

#include <setjmp.h>int sigsetjmp(sigjmp_buf env, int savemask);

?

Returns: 0 if called directly, nonzero if returning from a call to siglongjmp

void siglongjmp(sigjmp_buf env, int val);

?

12.sigsuspend函数

?

?

#include <signal.h>int sigsuspend(const sigset_t *sigmask);

?

Returns: 1 with errno set to EINTR

?

?13.abort函数

?

?

#include <stdlib.h>void abort(void);

?

This function never returns


14.system函数

15.sleep函数

?

?

#include <unistd.h>unsigned int sleep(unsigned int seconds);

?

Returns: 0 or number of unslept seconds

?

16.其他函数

?

#include <signal.h>void psignal(int signo, const char *msg);

?


?

#include <string.h>char *strsignal(int signo);

?

Returns: a pointer to a string describing the signal


?

#include <signal.h>int sig2str(int signo, char *str);int str2sig(const char *str, int *signop);

?

Both return: 0 if OK, 1 on error

?

读书人网 >编程

热点推荐