Просмотр исходного кода

pipe: directly invoke pipe2 from kernel when !UCLIBC_LINUX_SPECIFIC

As recognized in dde074b39 some linux architectures only provide `pipe2`
even though only `pipe` is specified by POSIX. Fortunately `pipe2` can
stand in for `pipe` by passing flags of zero. Unfortunately the uclibc
definition of `pipe2` is gated behind `UCLIBC_LINUX_SPECIFIC`. When
compiling with that config set to `n` (e.g. allnoconfig) we get a build
error when trying to call the function. Instead, just directly invoke
the syscall from the kernel via `INLINE_SYSCALL` when falling back to
`pipe2` for implementing `pipe` on architectures without `__NR_pipe`.

Fixes: dde074b39 ("pipe: Use pipe2 if arch does not have the pipe syscall")
Signed-off-by: Charles Mirabile <cmirabil@redhat.com>
Charles Mirabile 1 месяц назад
Родитель
Сommit
f4045b8cbd
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      libc/sysdeps/linux/common/pipe.c

+ 1 - 1
libc/sysdeps/linux/common/pipe.c

@@ -13,7 +13,7 @@
 #if defined __NR_pipe2 && !defined __NR_pipe
 int pipe(int filedes[2])
 {
-	return pipe2(filedes, 0);
+	return INLINE_SYSCALL(pipe2, 2, filedes, 0);
 }
 /* If both are defined then use the pipe syscall */
 #else