Questions tagged [mkfifo]

Creates a named-pipe (aka FIFO)

A named pipe, also called a FIFO for its behaviour, can be used to connect two unrelated processes and exists independently of the processes; meaning it can exist even if no one is using it. A FIFO is created using the mkfifo() library function.


What is considered related processes?

Probably processes which are related via one or more parent/child relations (e.g. includes siblings). The common ancestor would have created the two ends of the pipe. Unrelated processes lack that common ancestor.

229 questions
33
votes
6 answers

Create a temporary FIFO (named pipe) in Python?

How can you create a temporary FIFO (named pipe) in Python? This should work: import tempfile temp_file_name = mktemp() os.mkfifo(temp_file_name) open(temp_file_name, os.O_WRONLY) # ... some process, somewhere, will read it ... However, I'm…
Brian M. Hunt
  • 81,008
  • 74
  • 230
  • 343
27
votes
2 answers

How do I properly write to FIFOs in Python?

Something very strange is happening when I open FIFOs (named pipes) in Python for writing. Consider what happens when I try to open a FIFO for writing in a interactive interpreter: >>> fifo_write = open('fifo', 'w') The above line blocks until I…
Thiago Padilha
  • 4,590
  • 5
  • 44
  • 69
20
votes
1 answer

Fifo file Windows example

I am wondering if there is a Windows equivalent for Linux mkfifo. By equivalent, I mean way of creating files, with st_mode S_IFIFO. Thanks for answers.
Patrik Polakovic
  • 542
  • 1
  • 8
  • 20
16
votes
1 answer

Difference between mkfifo() and mknod()

What is the difference between mkfifo() and mknod() while creating a named pipe? I tried searching but couldn't get a satisfactory answer.
babybear
  • 804
  • 1
  • 10
  • 24
16
votes
1 answer

PhantomJS: pipe input

I am trying to use PhantomJS to render an html page to pdf. I do not want to write the files to disk, I have the html in memory, and I want the pdf in memory. Using the excellent answer from Pooria Azimi at this question, i am able to get the pdf…
mads
  • 248
  • 2
  • 8
15
votes
3 answers

O_RDWR on named pipes with poll()

I have gone through a variaty of different linux named pipe client/server implementations but most of them use the blocking defaults on reads/writes. As I am already using poll() to check other flags I though it would be a good idea to check for…
JoeFrizz
  • 611
  • 1
  • 9
  • 18
14
votes
2 answers

Why does my program hang when opening a mkfifo-ed pipe?

I use mkfifo to create a named pipe. Then I use the following program to open it. However, the program hangs at the line "fopen". Is there something wrong here? int main(int argc, char** argv) { char* line = "hello, world!"; FILE* fp =…
flyingbin
  • 1,097
  • 2
  • 11
  • 28
13
votes
3 answers

fifo - reading in a loop

I want to use os.mkfifo for simple communication between programs. I have a problem with reading from the fifo in a loop. Consider this toy example, where I have a reader and a writer working with the fifo. I want to be able to run the reader in a…
Jakub M.
  • 32,471
  • 48
  • 110
  • 179
13
votes
1 answer

What conditions result in an opened, nonblocking named pipe (fifo) being "unavailable" for reads?

Situation: new_pipe = os.open(pipe_path, os.O_RDONLY | os.O_NONBLOCK) # pipe_path points to a FIFO data = os.read(new_pipe, 1024) The read occasionally raises errno -11: Resource temporarily unavailable. When is this error raised? It seems very…
UsAaR33
  • 3,536
  • 2
  • 34
  • 55
7
votes
2 answers

Proper FIFO client-server connection

I'm trying to write simple client and server C programs, communicating with each other in separate terminals. The server has to create a public fifo and wait for the client. Meanwhile the client is creating his own fifo through which the server's…
uluroki
  • 171
  • 2
  • 2
  • 11
7
votes
6 answers

Setting up a blocking file read in Java

I'd like to set up a blocking file read in Java. That is, have a file such that when wrapped by FileInputStream and any read() method is call, the call blocks. I can't think of an easy OS-independent way - on Unix-like OSes I could try to create a…
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
7
votes
1 answer

Create named pipe in Ruby

I am trying to create a named pipe inside Ruby. Besides using the system command (system("mkfifo #{pipe_name}")), is there a native Ruby function allowing me to do this?
Yang Guan
  • 81
  • 1
  • 5
7
votes
2 answers

Named pipe similar to "mkfifo" creation, but bidirectional

I'd like to create a named pipe, like the one created by "mkfifo", but one caveat. I want the pipe to be bidirectional. That is, I want process A to write to the fifo, and process B to read from it, and vice-versa. A pipe created by "mkfifo" allows…
matt_h
  • 1,289
  • 14
  • 17
7
votes
2 answers

mkfifo() error ---> "Error creating the named pipe.: File exists"

The mkfifo function takes 2 arguments, path and mode. But I don't know what is the format of the path that it uses. I am writing a small program to create a named pipe and as path in the mkfifo. Using /home/username/Documents for example, but it…
Spyros
  • 682
  • 7
  • 18
  • 37
6
votes
2 answers

Python and FIFOs

I was trying to understand FIFOs using Python under linux and I found a strange behavior i don't understand. The following is fifoserver.py import sys import time def readline(f): s = f.readline() while s == "": time.sleep(0.0001) …
6502
  • 112,025
  • 15
  • 165
  • 265
1
2 3
15 16