1 # This one is a bit trickier than error.awk, because sys/signal.h is not as
2 # easy to parse. We currently assume that all (userland) signals are listed
3 # before the first reference to "_KERNEL", and anything else that looks like a
4 # signal definition (but isn't) is after that first reference.
7 printf("/* This file is automatically generated by signal.awk */\n\n");
8 printf("#include \"inc.h\"\n\n");
9 printf("static const char *const signals[] = {\n");
13 if (!
match(name
, "SIG[^_]"))
16 if (number
< 0 || number ==
"SIGABRT")
18 printf("\t[%s] = \"%s\",\n", name
, name
);
25 printf("const char *\nget_signal_name(int sig)\n{\n\n");
26 printf("\tif (sig >= 0 && (unsigned int)sig < __arraycount(signals) &&\n");
27 printf("\t signals[sig] != NULL)\n");
28 printf("\t\treturn signals[sig];\n");
30 printf("\t\treturn NULL;\n");