1 #define _sio_main_c_ 2 #include "syshdrs.h" 3 4 int gLibSio_Uses_Me_To_Quiet_Variable_Unused_Warnings = 0; 5 6 #ifndef NO_SIGNALS 7 8 volatile Sjmp_buf gNetTimeoutJmp; 9 volatile Sjmp_buf gPipeJmp; 10 11 void SIOHandler(int sigNum)12SIOHandler(int sigNum) 13 { 14 if (sigNum == SIGPIPE) 15 SLongjmp(gPipeJmp, 1); 16 SLongjmp(gNetTimeoutJmp, 1); 17 } /* SIOHandler */ 18 19 20 21 SSignal(int signum,void (* handler)(int))22void (*SSignal(int signum, void (*handler)(int)))(int) 23 { 24 #ifdef HAVE_SIGACTION 25 struct sigaction sa, osa; 26 27 (void) sigemptyset(&sa.sa_mask); 28 sa.sa_flags = 0; 29 sa.sa_handler = handler; 30 if (signum == SIGALRM) { 31 #ifdef SA_INTERRUPT 32 sa.sa_flags |= SA_INTERRUPT; 33 #endif 34 } else { 35 #ifdef SA_RESTART 36 sa.sa_flags |= SA_RESTART; 37 #endif 38 } 39 if (sigaction(signum, &sa, &osa) < 0) 40 return (SIG_ERR); 41 return (osa.sa_handler); 42 #else 43 return SSignal(signum, handler); 44 #endif /* HAVE_SIGACTION */ 45 } 46 47 #endif /* NO_SIGNALS */ 48 49 /* eof main.c */ 50