01-05-2009
I'm not sure ( I didn't look closely at the code), but calling an IO function while handling an IO signal might be a problem. Also, when printing within signals, it's a good idea to call flush().
Also, why would you expect the program to call SIGHUP on itself when exiting? That's only the case if you're connected to a TTY which is closed on you.
9 More Discussions You Might Find Interesting
1. Post Here to Contact Site Administrators and Moderators
They appear to be turned on, I entered mine in. The check boxes are all checked. And yet, no sigs? (4 Replies)
Discussion started by: l008com
4 Replies
2. UNIX for Dummies Questions & Answers
I am thankful for this site and for the many links provided. I have been going through one of the tutorials, but as I try some things, they don't seem to work.
I am wondering if there is something I need first before being able to use a tutorial (like version number (HP-UX) or how I am getting... (1 Reply)
Discussion started by: arungavali
1 Replies
3. Shell Programming and Scripting
Hi all.
I have a script as below:
cutmth=`TZ=CST+2160 date +%b`
export cutmth
echo $cutmth >> date.log
sed -n "/$cutmth/$p" alert_sbdev1.log > alert_summ.log
My purpose is to run through the alert_sbdev1.log and find the 1st occurence of 'Jan' and send everything after that line to... (4 Replies)
Discussion started by: ahSher
4 Replies
4. Programming
Following code is detecting solaris daytime,when I run it,I can't get any result,code is follows:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFSIZE 150
int main(){
... (2 Replies)
Discussion started by: konvalo
2 Replies
5. Programming
I use Solaris 10, I use following code:
#include <signal.h>
int main(void){
printf("----------testing-----------");
if(signal(SIGUSR1,sig_usr)==SIG_ERR)
err_sys("can't catch SIGUSR1");
for(;;)
pause();
sig_user(int signo){
.....
}
when I run above code,it print nothing... (3 Replies)
Discussion started by: konvalo
3 Replies
6. Programming
hey all, im a new programmer.
i was wondering how you would go about writing the printf function yourself? it is my understanding that when you call printf you are calling an already written function and just providing an argument? if this is the case, is it possible to write that function... (8 Replies)
Discussion started by: Christian.B
8 Replies
7. HP-UX
Hello all!
I have problem in hp-ux 11.11 in awk
I want to grep sar -d 2 1 only 3 column, but have error in awk in hp-ux 11.11
Example:
#echo 123 234 | awk '{print $2}'
123 234
The situattions in commands bdf | awk {print $5}' some...
In hp-ux 11.31 - OK!
How resolve problem (15 Replies)
Discussion started by: ostapv
15 Replies
8. UNIX for Dummies Questions & Answers
#include<stdio.h>
int counter;
int fibonacci(int n)
{
counter += 1;
if ( n <= 2 )
return 1;
else
return fibonacci(n-1) + fibonacci(n-2);
}
int main(void)
{
int i;
int sum ;
for( i = 1 ; i<= 10; i++)
{
counter = 0;
sum... (1 Reply)
Discussion started by: vincent__tse
1 Replies
9. Shell Programming and Scripting
Hello:
I can't get equivalence classes to work in globs or when passing them to tr. If I understood correctly, matches e, é, è, ê, etc. But when using them with utilities like tr they don't work. Here's an example found in the POSIX standard:
I decided to create the aforementioned files in... (9 Replies)
Discussion started by: Cacializ
9 Replies
SIGNAL(2) System Calls Manual SIGNAL(2)
NAME
signal - catch or ignore signals
SYNOPSIS
#include <signal.h>
(*signal(sig, func))()
(*func)();
DESCRIPTION
A signal is generated by some abnormal event, initiated either by user at a typewriter (quit, interrupt), by a program error (bus error,
etc.), or by request of another program (kill). Normally all signals cause termination of the receiving process, but a signal call allows
them either to be ignored or to cause an interrupt to a specified location. Here is the list of signals with names as in the include file.
SIGHUP 1 hangup
SIGINT 2 interrupt
SIGQUIT 3* quit
SIGILL 4* illegal instruction (not reset when caught)
SIGTRAP 5* trace trap (not reset when caught)
SIGIOT 6* IOT instruction
SIGEMT 7* EMT instruction
SIGFPE 8* floating point exception
SIGKILL 9 kill (cannot be caught or ignored)
SIGBUS 10* bus error
SIGSEGV 11* segmentation violation
SIGSYS 12* bad argument to system call
SIGPIPE 13 write on a pipe or link with no one to read it
SIGALRM 14 alarm clock
SIGTERM 15 software termination signal
16 unassigned
The starred signals in the list above cause a core image if not caught or ignored.
If func is SIG_DFL, the default action for signal sig is reinstated; this default is termination, sometimes with a core image. If func is
SIG_IGN the signal is ignored. Otherwise when the signal occurs func will be called with the signal number as argument. A return from the
function will continue the process at the point it was interrupted. Except as indicated, a signal is reset to SIG_DFL after being caught.
Thus if it is desired to catch every such signal, the catching routine must issue another signal call.
When a caught signal occurs during certain system calls, the call terminates prematurely. In particular this can occur during a read or
write(2) on a slow device (like a typewriter; but not a file); and during pause or wait(2). When such a signal occurs, the saved user sta-
tus is arranged in such a way that when return from the signal-catching takes place, it will appear that the system call returned an error
status. The user's program may then, if it wishes, re-execute the call.
The value of signal is the previous (or initial) value of func for the particular signal.
After a fork(2) the child inherits all signals. Exec(2) resets all caught signals to default action.
SEE ALSO
kill(1), kill(2), ptrace(2), setjmp(3)
DIAGNOSTICS
The value (int)-1 is returned if the given signal is out of range.
BUGS
If a repeated signal arrives before the last one can be reset, there is no chance to catch it.
The type specification of the routine and its func argument are problematical.
ASSEMBLER
(signal = 48.)
sys signal; sig; label
(old label in r0)
If label is 0, default action is reinstated. If label is odd, the signal is ignored. Any other even label specifies an address in the
process where an interrupt is simulated. An RTI or RTT instruction will return from the interrupt.
SIGNAL(2)