1 /* glib-unixprivate.h - Unix specific integration private functions
3 * SPDX-License-Identifier: LGPL-2.1-or-later
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, see <http://www.gnu.org/licenses/>.
19 #ifndef __G_UNIXPRIVATE_H__
20 #define __G_UNIXPRIVATE_H__
25 #error "This header may only be used on UNIX"
28 /* To make bionic export pipe2() */
42 static inline gboolean
43 g_unix_open_pipe_internal (int *fds,
44 gboolean close_on_exec,
59 ecode = pipe2 (fds, flags);
60 if (ecode == -1 && errno != ENOSYS)
64 /* Fall through on -ENOSYS, we must be running on an old kernel */
74 if (fcntl (fds[0], F_SETFD, FD_CLOEXEC) == -1 ||
75 fcntl (fds[1], F_SETFD, FD_CLOEXEC) == -1)
77 int saved_errno = errno;
92 int flags = O_NONBLOCK;
97 if (fcntl (fds[0], F_SETFL, flags) == -1 ||
98 fcntl (fds[1], F_SETFL, flags) == -1)
100 int saved_errno = errno;
117 #endif /* __G_UNIXPRIVATE_H__ */