1######################################################################## 2# # 3# This software is part of the ast package # 4# Copyright (c) 1985-2009 AT&T Intellectual Property # 5# and is licensed under the # 6# Common Public License, Version 1.0 # 7# by AT&T Intellectual Property # 8# # 9# A copy of the License is available at # 10# http://www.opensource.org/licenses/cpl1.0.txt # 11# (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) # 12# # 13# Information and Software Systems Research # 14# AT&T Research # 15# Florham Park NJ # 16# # 17# Glenn Fowler <gsf@research.att.com> # 18# David Korn <dgk@research.att.com> # 19# Phong Vo <kpv@research.att.com> # 20# # 21######################################################################## 22: generate sig features 23case $# in 240) ;; 25*) eval $1 26 shift 27 ;; 28esac 29echo "#include <signal.h> 30int xxx;" > $tmp.c 31$cc -c $tmp.c >/dev/null 2>$tmp.e 32echo "#pragma prototyped 33#define sig_info _sig_info_ 34 35#if defined(__STDPP__directive) && defined(__STDPP__hide) 36__STDPP__directive pragma pp:hide kill killpg 37#else 38#define kill ______kill 39#define killpg ______killpg 40#endif 41#include <signal.h> 42#if defined(__STDPP__directive) && defined(__STDPP__hide) 43__STDPP__directive pragma pp:nohide kill killpg 44#else 45#undef kill 46#undef killpg 47#endif 48#ifndef sigmask 49#define sigmask(s) (1<<((s)-1)) 50#endif" 51echo "#include <signal.h> 52#ifdef TYPE 53#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus) 54typedef TYPE (*Sig_handler_t)(ARG); 55#else 56typedef TYPE (*Sig_handler_t)(); 57#endif 58#endif 59Sig_handler_t f() 60{ 61 Sig_handler_t handler; 62 handler = signal(1, SIG_IGN); 63 return(handler); 64}" > $tmp.c 65if $cc -c $tmp.c >/dev/null 66then : 67else e=`wc -l $tmp.e` 68 i1= j1= 69 for i in void int 70 do for j in int,... ... int 71 do $cc -c -DTYPE=$i -DARG=$j $tmp.c >/dev/null 2>$tmp.e || continue 72 case `wc -l $tmp.e` in 73 $e) i1= j1=; break 2 ;; 74 esac 75 case $i1 in 76 "") i1=$i j1=$j ;; 77 esac 78 done 79 done 80 case $i1 in 81 ?*) i=$i1 j=$j1 ;; 82 esac 83 echo "typedef $i (*Sig_handler_t)($j);" 84fi 85echo ' 86 87#define Handler_t Sig_handler_t 88 89#define SIG_REG_PENDING (-1) 90#define SIG_REG_POP 0 91#define SIG_REG_EXEC 00001 92#define SIG_REG_PROC 00002 93#define SIG_REG_TERM 00004 94#define SIG_REG_ALL 00777 95#define SIG_REG_SET 01000 96 97typedef struct 98{ 99 char** name; 100 char** text; 101 int sigmax; 102} Sig_info_t; 103 104extern int kill(pid_t, int); 105extern int killpg(pid_t, int); 106 107#if _BLD_ast && defined(__EXPORT__) 108#define extern extern __EXPORT__ 109#endif 110#if !_BLD_ast && defined(__IMPORT__) 111#define extern extern __IMPORT__ 112#endif 113 114extern Sig_info_t sig_info; 115 116#undef extern 117 118#if _BLD_ast && defined(__EXPORT__) 119#define extern __EXPORT__ 120#endif 121 122extern int sigcritical(int); 123extern int sigunblock(int); 124 125#undef extern' 126