04-08-2010
Catch signal SIGPIPE print errno but it's value equal to 2
catch signal SIGPIPE ,print errno but it's value equal to 2(ENOENT)
#define ENOENT 2 /* No such file or directory */
is it should be EPIPE ?
#define EPIPE 32 /* Broken pipe */
Thanks !
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I want to catch SIGCHLD signal in parent process. I can't use wait() system call to catch SIGCHLD according to project requirment.
Operating system linux 3.1
can any one have a solution for this.
Thanking you,
ranjan (2 Replies)
Discussion started by: ranjan
2 Replies
2. AIX
Hi folks,
Can anyone assist with pointers for the following snag?
We have custom method (IBM-supplied) for running the audit subsystem on 5.1-07
/etc/security/audit objects, events and config have been edited, and the /etc/security/audit/streamcmds contains the following routine;
... (1 Reply)
Discussion started by: reclspeak
1 Replies
3. Shell Programming and Scripting
Friends,
I have very large data files (File1 and File2).
Search field1 of File1 into Field1 of File2.
If found then do Field1 of File1 MINUS Field1 of File2
if the answer is <= 0.003 (positive or negative) then
print that line from File1.
File1
ABC1231|1.1111|2.2122|3.3133... (3 Replies)
Discussion started by: ppat7046
3 Replies
4. Programming
I' m note very expert in the reliable manage of signal... but in my server I must manage SIGPIPE for the socket and SIGTERM...
I've wrote this but there is something wrong... Can someone explain me with some example the reliable management of signal??
This is what I've wrote in the server
... (2 Replies)
Discussion started by: italian_boy
2 Replies
5. UNIX for Advanced & Expert Users
Hi
This is a exercise question from Unix network programming vol2.
Why the SIGPIPE signal is generated only for writers when readers disappear.
why not it is generated for readers when writer disappears.
I guess, if the writer didn't get any response like the reader gets EOF,
it will... (4 Replies)
Discussion started by: kumaran_5555
4 Replies
6. Shell Programming and Scripting
Using awk, print all the lines where field 8 is equal to x
I really did try, but this awk thing is really hard to figure out.
file1.txt"Georgia","Atlanta","2011-11-02","x","","","",""
"California","Los Angeles","2011-11-03","x","","","",""... (2 Replies)
Discussion started by: charles33
2 Replies
7. Programming
When a write() writes on a broken pipe, with no readers, it generates a SIGPIPE signal and the process exits.
When the write() returns -1 and errno is EPIPE?
Do I have an handler for SIGPIPE, or can I ignore it? (2 Replies)
Discussion started by: hurricane
2 Replies
8. Shell Programming and Scripting
how to use "awk" to print any record has pattern not equal ? for example my file has 5 records & I need to get all lines which $1=10 or 20 , $2=10 or 20 and $3 greater than "130302" as it shown :
10 20 1303252348212B030
20 10 1303242348212B030
40 34 1303252348212B030
10 20 ... (14 Replies)
Discussion started by: arm
14 Replies
9. Shell Programming and Scripting
(2 Replies)
Discussion started by: snoman1
2 Replies
10. Shell Programming and Scripting
For instance, my file contains the following content...
set -A array
set -A test
${array}=1
${array}=2
${array}=3
${test}="Boy"
${test}="Girl"
${test}="Dog"
x=0
while ;do
print "${array}" " " "${test}"
x=$((x+1)
done... (1 Reply)
Discussion started by: TestKing
1 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)