2 * Copyright © 2014 Canonical Limited
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the licence, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 * Author: Ryan Lortie <desrt@desrt.ca>
20 #ifndef __GLIB_LINUX_H__
21 #define __GLIB_LINUX_H__
23 /* If we know that we are on Linux, add some features, even if they are
24 * not (yet) advertised in the glibc or kernel headers.
26 * This allows us to use functionality regardless of if it was available
27 * when GLib was compiled or not.
29 * We take care not to define these things on non-Linux systems where
30 * certain numeric values could mean something different.
32 * This file is populated on an as-needed basis.
34 * As things in this file filter into glibc and the distributions we can
35 * remove them from this file and add unconditional dependencies. Never
36 * add a configure.ac check in order to remove something from this file.
38 * import: include this header LAST
45 #include <sys/syscall.h>
48 #include <linux/futex.h>
51 glib_linux_futex (int *uaddr,
54 const struct timespec *timeout,
58 return syscall (__NR_futex, uaddr, op, val, timeout, uaddr2, val3);
63 #define MFD_CLOEXEC 0x0001U
66 #ifndef MFD_ALLOW_SEALING
67 #define MFD_ALLOW_SEALING 0x0002U
70 #ifndef __NR_memfd_create
72 #define __NR_memfd_create 319
74 #define __NR_memfd_create 385
76 #define __NR_memfd_create 356
81 glib_linux_memfd_create (const char *name,
84 return syscall (__NR_memfd_create, name, flags);
87 /* Linux-specific fcntl() operations */
88 #ifndef F_LINUX_SPECIFIC_BASE
89 #define F_LINUX_SPECIFIC_BASE 1024
93 #define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
94 #define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
96 #define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
97 #define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
98 #define F_SEAL_GROW 0x0004 /* prevent file from growing */
99 #define F_SEAL_WRITE 0x0008 /* prevent writes */
102 #endif /* __linux __ */
104 #endif /* __GLIB_LINUX_H__ */