javac
javac

Reputation: 461

How to set the FIFO size maximum in C?

I create a named pipe with mkfifo(2) . But I want to set its size to maximum. I use fnctl() and PIPE_BUF but I think I couldn't do that.

This is my piece of code:

#define PIPE_BUF 1048576
#define _GNU_SOURCE

int writeSomeStuffToFifo (){
    int fd;

    mkfifo(myfifo, 0666); 
    fcntl(F_SETPIPE_SZ,PIPE_BUF);

    fd = open(myfifo, O_WRONLY);
    write(fd,"1",strlen("1"));
    close(fd);
}

Upvotes: 1

Views: 1683

Answers (0)

Related Questions