Sponsored Content
Top Forums Programming sigwait system call in UNIX signal Post 50497 by md7ahuja on Monday 26th of April 2004 05:17:09 AM
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
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
SIGWAIT(3)                                                   Linux Programmer's Manual                                                  SIGWAIT(3)

NAME
sigwait - wait for a signal SYNOPSIS
#include <signal.h> int sigwait(const sigset_t *set, int *sig); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): sigwait(): Since glibc 2.26: _POSIX_C_SOURCE >= 199506L Glibc 2.25 and earlier: _POSIX_C_SOURCE DESCRIPTION
The sigwait() function suspends execution of the calling thread until one of the signals specified in the signal set set becomes pending. The function accepts the signal (removes it from the pending list of signals), and returns the signal number in sig. The operation of sigwait() is the same as sigwaitinfo(2), except that: * sigwait() returns only the signal number, rather than a siginfo_t structure describing the signal. * The return values of the two functions are different. RETURN VALUE
On success, sigwait() returns 0. On error, it returns a positive error number (listed in ERRORS). ERRORS
EINVAL set contains an invalid signal number. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +----------+---------------+---------+ |Interface | Attribute | Value | +----------+---------------+---------+ |sigwait() | Thread safety | MT-Safe | +----------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008. NOTES
sigwait() is implemented using sigtimedwait(2). The glibc implementation of sigwait() silently ignores attempts to wait for the two real-time signals that are used internally by the NPTL threading implementation. See nptl(7) for details. EXAMPLE
See pthread_sigmask(3). SEE ALSO
sigaction(2), signalfd(2), sigpending(2), sigsuspend(2), sigwaitinfo(2), sigsetops(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/. Linux 2017-07-13 SIGWAIT(3)
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy