Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 1998 12:13:50 -0400
From:      Tuan Hoang <tqhoang@mitre.org>
To:        freebsd-questions@FreeBSD.ORG
Cc:        tqhoang@mitre.org
Subject:   no data in named pipes (FIFO's)
Message-ID:  <35B4BE3D.A723D9DB@mitre.org>

next in thread | raw e-mail | index | archive | help
Hi,

I'm having a problem with my named pipes (FIFO's).  I have 2 processes
communicating
back and forth via 2 FIFO's.  I create them successfully on the command
line using:

    mkfifo fifo_to_simcon fifo_from_simcon

I tested them using "cat" and "more" on the command line and they work
as I
expect them to (blocking, etc).

In my program I open the FIFO's in the correct order.  The problem is
that when
I write to the file descriptors, the return values are the size of the
data that I wrote
so it was successful but no data ever gets written to the FIFO's.  An
example of
how I know this is that one program continuously writes data to the
fifo_from_simcon
and the other one takes its time reading the fifo_from_simcon so the
data queues up.
I know that the programs are logically correct because the same exact
code runs fine
under Slackware Linux 2.0.34 and Solaris x86 2.6.  I'm using FreeBSD
2.2.6R
from Walnut Creek.

Here's what the FIFO's permissions look like and a sample of the open()
calls:
(Incidently, both programs reside in the same directory)

prwxr-xr-x  1 tuan  users  0 Jul 21 10:36 fifo_from_simcon|
prwxr-xr-x  1 tuan  users  0 Jul 21 10:35 fifo_to_simcon|

In program 1:
ReadFifoFd = open("./fifo_from_simcon", O_RDONLY, 0);
WriteFifoFd = open("./fifo_to_simcon", O_WRONLY|O_TRUNC, 0);

In program 2:
WriteFifoFd = open("./fifo_from_simcon", O_WRONLY|O_TRUNC, 0);
ReadFifoFd = open("./fifo_to_simcon", O_RDONLY, 0);


Thanks,
Tuan

--
Tuan Hoang
The MITRE Corporation
Email:  tqhoang@mitre.org



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35B4BE3D.A723D9DB>