imapext-2007

view src/osdep/unix/sig_psx.c @ 0:ada5e610ab86

imap-2007e
author yuuji@gentei.org
date Mon, 14 Sep 2009 15:17:45 +0900
parents
children
line source
1 /* ========================================================================
2 * Copyright 1988-2006 University of Washington
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 *
11 * ========================================================================
12 */
14 /*
15 * Program: POSIX Signals
16 *
17 * Author: Mark Crispin
18 * Networks and Distributed Computing
19 * Computing & Communications
20 * University of Washington
21 * Administration Building, AG-44
22 * Seattle, WA 98195
23 * Internet: MRC@CAC.Washington.EDU
24 *
25 * Date: 29 April 1997
26 * Last Edited: 30 August 2006
27 */
29 #include <signal.h>
30 #include <string.h>
32 #ifndef SA_RESTART
33 #define SA_RESTART 0
34 #endif
36 /* Arm a signal
37 * Accepts: signal number
38 * desired action
39 * Returns: old action
40 */
42 void *arm_signal (int sig,void *action)
43 {
44 struct sigaction nact,oact;
45 memset (&nact,0,sizeof (struct sigaction));
46 sigemptyset (&nact.sa_mask); /* no signals blocked */
47 nact.sa_handler = action; /* set signal handler */
48 nact.sa_flags = SA_RESTART; /* needed on Linux, nice on SVR4 */
49 sigaction (sig,&nact,&oact); /* do the signal action */
50 return (void *) oact.sa_handler;
51 }

UW-IMAP'd extensions by yuuji