Octave-Forge - Extra packages for GNU Octave | |
Home · Packages · Developers · Documentation · FAQ · Bugs · Mailing Lists · Links · Code |
00001 /* -*- buffer-read-only: t -*- vi: set ro: */ 00002 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 00003 /* Convenience declarations when working with <signal.h>. 00004 00005 Copyright (C) 2008-2011 Free Software Foundation, Inc. 00006 00007 This program is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 #ifndef _GL_SIG_HANDLER_H 00021 #define _GL_SIG_HANDLER_H 00022 00023 #include <signal.h> 00024 00025 /* Convenience type when working with signal handlers. */ 00026 typedef void (*sa_handler_t) (int); 00027 00028 /* Return the handler of a signal, as a sa_handler_t value regardless 00029 of its true type. The resulting function can be compared to 00030 special values like SIG_IGN but it is not portable to call it. */ 00031 static inline sa_handler_t 00032 get_handler (struct sigaction const *a) 00033 { 00034 #ifdef SA_SIGINFO 00035 /* POSIX says that special values like SIG_IGN can only occur when 00036 action.sa_flags does not contain SA_SIGINFO. But in Linux 2.4, 00037 for example, sa_sigaction and sa_handler are aliases and a signal 00038 is ignored if sa_sigaction (after casting) equals SIG_IGN. So 00039 use (and cast) sa_sigaction in that case. */ 00040 if (a->sa_flags & SA_SIGINFO) 00041 return (sa_handler_t) a->sa_sigaction; 00042 #endif 00043 return a->sa_handler; 00044 } 00045 00046 #endif /* _GL_SIG_HANDLER_H */