mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-24 17:51:17 +03:00
linux: Implement pipe in terms of __NR_pipe2
The syscall pipe2 was added in linux 2.6.27 and glibc requires linux 3.2.0. The patch removes the arch-specific implementation for alpha, ia64, mips, sh, and sparc which requires a different kernel ABI than the usual one. Checked on x86_64-linux-gnu and with a build for the affected ABIs.
This commit is contained in:
32
sysdeps/unix/sysv/linux/pipe.c
Normal file
32
sysdeps/unix/sysv/linux/pipe.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Create create pipe. Linux generic version.
|
||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library. If not, see
|
||||
<https://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
/* Create a one-way communication channel (__pipe).
|
||||
If successful, two file descriptors are stored in PIPEDES;
|
||||
bytes written on PIPEDES[1] can be read from PIPEDES[0].
|
||||
Returns 0 if successful, -1 if not. */
|
||||
int
|
||||
__pipe (int __pipedes[2])
|
||||
{
|
||||
return INLINE_SYSCALL_CALL (pipe2, (int *) __pipedes, 0);
|
||||
}
|
||||
libc_hidden_def (__pipe)
|
||||
weak_alias (__pipe, pipe)
|
||||
Reference in New Issue
Block a user