Sponsored Content
Top Forums Programming "No child processes" and waitpif Post 302297087 by jim mcnamara on Thursday 12th of March 2009 01:00:35 PM
Old 03-12-2009
Since signal handlers can be interrupted (bumped to the interrupt stack from where it is)
you have to call system I/O functions (as examples: read, write) and not functions in the STDC library like fgets and fputs. This is because a system is generally unaffacted by most signals - although read and write do respond to SIGINT for example. You have to read the man page for any function you want to use. First.

So, system functions (API) are usually a safer bet. You should also read the sigvector man page for your system, man 2 signal page as well because some implmentations of these calls may cause problems for write() calls -- as an example.

Any function that is async-signal-safe is okay. Thread safe is not the same thing. Anything async-signal-safe has to be thread-safe as well. But the reverse is not always true.

async-signal-safe function calls
http://www.opengroup.org/onlinepubs/...l#tag_02_04_04

Last edited by jim mcnamara; 03-12-2009 at 06:30 PM.. Reason: add link
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. UNIX for Dummies Questions & Answers

Kill child processes, when parent is "bash"

Consider this simple command line bash -c 'echo $$ ; sleep 10000'This will print the newly created bash PID and sleep for a long time. If I go to another terminal and do something like ps -flax | grep leepI'll see something like 501 92418 91910 0 0:00.00 ttys000 0:00.00 bash -c echo $$... (5 Replies)
Discussion started by: teras
5 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

will child processes be created when executing "ps"?

Hi I'm trying to write some code to confirm there is only one running instance in memory like below: /usr/ucb/ps -auxww | egrep -v 'grep |vi |tail |more |cat ' | egrep ${SCRIPT_NAME} | egrep -v " \-h| \-help| \-v" But sometimes i found there is some child processes are are created as... (4 Replies)
Discussion started by: sleepy_11
4 Replies

5. Shell Programming and Scripting

need to kill a number of processes with name "XYZ" at a time using shell script

Hi, when i grep for the process "XYZ" , there will be some good number of processes with that name, i want to kill all the these processes at a time using shell script? Any help needed for this action. Thanks Regards, Anil (6 Replies)
Discussion started by: anilmanepu
6 Replies

6. Shell Programming and Scripting

What is the use of "finger" command & how to use it to kill the online processes ?

Hi there, I am eager to know what exactly is the use of "finger" command & how to use it to kill the online processes ? :b: (1 Reply)
Discussion started by: abhijitpaul0212
1 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

9. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies
signal(3C)						   Standard C Library Functions 						signal(3C)

NAME
signal, sigset, sighold, sigrelse, sigignore, sigpause - simplified signal management for application processes SYNOPSIS
#include <signal.h> void (*signal (int sig, void (*disp)(int)))(int); void (*sigset(int sig, void (*disp)(int)))(int); int sighold(int sig); int sigrelse(int sig); int sigignore(int sig); int sigpause(int sig); DESCRIPTION
These functions provide simplified signal management for application processes. See signal.h(3HEAD) for an explanation of general signal concepts. The signal() and sigset() functions modify signal dispositions. The sig argument specifies the signal, which may be any signal except SIGKILL and SIGSTOP. The disp argument specifies the signal's disposition, which may be SIG_DFL, SIG_IGN, or the address of a signal han- dler. If signal() is used, disp is the address of a signal handler, and sig is not SIGILL, SIGTRAP, or SIGPWR, the system first sets the signal's disposition to SIG_DFL before executing the signal handler. If sigset() is used and disp is the address of a signal handler, the system adds sig to the calling process's signal mask before executing the signal handler; when the signal handler returns, the system restores the calling process's signal mask to its state prior to the delivery of the signal. In addition, if sigset() is used and disp is equal to SIG_HOLD, sig is added to the calling process's signal mask and the signal's disposition remains unchanged. The sighold() function adds sig to the calling process's signal mask. The sigrelse() function removes sig from the calling process's signal mask. The sigignore() function sets the disposition of sig to SIG_IGN. The sigpause() function removes sig from the calling process's signal mask and suspends the calling process until a signal is received. RETURN VALUES
Upon successful completion, signal() returns the signal's previous disposition. Otherwise, it returns SIG_ERR and sets errno to indicate the error. Upon successful completion, sigset() returns SIG_HOLD if the signal had been blocked or the signal's previous disposition if it had not been blocked. Otherwise, it returns SIG_ERR and sets errno to indicate the error. Upon successful completion, sighold(), sigrelse(), sigignore(), and sigpause(), return 0. Otherwise, they return -1 and set errno to indicate the error. ERRORS
These functions fail if: EINTR A signal was caught during the execution sigpause(). EINVAL The value of the sig argument is not a valid signal or is equal to SIGKILL or SIGSTOP. USAGE
The sighold() function used in conjunction with sigrelse() or sigpause() may be used to establish critical regions of code that require the delivery of a signal to be temporarily deferred. If signal() or sigset() is used to set SIGCHLD's disposition to a signal handler, SIGCHLD will not be sent when the calling process's children are stopped or continued. If any of the above functions are used to set SIGCHLD's disposition to SIG_IGN, the calling process's child processes will not create zom- bie processes when they terminate (see exit(2)). If the calling process subsequently waits for its children, it blocks until all of its children terminate; it then returns -1 with errno set to ECHILD (see wait(3C) and waitid(2)). The system guarantees that if more than one instance of the same signal is generated to a process, at least one signal will be received. It does not guarantee the reception of every generated signal. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
exit(2), kill(2), pause(2), sigaction(2), sigsend(2), waitid(2), signal.h(3HEAD), wait(3C)attributes(5), standards(5) SunOS 5.10 14 Aug 2002 signal(3C)
All times are GMT -4. The time now is 08:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy