From d3eb3ac8887ea10811125e745bda77750f67fd25 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Wed, 23 Apr 2014 17:36:59 +0200 Subject: 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. --- src/fastd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/fastd.c') 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); -- cgit v1.2.3