m***@yahoo.com
2006-08-22 23:40:50 UTC
When I create FIFO typing
$ mkfifo -m 0666 fifo.tmp
or in my program use system call (which is the same)
my program that uses FIFO is working just fine.
But when I code FIFO creation using C library call
if(mkfifo(FIFO, 0666) < 0)
{
perror("MKFIFO Error");
exit(1);
}
the resulting FIFO's behavoir is strange.
Every time I open it for read its i-node is changing and nothing works.
I am puzzled by this i-node change.
Here is open for read part of my code:
if((fd = open(FIFO, O_RDONLY|O_NONBLOCK)) < 0)
{
perror("OPEN Error");
return(-1);
}
if((val = fcntl(fd, F_GETFL, 0)) == -1)
return(-1);
val &= ~O_NONBLOCK;
if(fcntl(fd, F_SETFL, val) == -1)
return(-1);
I can live with system call, but would really want to know what is the
reason for C library to behave so strange.
Tested on OSR507, SCO UNIX Development System Release 5.2.0A
What do I miss?
Any pointers would be appreciated.
$ mkfifo -m 0666 fifo.tmp
or in my program use system call (which is the same)
my program that uses FIFO is working just fine.
But when I code FIFO creation using C library call
if(mkfifo(FIFO, 0666) < 0)
{
perror("MKFIFO Error");
exit(1);
}
the resulting FIFO's behavoir is strange.
Every time I open it for read its i-node is changing and nothing works.
I am puzzled by this i-node change.
Here is open for read part of my code:
if((fd = open(FIFO, O_RDONLY|O_NONBLOCK)) < 0)
{
perror("OPEN Error");
return(-1);
}
if((val = fcntl(fd, F_GETFL, 0)) == -1)
return(-1);
val &= ~O_NONBLOCK;
if(fcntl(fd, F_SETFL, val) == -1)
return(-1);
I can live with system call, but would really want to know what is the
reason for C library to behave so strange.
Tested on OSR507, SCO UNIX Development System Release 5.2.0A
What do I miss?
Any pointers would be appreciated.