Post this on Perl Monks (http://perlmonks.org/) for non-beginner feed back,
Old Gray Bear On Tue, Mar 30, 2010 at 2:38 PM, Paul Smith <p...@mad-scientist.net> wrote: > I have a feeling this is not a "beginners" question (I've been hacking > in Perl for many years and UNIX systems for far longer) but it seems my > choices are this list, or perl5-porters which also doesn't seem right. > Isn't there any list where non-beginner questions can be asked? > > Anyway. > > I have a Perl environment which is v5.8.8 built for > x86_64-linux-thread-multi, running on a Red Hat Enterprise Linux 5.3 > system. In this environment, I create a pipe then I want to know the > maximum amount I can write to the pipe without blocking. So, I have > this code: > > my ($printrd, $printwd, $pipebuf); > pipe($printrd, $printwd) or die "pipe(print): $!\n"; > $pipebuf = fpathconf($printwd, _PC_PIPE_BUF) > or die "fpathconf(pipe): $!\n"; > > I wrote this code in 2007 and it's run on Red Hat EL 4 and EL 5 systems > for years. Once or twice over that time I got reports, that were never > reproduced, of the latter die (fpathconf) being hit. The error was > "invalid file descriptor". > > Within the last month or so (I have NO IDEA what's changed!) I've > started getting failures (on multiple quite different systems) > irregularly still, but much more frequently. > > I'm really stumped as to what might be the problem here. > > Playing around I changed the code so that if the fpathconf() of the > write FD failed, it would try the read FD. I can't be sure (since the > problem is intermittent) but is _seems_ like the read FD is working. > > I really don't want to just change this and call it good, though, > without some indication that this is really the problem, and it's not > just that I've been lucky so far with the read FD. > > > Has anyone ever heard of anything like this before? Is it true that > it's better/safer (in Perl? Everywhere?) to run fpathconf() on the read > FD? I've never heard of such a thing, but if this is a known behavior > that's fine with me. > > Thanks... > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > -- B Bob Goolsby bob.gool...@gmail.com -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/