summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-23 17:36:59 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-23 17:36:59 +0200
commitd3eb3ac8887ea10811125e745bda77750f67fd25 (patch)
tree1d291fe93478d328e4f70b989395bc906c4d5b5b /src/fastd.c
parentf37fb374a90456ff910484274e333dd5cecee5bb (diff)
downloadfastd-d3eb3ac8887ea10811125e745bda77750f67fd25.tar
fastd-d3eb3ac8887ea10811125e745bda77750f67fd25.zip
Use socketpair instead of pipe for internal message pipes
While pipe2 recently got O_DIRECT on Linux, we'll just use SOCK_DGRAM to stay portable, and get proper handling of full queues.
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fastd.c b/src/fastd.c
index b6dabf1..e8b4677 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -124,7 +124,8 @@ static void init_signals(void) {
void fastd_open_pipe(int *readfd, int *writefd) {
int pipefd[2];
- if (pipe(pipefd))
+ /* use socketpair with SOCK_DGRAM instead of pipe2 with O_DIRECT to keep this portable */
+ if (socketpair(AF_UNIX, SOCK_DGRAM, 0, pipefd))
exit_errno("pipe");
fastd_setfd(pipefd[0], FD_CLOEXEC, 0);