[BACK]Return to mysig.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / plugin

Diff for /OpenXM/src/kan96xx/plugin/Attic/mysig.c between version 1.2 and 1.4

version 1.2, 2016/03/30 09:20:40 version 1.4, 2016/03/31 03:22:55
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kan96xx/plugin/mysig.c,v 1.1 2016/03/30 08:25:43 takayama Exp $ */  /* $OpenXM: OpenXM/src/kan96xx/plugin/mysig.c,v 1.3 2016/03/30 21:34:03 takayama Exp $ */
 #include <stdio.h>  #include <stdio.h>
 #include <signal.h>  #include <signal.h>
 #include <unistd.h>  #include <unistd.h>
Line 6 
Line 6 
 #include <string.h>  #include <string.h>
 #include "mysig.h"  #include "mysig.h"
   
   static void *Old_handler;
 /*  /*
   sigset SIGINT, SIGCHLD, SIGUSR1    sigset SIGINT, SIGCHLD, SIGUSR1
  */   */
Line 34  int block_signal(int sigset[]) {
Line 35  int block_signal(int sigset[]) {
 int set_signal(int sig,void (*handler)(int m)) {  int set_signal(int sig,void (*handler)(int m)) {
   struct sigaction act;    struct sigaction act;
   struct sigaction oldact;    struct sigaction oldact;
     int val;
   act.sa_handler=handler;    act.sa_handler=handler;
   act.sa_flags=0;    act.sa_flags=0;
   act.sa_flags |= SA_RESTART;    act.sa_flags |= SA_RESTART;
   sigemptyset(&act.sa_mask);    sigemptyset(&act.sa_mask);
   return(sigaction(sig,&act,&oldact));    val=sigaction(sig,&act,&oldact);
     Old_handler = oldact.sa_handler;
     return(val);
   }
   /*
     my own emulation of signal for portability.
    */
   void *mysignal(int sig,void (*handler)(int m)) {
     int sigset[2];
     if (handler == SIG_IGN) {
       /*    sigset[0] = sig; sigset[1]=0;
       block_signal(sigset);
       return(SIG_IGN);*/
       return(signal(sig,handler));
     }else if (handler == SIG_DFL) {
       return(signal(sig,handler));
     }
     /* on unix system, you may simply call signal(3) here.  */
     set_signal(sig,handler);
     /* unblock is necessary on cygwin, ... */
     sigset[0] = sig; sigset[1]=0; unblock_signal(sigset);
     return((void *)Old_handler);
 }  }
   
   

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>