02-29-2012
when a user hits the interrupt key, the kernel sends a SIGINT to all processes associated with a terminal... Usually when you type ctrl-c... but there is nothing stopping you to define another key, look at the stty man pages...
More reading:
Proper handling of SIGINT/SIGQUIT
10 More Discussions You Might Find Interesting
1. Programming
I setup termios structure with IGNBRK is not set and BRKINT is set.
To allow the process to receive signals I call: fcntl(fd, F_SETOWN, getpid());
I have made a signal handler to catch all signals. I can catch SIGINT when pressing ctrl+c but when I send break signal over serial then it cannot... (13 Replies)
Discussion started by: gzz
13 Replies
2. Shell Programming and Scripting
Hi,
I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ).
Eg:
0000001
0000220
0001235
0000022
0000023
...........
.........
........
Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies
3. Programming
For a program I am designing, which involves handling the keyboard input Ctrl^c (SIGINT), it is taking ages for the program to actually recognise and perform the corresponding action whenever I run it and hit Ctrl^C at the CL. I have to do at least 3 Ctrl^Cs before the program will actually... (3 Replies)
Discussion started by: JamesGoh
3 Replies
4. Programming
Hi all,
I have this method to read a string from a STDIN:
void readLine(char* inputBuffer){
fgets (inputBuffer, MAX_LINE, stdin);
fflush(stdin);
/* remove '\n' char from string */
if(strlen(inputBuffer) != 0)
inputBuffer = '\0';
}
All work fine but if i... (1 Reply)
Discussion started by: hurricane86
1 Replies
5. Shell Programming and Scripting
I've written a bash script which captures video with DVgrab. Because of the nature of the tapes that I am digitizing, sometimes I want to quit capturing before the time that I set for DVgrab. When this is the case I press Ctrl-c and DVgrab exits cleanly, my problem is that there is additional... (5 Replies)
Discussion started by: Starcast
5 Replies
6. Programming
hi,
in my application, i have set up to capture SIGINT and execute a handler.the problem is whenever i hit C-c, multiple SIGINT are sent to the application.I have blocked the SIGINT right after catching the first one but it is unsuccessful.Here is what i do :
jmp_buf main_loop;
int... (1 Reply)
Discussion started by: Sedighzadeh
1 Replies
7. Shell Programming and Scripting
Good day,
I am trying to add signal handling capabilities to some of my scripts. Unfortunately, I am having some difficulty with the manner in which signals are propagated between parent/child processes. Consider the following example:
I have the following "parent" script:
#!/usr/bin/sh... (5 Replies)
Discussion started by: danie.ludick
5 Replies
8. Shell Programming and Scripting
Hello,
What I want to accomplish is this:
I have made a very simple script that runs 2 commands, polipo proxy and tor. The script runs successfully and the output of tor is visible to the screen.
I am using the trap command in order to catch the ctrl+c button combo in order to stop polipo... (5 Replies)
Discussion started by: redsolja
5 Replies
9. Shell Programming and Scripting
Tried to add a function to my control_c interrupt here. It works but has one little bug. If the user selects to run the function instead of exiting, the program restarts itself without forking as it should. However, after that control_c no longer works again. I wanted to allow the user to run... (1 Reply)
Discussion started by: Azrael
1 Replies
10. Shell Programming and Scripting
The following command will run and wait for input from the user.
/usr/sap/SAP/webdisp/wdispmon pf=/usr/sap/SAP/webdisp/profile
What I would like to do is (in one command):
- Add the above line to a ksh script
- Receive the output
- and send a SIGINT
I have seen many posts on how to... (3 Replies)
Discussion started by: sapsid
3 Replies
LEARN ABOUT NETBSD
sigblock
SIGBLOCK(3) BSD Library Functions Manual SIGBLOCK(3)
NAME
sigblock -- block signals
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <signal.h>
int
sigblock(int mask);
int
sigmask(signum);
DESCRIPTION
This interface is made obsolete by: sigprocmask(2).
sigblock() adds the signals specified in mask to the set of signals currently being blocked from delivery. Signals are blocked if the corre-
sponding bit in mask is a 1; the macro sigmask() is provided to construct the mask for a given signum.
It is not possible to block SIGKILL or SIGSTOP; this restriction is silently imposed by the system.
RETURN VALUES
The previous set of masked signals is returned.
EXAMPLES
The following example using sigblock():
int omask;
omask = sigblock(sigmask(SIGINT) | sigmask(SIGHUP));
Becomes:
sigset_t set, oset;
sigemptyset(&set);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGHUP);
sigprocmask(SIG_BLOCK, &set, &oset);
Another use of sigblock() is to get the current set of masked signals without changing what is actually blocked. Instead of:
int set;
set = sigblock(0);
Use the following:
sigset_t set;
sigprocmask(SIG_BLOCK, NULL, &set);
SEE ALSO
kill(2), sigaction(2), sigprocmask(2), sigsetmask(3), sigsetops(3)
HISTORY
The sigblock() function call appeared in 4.2BSD and has been deprecated.
BSD
August 10, 2002 BSD