Hello again,

What should happen to the fifo after a close?
I have written a little program that opens and closes the fifo twice. On the
hurd the first time it works and the second time fails. On linux they both
succeed.

$ mkfifo afifo
$ cat afifo

then run the fifo_test attached.

I noticed that after the fifo is created by runsv (line 507 in
https://sources.debian.org/src/runit/2.1.2-60/runit-2.1.2/src/runsv.c/)

fcntl(fd,F_SETFD,1)

Could this have an influence on the outcome?

Best regards,
João
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
int fd;
extern int errno;
int main()
{
   fd=open("afifo",O_WRONLY | O_NDELAY);
   printf("fd=%i,errno=%i\n",fd,errno);
   close(fd);
   fd=open("afifo",O_WRONLY | O_NDELAY);
   printf("fd=%i,errno=%i\n",fd,errno);
   close(fd);
   return 0;
}

Reply via email to