11-02-2004
There is nothing such as 'name of the signal'. I guess you are refferring to the defined macros for the signal numbers.
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt (rubout) */
#define SIGQUIT 3 /* quit (ASCII FS) */
There are couple of ways to find out the description of the caught signal. One can call below functions to get the description:
void psignal(int sig, const char *s);
void psiginfo(siginfo_t *pinfo, char *s);
These functions are defined in <siginfo.h>
Coming to your second question:
As per my understanding, there is no generic function to catch all the signals. It is necessary to specify the signal you want handle.
Hope this helps.
Last edited by A452917; 11-02-2004 at 06:48 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
when I execute a script on unix AIX, I've got an error message:
"Execution: 85328 Signal d'alarme".
If I edit this file with "vi", I ve got the same error after a while (about 1 minute).
If I try with another user I still have the problem.
But if I rename this file, no problem.
My... (5 Replies)
Discussion started by: cgsteph
5 Replies
2. UNIX for Advanced & Expert Users
Hello,
I'm doing a project of OS simulation (Process Scheduling, to be very specific). Can anyone, please, explain what exactly happens in the background when we see "Sending all processes the KILL signal...........". How is it sent to each process? Is it that something like a boolean is stored... (3 Replies)
Discussion started by: ameya
3 Replies
3. Programming
I am using the signal function, and passing it a function named quit procedure...I get the following warning....
passing arg2 of signal from incompatible pointer type...
void quit_procedure(void); //this is the way i define my prototype...
signal(SIGINT, quit_procedure);
Please guide... (5 Replies)
Discussion started by: jacques83
5 Replies
4. Programming
Hi!
I want to catch all signals that my program receives print their name and then execute the default handler.
Can you help me on that?
I've tried the following code:
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
void (*hnd)(int i);
char signals =
{
"SIGHUP",... (7 Replies)
Discussion started by: dark_knight
7 Replies
5. Shell Programming and Scripting
Hi all
I have Master script, Main script ,and 4 Child script.
Master.sh
#!/bin/bash
/export/home/user/Main.shMain.sh
#!/bin/bash
/export/home/user/Child1.sh &
/export/home/user/Child2.sh &
/export/home/user/Child3.sh &
/export/home/user/Child4.sh &I run only Master.sh script... (1 Reply)
Discussion started by: almanto
1 Replies
6. Programming
I'am expecting a signal, but no signal is received when the stack-size reaches 10 bytes.
Here in this code i'am setting rlim_cur=10bytes.
To be more precise, when it reaches 10 bytes the process must receive a SIGSEGV signal? But i find no signal being received.
Am i missing something in this... (0 Replies)
Discussion started by: prajwalps97
0 Replies
7. Programming
We have written a deamon which have many threads.
We are registering for the SIGTERM and trying to close main thread in this signal handling. Actually these are running on Mac OS X ( BSD unix). When we are unloading the deamon with command launchctl, it's sending SIGTERM signal to our process... (1 Reply)
Discussion started by: Akshay4u
1 Replies
8. UNIX for Dummies Questions & Answers
Hi,
I am basically new to signals in UNIX. My question is, should the signal() command be called only once in the program? What will happen if it's called multiple times? I am trying to write an alarm program where the signal handler function changes in runtime. It just doesn't work if I... (2 Replies)
Discussion started by: bashdrew
2 Replies
9. Shell Programming and Scripting
Sun Solaris Unix Question
Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies
10. Shell Programming and Scripting
Data files coming in different names in a file name called process.txt.
1. shipments_yyyymmdd.gz
2 Order_yyyymmdd.gz
3. Invoice_yyyymmdd.gz
4. globalorder_yyyymmdd.gz
The process needs to discard all the below files and only process two of the 4 file names available
... (1 Reply)
Discussion started by: dsravanam
1 Replies
LEARN ABOUT X11R4
psignal
PSIGNAL(3) Linux Programmer's Manual PSIGNAL(3)
NAME
psignal, psiginfo - print signal message
SYNOPSIS
#include <signal.h>
void psignal(int sig, const char *s);
void psiginfo(const siginfo_t *pinfo, const char *s);
extern const char *const sys_siglist[];
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
psignal():
Since glibc 2.19:
_DEFAULT_SOURCE
Glibc 2.19 and earlier:
_BSD_SOURCE || _SVID_SOURCE
psiginfo(): _POSIX_C_SOURCE >= 200809L
sys_siglist:
Since glibc 2.19:
_DEFAULT_SOURCE
Glibc 2.19 and earlier:
_BSD_SOURCE
DESCRIPTION
The psignal() function displays a message on stderr consisting of the string s, a colon, a space, a string describing the signal number
sig, and a trailing newline. If the string s is NULL or empty, the colon and space are omitted. If sig is invalid, the message displayed
will indicate an unknown signal.
The psiginfo() function is like psignal(), except that it displays information about the signal described by pinfo, which should point to a
valid siginfo_t structure. As well as the signal description, psiginfo() displays information about the origin of the signal, and other
information relevant to the signal (e.g., the relevant memory address for hardware-generated signals, the child process ID for SIGCHLD, and
the user ID and process ID of the sender, for signals set using kill(2) or sigqueue(3)).
The array sys_siglist holds the signal description strings indexed by signal number.
RETURN VALUE
The psignal() and psiginfo() functions return no value.
VERSIONS
The psiginfo() function was added to glibc in version 2.10.
ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7).
+----------------------+---------------+----------------+
|Interface | Attribute | Value |
+----------------------+---------------+----------------+
|psignal(), psiginfo() | Thread safety | MT-Safe locale |
+----------------------+---------------+----------------+
CONFORMING TO
POSIX.1-2008, 4.3BSD.
BUGS
In glibc versions up to 2.12, psiginfo() had the following bugs:
* In some circumstances, a trailing newline is not printed.
* Additional details are not displayed for real-time signals.
SEE ALSO
sigaction(2), perror(3), strsignal(3), signal(7)
COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the
latest version of this page, can be found at https://www.kernel.org/doc/man-pages/.
GNU
2017-09-15 PSIGNAL(3)