Re: dlopen() on a fifo

Kirk Russell <[email protected]>
Newsgroups gmane.os.netbsd.devel.general
Message-ID <[email protected]>
On Fri, 12 May 2006, Jed Davis wrote:

> [email protected] (Matthias Scheler) writes:
>
> > 	Kirk Russell <[email protected]> writes:
> >> I am using NetBSD 3.0.  I found that dlopen() will block if the given
> >> path is a fifo:
> >>
> >> 	$ mkfifo -m a+wrx afifo
> >> 	$ ksh -c "LD_PRELOAD=./afifo /usr/bin/true"
> >> 	[... blocked ...]
> >>
> >> Is this expected behaviour?
> >
> > Yes. Processes get blocked if they try to read from a FIFO and there is
> > no writer.
>
> More to the point, the *open* will block if there's nothing on the
> other end (and O_NONBLOCK hasn't been given).

But since fifos don't appear to support mmap() or seek, I would
guess that dlopen() of a fifo cannot work even when the caller is
unblocked by a writer.  You have bad news for caller -- why not give
it sooner than later.  It appears that opendir() does an open()
O_NONBLOCK and a fstat to ensure the call doesn't block on a fifo.
I guess I expected dlopen() to be in the same class as opendir() and
not the regular open() class.

Just curious.  Thanks for the feedback :-)

-- 
Kirk Russell            <[email protected]>            http://www.ba23.org/
Bridlewood Software Testers Guild                  Ottawa Ontario Canada
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.