filter_create_fd(3)
π filter_create_fd β bestie edition π
okay so this one is from util/filter.h (the ClearSilver crew, we love them), and it's literally the "make a whole sub process and hand me pipes to its insides" function. group-chat energy only, but the facts stay facts. π«Ά
β¨ NAME β¨
filter_create_fd β spin up a sub process and hand back whichever pipes you asked for π
πΈ SYNOPSIS πΈ
#include <util/filter.h>
NEOERR *filter_create_fd(const char *cmd, int *fdin, int *fdout, int *fderr,
pid_t *pid);
π ARGUMENTS π
cmdβ the sub command you wanna run. it gets executed with/bin/sh -c, no cap.fdinβ pointer where the stdin pipe comes back, orNULLif you don't want the stdin pipe, bestie.fdoutβ pointer where the stdout pipe comes back, orNULLif you don't want the stdout pipe.fderrβ pointer where the stderr pipe comes back, orNULLif you don't want the stderr pipe.
π¦ DESCRIPTION π¦
filter_create_fd and filter_create_fp are what popen
been: a mechanism to create sub processes and have pipes to all their input/output. the concept was taken from mutt, though python has something similar with popen3/popen4. (iykyk π)
you control which pipes the function returns by the fdin/fdout/fderr arguments. a NULL value means "don't create a pipe", a pointer to an int will cause the pipes to be created and the value of the file descriptor stored in the int. π
not me reminding you: you will have to close(2) the file descriptors yourself. nobody's gonna do it for you, main character. π
π RETURN VALUE π
fdinβ the stdin file descriptor of the sub processfdoutβ the stdout file descriptor of the sub processfderrβ the stderr file descriptor of the sub processpidβ the pid of the sub process
π₯ SEE ALSO π₯
filter_wait(3), filter_create_fp(3), filter_create_fd
that's the whole vibe, bestie β ClearSilver, dated 12 July 2007, and honestly it ate. go close your file descriptors. periodt. πβ¨ππ¦
π¦ where this page comes from
- debian bookworm: clearsilver-dev 0.10.5-4+b5
- debian trixie: clearsilver-dev 0.10.5-6+b1
- epel 10: clearsilver 0.10.5-80.el10_2 Β· Apache-1.1
- epel 9: clearsilver 0.10.5-74.el9 Β· Apache-1.1
- fedora 43: clearsilver 0.10.5-80.fc43 Β· Apache-1.1
- fedora 44: clearsilver 0.10.5-82.fc44 Β· Apache-1.1
- ubuntu jammy: clearsilver-dev 0.10.5-4build3
- ubuntu noble: clearsilver-dev 0.10.5-4build7
- ubuntu questing: clearsilver-dev 0.10.5-6build1
- ubuntu resolute: clearsilver-dev 0.10.5-7
- ubuntu stonking: clearsilver-dev 0.10.5-7build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms