Article View: comp.unix.programmer
Article #367Re: Which pipe sent SIGPIPE w/o trying to write to it??
From: Kartik Subbarao
Date: Fri, 10 Apr 1992 13:26
Date: Fri, 10 Apr 1992 13:26
20 lines
1675 bytes
1675 bytes
In article <92100.170337PJS100T@ODUVM.BITNET> Pam Skillman <PJS100T@ODUVM.BITNET> writes: >Here's the situation: I've got several pipes to several different processes >and I receive a SIGPIPE. >I don't want to try to write anything to each of >these pipes as some of the processes are running tools and such and I don't >want anything I send interpreted by them. Is there a way to do this?? I don't know what you mean when you say "I don't want to try to write anything to each of these pipes". The only way SIGPIPE gets generated is when you write on a pipe with no one to read it. Since you get SIGPIPE, you must already be writing something to that pipe yourself. (Unless you forked off a process, gave it a pipe and the process wrote on the pipe with no one to read it. In that case you'd have no control over the write()ing). Here, you can simply ignore SIGPIPE by signal(SIGPIPE, SIG_IGN), and on each write() check to see if errno == EPIPE. If so, then there was no reader on the pipe you just wrote to. -Kartik
Technical Details
Message-ID:
<1992Apr10.132603.10211@Princeton.EDU>Path:
arc1-ca.pugleaf.net!sparky!news.UU.NET!van-bc!wolfe.wimsey.bc.ca!rsoft!agate!ames!haven.umd.edu!darwin.sura.net!jvnc.net!rutgers!kb2ear!princeton!phoenix.Princeton.EDU!subbaraoReferences:
<92100.170337PJS100T@ODUVM.BITNET>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!news.UU.NET!van-bc!wolfe.wimsey.bc.ca!rsoft!agate!ames!haven.umd.edu!darwin.sura.net!jvnc.net!rutgers!kb2ear!princeton!phoenix.Princeton.EDU!subbarao
From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao)
Newsgroups: comp.unix.programmer
Subject: Re: Which pipe sent SIGPIPE w/o trying to write to it??
Message-ID: <1992Apr10.132603.10211@Princeton.EDU>
Date: 10 Apr 92 13:26:03 GMT
References: <92100.170337PJS100T@ODUVM.BITNET>
Sender: news@Princeton.EDU (USENET News System)
Organization: putchar('I'); for (i = 0; i < 3; i++) putchar('E');
Lines: 20
Nntp-Posting-Host: phoenix.princeton.edu