Questions tagged [fifo]

Questions about FIFO - first-in first-out special file, also known named pipe

250 questions
25
votes
2 answers

Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?

I've used the mkfifo command to create named FIFOs, where one process writes to the file, and another process reads from the file. Now, I know the mknod command is able to create named pipes. Are these named pipes equivalent to the FIFOs…
Shuzheng
  • 4,411
22
votes
1 answer

Why is a named pipe as slow as writing to a file?

I'm trying to understand how named pipes work so that I can streamline my one-way interprocess communication. I expect some overhead due to copying data into a circular buffer, which I would have thought is stored in RAM, and so I expected the pipe…
12
votes
2 answers

Change buffer size of named pipe

I hear that for named pipes, writes that are smaller than about 512bytes are atomic (the writes won't interleave). Is there a way to increase that amount for a specific named pipe? something like: mkfifo mynamedpipe --buf=2500 Supposedly this is…
9
votes
2 answers

Read named pipe once every time input is written

I need to write a bash program that runs commands echoed to a named pipe it reads, but I cannot get it work only when a command is sent. It keeps repeating the last command until a new one is written. That is: Execute ./read_pipe.sh It waits until…
6
votes
2 answers

Is there a way to implement custom files that work like the 'files' in the /proc file system?

I'm looking for something like a persistent named pipe... something that I can cat or grep multiple times, and always get the current state of whatever process is feeding into the pipe. For example, let's say that I create a named pipe called…
3
votes
0 answers

Write to a named pipe interactively

I want to use a named pipe as input for a command line utility I'm writing. I know I can echo "all work and no play" > ./namedpipe to write once to the named pipe, but is there a way to do that interactively? That is, as if I'm typing into the stdin…
sudo
  • 342
2
votes
2 answers

where are the "files" of ipcs and why are named pipes (mkfifo) not listed in ipcs

I was researching about linux shared memory and stumbled upon this ipcs command. From the man page: ipcs - provide information on ipc facilities ipc is not explained in the man page but it most likely stands for inter-process communication. That…
Lesmana
  • 27,439
2
votes
2 answers

Reading n lines at a time from a named pipe in Ubuntu

I am experimenting with named pipes in Ubuntu and have no prior experience with them. I did the following: mkfifo pipe ls>pipe& cat pipe This enters a list of all files in my folder into pipe and displays them. I am trying to read the pipe 2 lines…
skr
  • 157
2
votes
1 answer

Create a named pipe / fifo that executes a command when read

I'm looking to supply a process that only reads from a local file with content from an http URL. The process is a daemon that is hard-coded to read a specific file in it's current working directory and reads it whenever a particular event…
0
votes
0 answers

Using a ‘permanent’ named pipe as input to a program

I’ll admit I don’t fully understand named pipes. I’ve read everything I can about them, but I’m still not sure how to keep one ‘open’ for repeated use. Basically, I want to use a named pipe as input to a program, and repeatedly send commands to that…
tjcaul
  • 101
0
votes
1 answer

Making a FIFO that strips all leading whitespaces?

There is a codeblock I copy from a personal handbook .txt file. I paste it in the terminal and execute by hitting Enter (Return). Recently I indented it there from aesthetic reasons but when I copy it indented the execution breaks (a secondary…
user149572
-1
votes
1 answer

What is the persistence of the handle of a broken FIFO?

Say an application opens for writing, a file, which is a FIFO to which something is “listening”, and later, this “listener” closes; if the application attempts to write to it, the application will get a broken pipe error. That's OK, but I wonder if…
Hibou57
  • 905