// I got errvalue=11 if i checked in the errno.h 11 is equal to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO it`s
working fine
// If i write to each 500ms i got the write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
// I got errvalue=11 if i checked in the errno.h 11 is equal to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO it`s
working fine
// If i write to each 500ms i got the write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
Yes i know it, but why i got this, when i’m using O_NONBLOCK with the FIFO,
is this because O_NONBLOCK is using temporary file or for any other reason.
// I got errvalue=11 if i checked in the errno.h 11 is equal to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO
it`s
working fine
// If i write to each 500ms i got the
write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
Well you ask not to block If you write faster then the
“device” can handle it or if its internal buffer is full, the best
it can do is to return EGAIN since you asked the write
to NOT block.
Imagine writting in a serial port set at 9600. If you write
at a rate equivalent to 115200, what else then returning
EGAIN would you expect write to do if you ask it not
to block.
Yes i know it, but why i got this, when i’m using O_NONBLOCK with the
FIFO,
is this because O_NONBLOCK is using temporary file or for any other
reason.
// I got errvalue=11 if i checked in the errno.h 11 is equal
to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO
it`s
working fine
// If i write to each 500ms i got the
write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
Try removing O_NONBLOCK to see how long it actually will take to perform the
write. It might not be as bad as you think.
KenR
Thanks Mario for clarifying my comment - I was too brief.
Mario Charest wrote:
Well you ask not to block > > If you write faster then the
“device” can handle it or if its internal buffer is full, the best
it can do is to return EGAIN since you asked the write
to NOT block.
Imagine writting in a serial port set at 9600. If you write
at a rate equivalent to 115200, what else then returning
EGAIN would you expect write to do if you ask it not
to block.
“Roger Parent” <> rparent@sigma-techno.com> > wrote in message
news:94jvue$2vv$> 1@inn.qnx.com> …
Yes i know it, but why i got this, when i’m using O_NONBLOCK with the
FIFO,
is this because O_NONBLOCK is using temporary file or for any other
reason.
// I got errvalue=11 if i checked in the errno.h 11 is equal
to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO
it`s
working fine
// If i write to each 500ms i got the
write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
Is your FIFO reader working? I believe the FIFO is memory resident up to a
point (I’ll have to look at some old notes.) Maybe your reader is not pulling
the data out of the FIFO and the data is being written to disk because it is
over a certain threshold.??
KenR
Mario Charest wrote:
“Roger Parent” <> rparent@sigma-techno.com> > wrote in message
news:94king$e6k$> 1@inn.qnx.com> …
I made the test without O_NONBLOCK and the write take 0 ms, write with
500ms
before each write after 90 writes it’s take approx 500ms to do the write
for
each write.
That seems to indicate that the first 90 writes go to a buffer (possibly
cache) then after
90 writes it wants to write to disk (I’m not familliar with how Fsys handles
fifo).
That all seems very normal to me. You will have to deal with EGAIN if
you don’t want your write to block.
“rectech” <> rectech@iname.com> > a écrit dans le message news: 3A6DB25D.13EB1945@iname.com> …
Try removing O_NONBLOCK to see how long it actually will take to perform
the
write. It might not be as bad as you think.
KenR
Thanks Mario for clarifying my comment - I was too brief.
Mario Charest wrote:
Well you ask not to block > > If you write faster then the
“device” can handle it or if its internal buffer is full, the best
it can do is to return EGAIN since you asked the write
to NOT block.
Imagine writting in a serial port set at 9600. If you write
at a rate equivalent to 115200, what else then returning
EGAIN would you expect write to do if you ask it not
to block.
“Roger Parent” <> rparent@sigma-techno.com> > wrote in message
news:94jvue$2vv$> 1@inn.qnx.com> …
Yes i know it, but why i got this, when i’m using O_NONBLOCK with
the
FIFO,
is this because O_NONBLOCK is using temporary file or for any other
reason.
// I got errvalue=11 if i checked in the errno.h 11 is
equal
to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor,
and
the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to
the
FIFO
it`s
working fine
// If i write to each 500ms i got
the
write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
I made the test without O_NONBLOCK and the write take 0 ms, write with 500ms
before each write after 90 writes it’s take approx 500ms to do the write for
each write.
Try removing O_NONBLOCK to see how long it actually will take to perform
the
write. It might not be as bad as you think.
KenR
Thanks Mario for clarifying my comment - I was too brief.
Mario Charest wrote:
Well you ask not to block > > If you write faster then the
“device” can handle it or if its internal buffer is full, the best
it can do is to return EGAIN since you asked the write
to NOT block.
Imagine writting in a serial port set at 9600. If you write
at a rate equivalent to 115200, what else then returning
EGAIN would you expect write to do if you ask it not
to block.
“Roger Parent” <> rparent@sigma-techno.com> > wrote in message
news:94jvue$2vv$> 1@inn.qnx.com> …
Yes i know it, but why i got this, when i’m using O_NONBLOCK with the
FIFO,
is this because O_NONBLOCK is using temporary file or for any other
reason.
// I got errvalue=11 if i checked in the errno.h 11 is
equal
to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and
the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the
FIFO
it`s
working fine
// If i write to each 500ms i got
the
write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
I made the test without O_NONBLOCK and the write take 0 ms, write with
500ms
before each write after 90 writes it’s take approx 500ms to do the write
for
each write.
That seems to indicate that the first 90 writes go to a buffer (possibly
cache) then after
90 writes it wants to write to disk (I’m not familliar with how Fsys handles
fifo).
That all seems very normal to me. You will have to deal with EGAIN if
you don’t want your write to block.
“rectech” <> rectech@iname.com> > a écrit dans le message news: 3A6DB25D.13EB1945@iname.com> …
Try removing O_NONBLOCK to see how long it actually will take to perform
the
write. It might not be as bad as you think.
KenR
Thanks Mario for clarifying my comment - I was too brief.
Mario Charest wrote:
Well you ask not to block > > If you write faster then the
“device” can handle it or if its internal buffer is full, the best
it can do is to return EGAIN since you asked the write
to NOT block.
Imagine writting in a serial port set at 9600. If you write
at a rate equivalent to 115200, what else then returning
EGAIN would you expect write to do if you ask it not
to block.
“Roger Parent” <> rparent@sigma-techno.com> > wrote in message
news:94jvue$2vv$> 1@inn.qnx.com> …
Yes i know it, but why i got this, when i’m using O_NONBLOCK with
the
FIFO,
is this because O_NONBLOCK is using temporary file or for any other
reason.
// I got errvalue=11 if i checked in the errno.h 11 is
equal
to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor,
and
the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to
the
FIFO
it`s
working fine
// If i write to each 500ms i got
the
write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
// I got errvalue=11 if i checked in the errno.h 11 is equal to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO
it`s
working fine
// If i write to each 500ms i got the write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
// I got errvalue=11 if i checked in the errno.h 11 is equal to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO
it`s
working fine
// If i write to each 500ms i got the write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
FIFO’s are under Fsys’s control. Check out ‘use Fsys’ to change Fsys’s behavior.
Maybe add more to it’s cache (’-c’), reduce it’s delay (’-d’), or add to it’s
ramdisk (’-r’). That’s the best I found in my notes.
KenR
rectech wrote:
Fast reply - try speeding up the reader to see if anything changes. I’ll look
for my old notes on FIFO’s - wish me luck…
// I got errvalue=11 if i checked in the errno.h 11 is equal to
EAGAIN
// and EAGAIN in the write documentation saided this;
// The O_NONBLOCK flag is set for the file descriptor, and the
process would be delayed in the write operation
delay(1000); // 1000ms When i write to each 1000ms to the FIFO
it`s
working fine
// If i write to each 500ms i got the write
error EAGAIN after 90 write each 60% of the time
}
}
My process cannot wait for the FIFO to write in the file.
I’m using Qnx 4 and Watcom C 10.6, to write to a FIFO file.
I have made a FIFO file with mkfifo fifoprod and i using C to write to this
FIFO.
My process cannot wait for the FIFO to write in the file.
What EAGAIN really means.
There is a fixed maximum number of bytes that a FIFO will buffer.
(I think that value is #define PIPE_BUF 5120.) EAGAIN means
that the buffer is full, that is you have written 5120 bytes more
to the pipe than the reader process has read from the pipe. The
normal behaviour is for your process to block on the write at this
point – but you set O_NONBLOCK, so, instead, the write() call failed
returning -1 and setting errno to EAGAIN.
If you need longer queues, you might look at using Posix message
queues – run Mqueue, call mq_open(), etc. This give you control
over how large the queue is.
This may allow you to handle larger bursts of data, but you will still
have a problem if you always write to the queue faster than you read
from the queue.
I’m using Qnx 4 and Watcom C 10.6, to write to a FIFO file.
I have made a FIFO file with mkfifo fifoprod and i using C to write to
this
FIFO.
My process cannot wait for the FIFO to write in the file.
What EAGAIN really means.
There is a fixed maximum number of bytes that a FIFO will buffer.
(I think that value is #define PIPE_BUF 5120.) EAGAIN means
that the buffer is full, that is you have written 5120 bytes more
to the pipe than the reader process has read from the pipe. The
normal behaviour is for your process to block on the write at this
point – but you set O_NONBLOCK, so, instead, the write() call failed
returning -1 and setting errno to EAGAIN.
If you need longer queues, you might look at using Posix message
queues – run Mqueue, call mq_open(), etc. This give you control
over how large the queue is.
This may allow you to handle larger bursts of data, but you will still
have a problem if you always write to the queue faster than you read
from the queue.
Why the PIPE_BUF of 5120 bytes, are full, i’m writing 121 bytes to each
500ms ?
How fast are you reading the data? If you write faster than you’re reading,
you’ll fill up the pipe.
Why the QNX accumulated to the buffer, when it gonna write to the FIFO ?
That “buffer” IS the FIFO. The thing you create on the disk with
mkfifo() is only an entry for the two processes using the pipe to
find each other. Extra data will not be written to disk to allow
you to continually write to the FIFO – they don’t work that way,
and they aren’t supposed to work that way.
A FIFO is a named pipe – an in-memory queue for doing IPC. In
many OSes it is implemented in the kernel, in QNX it happens to
be implemented in Fsys. It isn’t supposed to be “written” anywhere.
Why the PIPE_BUF of 5120 bytes, are full, i’m writing 121 bytes to each
500ms ?
How fast are you reading the data? If you write faster than you’re
reading,
you’ll fill up the pipe.
Why the QNX accumulated to the buffer, when it gonna write to the FIFO ?
That “buffer” IS the FIFO. The thing you create on the disk with
mkfifo() is only an entry for the two processes using the pipe to
find each other. Extra data will not be written to disk to allow
you to continually write to the FIFO – they don’t work that way,
and they aren’t supposed to work that way.
A FIFO is a named pipe – an in-memory queue for doing IPC. In
many OSes it is implemented in the kernel, in QNX it happens to
be implemented in Fsys. It isn’t supposed to be “written” anywhere.
I`m writing at 500ms and reading at 1000ms i going to change the reading
process.
That might do it.
If i have 2 process that writing to this PIPE, the PIPE is a 5120 bytes
PIPES or 10240 bytes.
One pipe/FIFO → one buffer → 5120 bytes. If you need more buffering,
as I said, you could go with a Message queue, where you can establish
exactly how big the queue will be when you create it – part of the
attributes you specify.