42 |
#undef sys_nsig |
#undef sys_nsig |
43 |
|
|
44 |
#ifndef NULL |
#ifndef NULL |
45 |
# ifdef __STDC__ |
# ifdef ANSI_PROTOTYPES |
46 |
# define NULL (void *) 0 |
# define NULL (void *) 0 |
47 |
# else |
# else |
48 |
# define NULL 0 |
# define NULL 0 |
67 |
|
|
68 |
struct signal_info |
struct signal_info |
69 |
{ |
{ |
70 |
int value; /* The numeric value from <signal.h> */ |
const int value; /* The numeric value from <signal.h> */ |
71 |
const char *name; /* The equivalent symbolic value */ |
const char *const name; /* The equivalent symbolic value */ |
72 |
#ifndef HAVE_SYS_SIGLIST |
#ifndef HAVE_SYS_SIGLIST |
73 |
const char *msg; /* Short message about this value */ |
const char *const msg; /* Short message about this value */ |
74 |
#endif |
#endif |
75 |
}; |
}; |
76 |
|
|
350 |
|
|
351 |
/* |
/* |
352 |
|
|
353 |
NAME |
@deftypefn Extension int signo_max (void) |
|
|
|
|
signo_max -- return the max signo value |
|
|
|
|
|
SYNOPSIS |
|
354 |
|
|
355 |
int signo_max (); |
Returns the maximum signal value for which a corresponding symbolic |
356 |
|
name or message is available. Note that in the case where we use the |
357 |
|
@code{sys_siglist} supplied by the system, it is possible for there to |
358 |
|
be more symbolic names than messages, or vice versa. In fact, the |
359 |
|
manual page for @code{psignal(3b)} explicitly warns that one should |
360 |
|
check the size of the table (@code{NSIG}) before indexing it, since |
361 |
|
new signal codes may be added to the system before they are added to |
362 |
|
the table. Thus @code{NSIG} might be smaller than value implied by |
363 |
|
the largest signo value defined in @code{<signal.h>}. |
364 |
|
|
365 |
DESCRIPTION |
We return the maximum value that can be used to obtain a meaningful |
366 |
|
symbolic name or message. |
|
Returns the maximum signo value for which a corresponding symbolic |
|
|
name or message is available. Note that in the case where |
|
|
we use the sys_siglist supplied by the system, it is possible for |
|
|
there to be more symbolic names than messages, or vice versa. |
|
|
In fact, the manual page for psignal(3b) explicitly warns that one |
|
|
should check the size of the table (NSIG) before indexing it, |
|
|
since new signal codes may be added to the system before they are |
|
|
added to the table. Thus NSIG might be smaller than value |
|
|
implied by the largest signo value defined in <signal.h>. |
|
367 |
|
|
368 |
We return the maximum value that can be used to obtain a meaningful |
@end deftypefn |
|
symbolic name or message. |
|
369 |
|
|
370 |
*/ |
*/ |
371 |
|
|
385 |
|
|
386 |
/* |
/* |
387 |
|
|
388 |
NAME |
@deftypefn Supplemental {const char *} strsignal (int @var{signo}) |
389 |
|
|
390 |
strsignal -- map a signal number to a signal message string |
Maps an signal number to an signal message string, the contents of |
391 |
|
which are implementation defined. On systems which have the external |
392 |
|
variable @code{sys_siglist}, these strings will be the same as the |
393 |
|
ones used by @code{psignal()}. |
394 |
|
|
395 |
SYNOPSIS |
If the supplied signal number is within the valid range of indices for |
396 |
|
the @code{sys_siglist}, but no message is available for the particular |
397 |
|
signal number, then returns the string @samp{Signal @var{num}}, where |
398 |
|
@var{num} is the signal number. |
399 |
|
|
400 |
const char *strsignal (int signo) |
If the supplied signal number is not a valid index into |
401 |
|
@code{sys_siglist}, returns @code{NULL}. |
402 |
|
|
403 |
DESCRIPTION |
The returned string is only guaranteed to be valid only until the next |
404 |
|
call to @code{strsignal}. |
|
Maps an signal number to an signal message string, the contents of |
|
|
which are implementation defined. On systems which have the external |
|
|
variable sys_siglist, these strings will be the same as the ones used |
|
|
by psignal(). |
|
|
|
|
|
If the supplied signal number is within the valid range of indices |
|
|
for the sys_siglist, but no message is available for the particular |
|
|
signal number, then returns the string "Signal NUM", where NUM is the |
|
|
signal number. |
|
405 |
|
|
406 |
If the supplied signal number is not a valid index into sys_siglist, |
@end deftypefn |
|
returns NULL. |
|
|
|
|
|
The returned string is only guaranteed to be valid only until the |
|
|
next call to strsignal. |
|
407 |
|
|
408 |
*/ |
*/ |
409 |
|
|
449 |
|
|
450 |
/* |
/* |
451 |
|
|
452 |
NAME |
@deftypefn Extension {const char*} strsigno (int @var{signo}) |
|
|
|
|
strsigno -- map an signal number to a symbolic name string |
|
|
|
|
|
SYNOPSIS |
|
|
|
|
|
const char *strsigno (int signo) |
|
|
|
|
|
DESCRIPTION |
|
453 |
|
|
454 |
Given an signal number, returns a pointer to a string containing |
Given an signal number, returns a pointer to a string containing the |
455 |
the symbolic name of that signal number, as found in <signal.h>. |
symbolic name of that signal number, as found in @code{<signal.h>}. |
456 |
|
|
457 |
If the supplied signal number is within the valid range of indices |
If the supplied signal number is within the valid range of indices for |
458 |
for symbolic names, but no name is available for the particular |
symbolic names, but no name is available for the particular signal |
459 |
signal number, then returns the string "Signal NUM", where NUM is |
number, then returns the string @samp{Signal @var{num}}, where |
460 |
the signal number. |
@var{num} is the signal number. |
461 |
|
|
462 |
If the supplied signal number is not within the range of valid |
If the supplied signal number is not within the range of valid |
463 |
indices, then returns NULL. |
indices, then returns @code{NULL}. |
464 |
|
|
465 |
BUGS |
The contents of the location pointed to are only guaranteed to be |
466 |
|
valid until the next call to @code{strsigno}. |
467 |
|
|
468 |
The contents of the location pointed to are only guaranteed to be |
@end deftypefn |
|
valid until the next call to strsigno. |
|
469 |
|
|
470 |
*/ |
*/ |
471 |
|
|
504 |
|
|
505 |
/* |
/* |
506 |
|
|
507 |
NAME |
@deftypefn Extension int strtosigno (const char *@var{name}) |
|
|
|
|
strtosigno -- map a symbolic signal name to a numeric value |
|
508 |
|
|
509 |
SYNOPSIS |
Given the symbolic name of a signal, map it to a signal number. If no |
510 |
|
translation is found, returns 0. |
511 |
|
|
512 |
int strtosigno (char *name) |
@end deftypefn |
|
|
|
|
DESCRIPTION |
|
|
|
|
|
Given the symbolic name of a signal, map it to a signal number. |
|
|
If no translation is found, returns 0. |
|
513 |
|
|
514 |
*/ |
*/ |
515 |
|
|
544 |
|
|
545 |
/* |
/* |
546 |
|
|
547 |
NAME |
@deftypefn Supplemental void psignal (unsigned @var{signo}, char *@var{message}) |
548 |
|
|
549 |
psignal -- print message about signal to stderr |
Print @var{message} to the standard error, followed by a colon, |
550 |
|
followed by the description of the signal specified by @var{signo}, |
551 |
|
followed by a newline. |
552 |
|
|
553 |
SYNOPSIS |
@end deftypefn |
|
|
|
|
void psignal (unsigned signo, char *message); |
|
|
|
|
|
DESCRIPTION |
|
554 |
|
|
|
Print to the standard error the message, followed by a colon, |
|
|
followed by the description of the signal specified by signo, |
|
|
followed by a newline. |
|
555 |
*/ |
*/ |
556 |
|
|
557 |
#ifndef HAVE_PSIGNAL |
#ifndef HAVE_PSIGNAL |