Problem with open() of a pipe file

Hi all!

I am running into a strange problem. I create a pipe with mkfifo() call and
when I try to open it with fopen() or open(), my process gets hange on reply
state waiting for pipe process to respond. What give?

Note: In the dubugger I am seing the same thing. Using QNX 6.1A

Here is the code I use.


**
// 1. Setup the PIPE for download base on the path and name file from
CALIB_DOA_PARMS
strcpy( cPath, &(m_sCalibDOAParms.cPathName[0]) );
strcat( cPath , &(m_sCalibDOAParms.cFileName[0]) );
if( mkfifo( cPath, S_IRUSR|S_IWOTH|S_IROTH|S_IWUSR ) == -1 ) // Give
permission to owner to read and other write
{
printf(“CDOADownload::Run()->Error creating pipe: %d\n”, errno);
exit( EXIT_FAILURE ); // we getting out since we couldn’t open the pipe
file
}

// 2. Send a message back to SW telling them we are ready to receive
//SendSWReadyMsg( fw_true );

// 3. Setup timeout timer
m_pTimerSignal = new CSignalTimer( SignalHandler, SIGRTMIN,
(DOA_SIG_CODE1) );
//m_pTimerSignal->startTimer(0, 0, 30, 0 , CLOCK_REALTIME); // Thirdy
seconds

// 4. Open the pipe for reading
filedesc = open( cPath, O_RDONLY );
if ( filedesc == -1 )
{
printf(“CDOADownload::Run()->Error openning pipe file: %d\n”, errno);
m_pTimerSignal->stopTimer();
exit( EXIT_FAILURE ); // we getting out since we couldn’t open the pipe
file
}

printf(“openning pipe was good\n”);


**

Any help or insight would be appreciated!!

Cheers and Thanks!

Stephane Grenier

Lead Firmware Engineer

Excalibur Systems Limited

Electronic Warfare Simulation & Training

Tel: +1 613 591 6000 x207

Fax: +1 613 591 6001

mailto:sgrenier@excalibur-idt.com

Stephane Grenier <sgrenier@ca.inter.net> wrote:

I am running into a strange problem. I create a pipe with mkfifo() call and
when I try to open it with fopen() or open(), my process gets hange on reply
state waiting for pipe process to respond. What give?

From the open() docs page:

When opening a FIFO with O_RDONLY or O_WRONLY set:

If O_NONBLOCK is set:

Calling open() for reading-only returns without delay. Calling
open() for writing-only returns an error if no process currently
has the FIFO open for reading.

If O_NONBLOCK is clear:

Calling open() for reading-only blocks until a process opens the
file for writing. Calling open() for writing-only blocks until
a process opens the file for reading.

This text is almost identical to what POSIX says about open().

Thanks!

I should have read the fine print.

Stephane Grenier

“Wojtek Lerch” <wojtek_l@yahoo.ca> wrote in message
news:bj7hi4$qp1$1@inn.qnx.com

Stephane Grenier <> sgrenier@ca.inter.net> > wrote:
I am running into a strange problem. I create a pipe with mkfifo() call
and
when I try to open it with fopen() or open(), my process gets hange on
reply
state waiting for pipe process to respond. What give?

From the open() docs page:

When opening a FIFO with O_RDONLY or O_WRONLY set:

If O_NONBLOCK is set:

Calling open() for reading-only returns without delay. Calling
open() for writing-only returns an error if no process currently
has the FIFO open for reading.

If O_NONBLOCK is clear:

Calling open() for reading-only blocks until a process opens the
file for writing. Calling open() for writing-only blocks until
a process opens the file for reading.

This text is almost identical to what POSIX says about open().