diff options
author | Thomas Schwinge <tschwinge@gnu.org> | 2008-12-17 18:11:47 +0100 |
---|---|---|
committer | Thomas Schwinge <thomas@schwinge.name> | 2010-01-25 00:38:08 +0100 |
commit | ed4024ccc9698c7a14e087bf2f91642a5b52fe9f (patch) | |
tree | af1a149d02afb76294f1c5dd42e021fdfae521fe /sysdeps/mach/hurd/pipe.c | |
parent | d8a83492bb5e134101b0fa2db626f1e80bc48bfc (diff) |
pipe2 for GNU Hurd.
* sysdeps/mach/hurd/pipe2.c: New file, copy from pipe.c. Evolve it to
implement __pipe2.
* sysdeps/mach/hurd/pipe.c (__pipe): Reimplement using __pipe2.
* sysdeps/mach/hurd/kernel-features.h (__ASSUME_PIPE2): Define.
Diffstat (limited to 'sysdeps/mach/hurd/pipe.c')
-rw-r--r-- | sysdeps/mach/hurd/pipe.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/sysdeps/mach/hurd/pipe.c b/sysdeps/mach/hurd/pipe.c index 7a5d78c29c..003a19bbe8 100644 --- a/sysdeps/mach/hurd/pipe.c +++ b/sysdeps/mach/hurd/pipe.c @@ -1,4 +1,6 @@ -/* Copyright (C) 1992,93,94,95,96,99,2000,2002 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2002, 2008 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 @@ -16,9 +18,6 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include <errno.h> -#include <sys/socket.h> -#include <sys/stat.h> #include <unistd.h> /* Create a one-way communication channel (pipe). @@ -29,23 +28,7 @@ int __pipe (int fds[2]) { - int save_errno = errno; - int result; - - /* The magic S_IFIFO protocol tells the pflocal server to create - sockets which report themselves as FIFOs, as POSIX requires for - pipes. */ - result = __socketpair (PF_LOCAL, SOCK_STREAM, S_IFIFO, fds); - if (result == -1 && errno == EPROTONOSUPPORT) - { - /* We contacted an "old" pflocal server that doesn't support the - magic S_IFIFO protocol. - FIXME: Remove this junk somewhere in the future. */ - __set_errno (save_errno); - return __socketpair (PF_LOCAL, SOCK_STREAM, 0, fds); - } - - return result; + return __pipe2 (fds, 0); } libc_hidden_def (__pipe) weak_alias (__pipe, pipe) |