Reason for SIGPIPE
I have an application running on Linux, catching signals and reporting them to syslog.
This application frequently reports SIGPIPE events with no apparent reasons
The application is running in the background, as daemon. The signals occur at idle times with no apparent network/socket connections. The application fre开发者_JAVA技巧quently reads from and writes to disk and DVB cards (via the kernel DVB drivers).
I would like to find out the reason for the SIGPIPEs. Any means for tracing the signal source?
Edit: I have added this to the code:
stdin = freopen("/dev/null", "r", stdin);
stdout = freopen("/tmp/vdr_stdout", "w", stdout);
stderr = freopen("/tmp/vdr_stderr", "w", stderr);
Still get the SIGPIPEs.
On POSIX-compliant platforms, SIGPIPE is the signal sent to a process when it attempts to write to a pipe without a process connected to the other end.
Since you are referring to a daemon
context, maybe the STD* are closed and an attempt to read/write on those is performed.... a debug/progress report printf
maybe?
Does your daemon close input and output?:
fclose (stdin);
fclose (stdout);
fclose (stderr);
精彩评论