sigwait system call in UNIX signal


 
Thread Tools Search this Thread
Top Forums Programming sigwait system call in UNIX signal
# 1  
Old 04-22-2004
sigwait system call in UNIX signal

Hi Everybody,
I have gone through man of sigwait and new to UNIX signals. Could anyone explain me about the following lines mentioned in sigwait man help ?

"The selection of a signal in set is independent of the signal
mask of the calling thread or LWP. This means a thread or
LWP can synchronously wait for signals that are being
blocked by the signal mask of the calling thread or LWP."

What is the difference between sigsuspend and sigwait system call as both system call blocks the process till the signal arrives ?

Regards
Dinesh
# 2  
Old 04-26-2004
Thanks for your descriptive reply.

I have one query regarding the behaviour of sigwait system call.

Let us suppose that I have blocked the signal SIGUSR1 by calling sigprocmask() function and I have set the signal handler for SIGUSR1 by calling signal function.

static void sig_usr1(int signo) {
printf("Signal SIGUSR1 Fired!\n");
}

signal(SIGUSR1,sig_usr1);
sigset_t usrmask;

sigemptyset(&usrmask);
sigaddset(&usrmask,SIGUSR1);

sigprocmask(SIG_BLOCK,&usrmask,NULL);

sigwait(&usrmask,&signo);

Does sigwait() calls the signal handler for the signal which has caused it to return ? What I means that does, in above case, the signal handler will be called when i explicitly sends the signal SIGUSR1 to the process or do I need to unblock the signal to get signal handler get called ?

sigprocmask(SIG_UNBLOCK,&usrmask,NULL);

Regards
Dinesh
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Nanosleep in signal call

Hi @ll :) I have a problem with my code but first a short description: 1. I have one signal call SIGUSR1 2. In the signal I try to use nanosleep and now: When I put kill -SIGUSR1 pid --> sometimes works fine, sometimes returns me an error with ,,Interrupt system call", sometimes I got... (5 Replies)
Discussion started by: mattdj
5 Replies

2. AIX

AIX - remote shell (sudo) - signal 11 core system 50

Hi, I am running a remote shell from site A to site B, where both are AIX. The remote shell starts other application, and when it finishes, it returns to the site A. The problem is that I am receiving an error signal 11 and system core error 50 - segmentation fault. Does anyone know if there are... (6 Replies)
Discussion started by: brjohnsmith
6 Replies

3. Programming

UNIX system call in COBOL

Hi, The UNIX system call inside the COBOL program is doing the specified command correctly. MOVE W080-UNZIP-FILE-COMMAND TO W080-OUTPUT-COMMAND CALL "SYSTEM" USING W080-OUTPUT-COMMAND RETURNING W080-SYS-CALL-STATUS BUT The problem is, the following keeps on showing on the log file... (2 Replies)
Discussion started by: joyAV
2 Replies

4. Programming

Signal Handlers using sigwait

After an extensive search, I haven't found a definitive answer to my question. "And what is your question you frackking noob", you may ask. Ok, here goes: When using sigwait to wait for SIGUSR1 or SIGUSR2, can you have it trigger a signal handler? The following code did NOT, and the example I got... (2 Replies)
Discussion started by: bcfd36
2 Replies

5. Programming

system call

I have a cgi script which is called after certain time interval, which has this: system ("ls -l /tmp/cgic* | grep -v \"cgicsave.env\" | awk '{print $5}'"); During the execution of this script,the output is 0 sometimes. But due to this the system call is not working at all and doesnt o/p... (2 Replies)
Discussion started by: xs2punit
2 Replies

6. Programming

Error: too many arguments to function 'sigwait'

#include <pthread.h> #include <signal.h> ... sigset_t mask; int err,signo; err=sigwait(&mask,&signo); switch(signo){ case SIGINT: ... } when I compile above code under solaris 10,it raise following error: error: too many arguments to function 'sigwait' I look up signal... (4 Replies)
Discussion started by: konvalo
4 Replies

7. Programming

Problem with signal handler and interrupted system call

Hi, I have a daq program that runs in an infinite loop until it receives SIGINT. A handler catches the signal and sets a flag to stop the while loop. After the loop some things have to be cleaned up. The problem is that I want my main while loop to wait until the next full second begins, to... (2 Replies)
Discussion started by: soeckel
2 Replies

8. UNIX for Dummies Questions & Answers

UNIX System Call for creating process

Hell Sir, This is chanikya Is there any System call which behaves just like fork but i dont want to return back two times to the calling func. In the following ex iam creating a child process in the called func but the ex prints two times IN MAIN. ex :- calling() { fork(); } ... (2 Replies)
Discussion started by: chanikya
2 Replies

9. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

10. IP Networking

any system call in unix to access ip routing table

hi is there any system call by which ip routing table can be accessed. (1 Reply)
Discussion started by: vinodkumar
1 Replies
Login or Register to Ask a Question