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
0
votes
2 answers

mkfifo make 2 processes talk to each other

I am trying to write 2 programs that will talk to each other using fifo pipe. I used the example here (section 5.2), but I changed the mknod there to mkfifo and tried to change gets to fgets. This is the code (of one program which writes into the…
Hana
  • 535
  • 2
  • 7
  • 17
0
votes
1 answer

how to handle process output in go using named pipe

I am trying to set up a pipe from a running process in tmux, in order to handle its output line by line. I have had a look at this guide to pipe the output of a tmux session to stdout and this article about (named) pipes in go. I have been trying…
Hendrik Evert
  • 340
  • 2
  • 19
0
votes
2 answers

Executable for the writer file with mkfifo halts

In my understanding, according to the https://linux.die.net/man/3/mkfifo, I got an implication that I must have reader and writer file, in order to utilize the pipe file. The source below is the writer file, #include #include…
asd
  • 29
  • 9
0
votes
1 answer

Continuous read and write between FIFOs behaviour

I have composed the 2 following programs, in one I continuously write a string to a buffer and pass it through the FIFO to the other one, which reads what I've passed. /*write*/ int main() { int i=0, fd1; char buffer[16]; …
tiempo
  • 121
  • 2
  • 14
0
votes
0 answers

Named pipes - FIFO in c

I just want to test some programs which use named pipes. I found some examples but they don't work as I want. This code below works only when I open "myfifo" to read before opening to write. If I don't open to read before, it will create fifo, but…
Yakimget
  • 25
  • 4
0
votes
1 answer

Updated Named Pipes in C | Can't always get what i expect

I'm currently working on a project involving 4 processes that communicate through named pipes. However i don't ALWAYS get the results i expect. Writers are just sending an int equal to the process pid. Here is a short executable code i made to…
Jonathan
  • 1
  • 2
0
votes
2 answers

get the output of execvp and print it with pipe

I try to get the output of the execvp and print it to a named pipe. But how can I do this? Here is my code : void *run(void *comm) { struct command *com = (struct command *)comm; int fd[2]; pipe(fd); if (fork() == 0) { …
0
votes
0 answers

Strange behaviour of opening fifo first in parent and then in child

So i have been lately playing with fifo's and forks in C and i am a bit confused. I have the following code running in 2 different devices and i take different results every time. The code is : #define MAX_BUF 1024 int main(int argc, char const…
Vaggelis Spi
  • 164
  • 2
  • 11
0
votes
1 answer

Multiple forks, wait for the first to finish

I'm kind of new to all the fork, exec and wait functions. I have an assignment, which requires I fork my main process i times and then use all the children to write on to different fifos for each process. For example, if I have 3 children, I'll have…
tiempo
  • 121
  • 2
  • 14
0
votes
0 answers

C - put fifo log events in text file

I am tryinIg to send log-events from different threads through a FIFO, read the events and write them to a file. First I forked my main(). In the Child I want to run the FIFO reader and in the Parent i start my threads (these works fine). #define…
Gus Vanherf
  • 53
  • 1
  • 6
0
votes
1 answer

Make a live fifo - bash

This is the standard piping: foo | bar But I want make a delay between foo and bar, foo output is continues without finish. I can do foo > myfile and n seconds after it start bar < myfile. it makes n seconds delay but the big problem is myfile gets…
Farhadix
  • 1,395
  • 2
  • 12
  • 25
0
votes
1 answer

Understanding mkfifo PIPE usage in Shell Scripting

I came across the code below, which uses PIPE with multiple processes. I'm new to shell scripting, and therefore don't fully understand the meaning/intent of the following code: 1 #!/bin/ksh 2 3 if [ $# -lt 1 ]; then 4 echo "Usage: $0…
Ankur
  • 11,239
  • 22
  • 63
  • 66
0
votes
0 answers

Linux shell wrap a program's stdin and stdout using pipes

So, I have this interactive program that is running on an embedded linux ARM platform with no screen and that I cannot modify. To interact with it I have to ssh into the embedded linux distro, and run the program which is some sort of custom command…
frostblue
  • 176
  • 2
  • 14
0
votes
1 answer

named pipe is not working as expected. same message is being read again and again

I am trying to use named pipe to communicated between process. It is not behaving as expected , it is reading the same message again and again . process 1 : ( creates a pipe , and start reading till it reads over or it reads 100 message ) char*…
manimuthu m a
  • 61
  • 1
  • 9
0
votes
1 answer

Log mkfifo: must specify file

We have this sript in ksh file. FIFO_FILE=${FOLDER}/fifo_FIFOFILE.$$ mkfifo $FIFO_FILE Sometimes it's working. Sometimes it's not, and there is no error or warning, just a log mkfifo: must specify file Usage: mkfifo [-m mode] file ... I search on…