Inizio delle considerazioni sull'uso della shared memory.
[gapil.git] / sources / SigHand.c
index 12a7c5b4bf1ab04d73655277cfd0462064ecd9ab..6b2cf95cf338ba4ae74ed25692c05b01f35aa362 100644 (file)
@@ -1,10 +1,28 @@
+/* SigHand.c
+ * 
+ * Copyright (C) 2002 Simone Piccardi
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
 /*****************************************************************************
  *
  * File SigHand.c: define a set of functions for signal manipulation 
  *
  * Author: S. Piccardi Dec. 2002
  *
- * $Id: SigHand.c,v 1.1 2002/12/03 11:06:05 piccardi Exp $
+ * $Id: SigHand.c,v 1.3 2002/12/11 00:51:38 piccardi Exp $
  *
  *****************************************************************************/
 #include <errno.h>                               /* error simbol definitions */
 inline SigFunc * Signal(int signo, SigFunc *func) 
 {
     struct sigaction new_handl, old_handl;
-    new_handl.sa_handler=func;
+    new_handl.sa_handler = func;                      /* set signal handler */
     /* clear signal mask: no signal blocked during execution of func */
-    if (sigemptyset(&new_handl.sa_mask)!=0){        /* initialize signal set */
-        perror("cannot initializes the signal set to empty");   /* see mess. */
-        exit(1);
+    if (sigemptyset(&new_handl.sa_mask)!=0){       /* initialize signal set */
+        return SIG_ERR;
     }
-    new_handl.sa_flags=0;                  /* init to 0 all flags */
+    new_handl.sa_flags=0;                            /* init to 0 all flags */
     /* change action for signo signal */
     if (sigaction(signo,&new_handl,&old_handl)){ 
-        perror("sigaction failed on signal action setting");
-       exit(1);
+        return SIG_ERR;
     }
     return (old_handl.sa_handler);
 }
@@ -50,7 +66,7 @@ inline SigFunc * Signal(int signo, SigFunc *func)
  * Generic handler for SIGCHLD signal
  * 
  * Simone Piccardi Dec. 2002
- * $Id: SigHand.c,v 1.1 2002/12/03 11:06:05 piccardi Exp $
+ * $Id: SigHand.c,v 1.3 2002/12/11 00:51:38 piccardi Exp $
  */
 void HandSigCHLD(int sig)
 {