No description
  • C 99.3%
  • Makefile 0.7%
Find a file
2024-02-14 16:00:30 -06:00
.gitignore Initial commit 2024-02-14 10:49:25 -06:00
Makefile Initial commit 2024-02-14 10:49:25 -06:00
pipes.c Implement partial writing as well 2024-02-14 16:00:30 -06:00
README.md Make the demo readable 2024-02-14 11:32:27 -06:00

Linux demos

pipes.c

What happens if you don't close the unused ends of a pipe, as pipe(2) and pipe(7) recommend? We can best test this by writing our own C code on both ends of the pipe. The GNU utilities are a little too robust to illustrate the behavior.

Following the man page, if we close this works:

make; ./pipes

Compare this to if we don't close the write end in the child (the consumer):

make; timeout 5 ./pipes --no-close-unused

pipes will now block forever (the timeout 5 will stop it after 5 seconds).