Move missing_xyz.h for glibc headers to src/basic/include/ (#37960)

This commit is contained in:
Daan De Meyer
2025-07-03 13:47:46 +02:00
committed by GitHub
48 changed files with 41 additions and 67 deletions
+1 -1
View File
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sched.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/prctl.h>
@@ -8,7 +9,6 @@
#include "capability-util.h"
#include "errno-util.h"
#include "log.h"
#include "missing_sched.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
+1 -2
View File
@@ -16,7 +16,6 @@
#include "format-util.h"
#include "fs-util.h"
#include "log.h"
#include "missing_fcntl.h"
#include "missing_syscall.h"
#include "mountpoint-util.h"
#include "parse-util.h"
@@ -971,7 +970,7 @@ int fd_verify_safe_flags_full(int fd, int extra_flags) {
* and since we refuse O_PATH it should be safe.
*
* RAW_O_LARGEFILE: glibc secretly sets this and neglects to hide it from us if we call fcntl.
* See comment in missing_fcntl.h for more details about this.
* See comment in src/basic/include/fcntl.h for more details about this.
*
* If 'extra_flags' is specified as non-zero the included flags are also allowed.
*/
+1 -1
View File
@@ -2,10 +2,10 @@
#pragma once
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
#include "forward.h"
#include "missing_fcntl.h"
/* maximum length of fdname */
#define FDNAME_MAX 255
-1
View File
@@ -16,7 +16,6 @@
#include "label.h"
#include "lock-util.h"
#include "log.h"
#include "missing_fcntl.h"
#include "missing_syscall.h"
#include "mkdir.h"
#include "path-util.h"
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fcntl.h> /* IWYU pragma: export */
#include_next <fcntl.h>
/* This is defined since glibc-2.41. */
#ifndef F_DUPFD_QUERY
@@ -5,23 +5,22 @@
* to make struct sched_attr being defined.
* Note, this must be included before sched.h, otherwise the headers conflict with each other. */
#include <linux/sched/types.h>
#include <sched.h> /* IWYU pragma: export */
#include "forward.h"
#include_next <sched.h>
/* 769071ac9f20b6a447410c7eaa55d1a5233ef40c (5.8),
* defined in sched.h since glibc-2.36. */
#ifndef CLONE_NEWTIME
# define CLONE_NEWTIME 0x00000080
#else
assert_cc(CLONE_NEWTIME == 0x00000080);
_Static_assert(CLONE_NEWTIME == 0x00000080, "");
#endif
/* Not exposed yet. Defined at include/linux/sched.h */
#ifndef PF_KTHREAD
# define PF_KTHREAD 0x00200000
#else
assert_cc(PF_KTHREAD == 0x00200000);
_Static_assert(PF_KTHREAD == 0x00200000, "");
#endif
/* The maximum thread/process name length including trailing NUL byte. This mimics the kernel definition of
@@ -32,5 +31,5 @@ assert_cc(PF_KTHREAD == 0x00200000);
#ifndef TASK_COMM_LEN
# define TASK_COMM_LEN 16
#else
assert_cc(TASK_COMM_LEN == 16);
_Static_assert(TASK_COMM_LEN == 16, "");
#endif
@@ -1,20 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/mman.h> /* IWYU pragma: export */
#include "forward.h"
#include_next <sys/mman.h>
/* since glibc-2.38 */
#ifndef MFD_NOEXEC_SEAL
# define MFD_NOEXEC_SEAL 0x0008U
#else
assert_cc(MFD_NOEXEC_SEAL == 0x0008U);
_Static_assert(MFD_NOEXEC_SEAL == 0x0008U, "");
#endif
/* since glibc-2.38 */
#ifndef MFD_EXEC
# define MFD_EXEC 0x0010U
#else
assert_cc(MFD_EXEC == 0x0010U);
_Static_assert(MFD_EXEC == 0x0010U, "");
#endif
+1 -1
View File
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <fcntl.h>
#include <features.h>
#include <linux/fs.h>
#include <linux/mount.h> /* IWYU pragma: export */
@@ -10,7 +11,6 @@
#include <sys/syscall.h>
#include <unistd.h>
#include "missing_fcntl.h"
#include "missing_syscall_def.h"
/* Since glibc-2.37 (774058d72942249f71d74e7f2b639f77184160a6), sys/mount.h includes linux/mount.h, and
@@ -2,15 +2,17 @@
#pragma once
#include <linux/types.h>
#include <sys/ioctl.h>
/* since glibc-2.36 */
#if HAVE_PIDFD_OPEN
#include <sys/pidfd.h> /* IWYU pragma: export */
#include_next <sys/pidfd.h>
#endif
/* since glibc-2.41 */
#ifndef PIDFS_IOCTL_MAGIC
# define PIDFS_IOCTL_MAGIC 0xFF
#endif
#ifndef PIDFD_GET_CGROUP_NAMESPACE
# define PIDFD_GET_CGROUP_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 1)
# define PIDFD_GET_IPC_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 2)
# define PIDFD_GET_MNT_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 3)
@@ -23,6 +25,7 @@
# define PIDFD_GET_UTS_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 10)
#endif
/* defined in linux/pidfd.h */
#ifndef PIDFD_GET_INFO
struct pidfd_info {
__u64 mask;
@@ -1,13 +1,11 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/random.h> /* IWYU pragma: export */
#include "forward.h"
#include_next <sys/random.h>
/* Defined since glibc-2.32. */
#ifndef GRND_INSECURE
# define GRND_INSECURE 0x0004
#else
assert_cc(GRND_INSECURE == 0x0004);
_Static_assert(GRND_INSECURE == 0x0004, "");
#endif
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/socket.h> /* IWYU pragma: export */
#include_next <sys/socket.h>
/* Supported since kernel v6.5 (5e2ff6704a275be009be8979af17c52361b79b89) */
#ifndef SO_PASSPIDFD
@@ -1,13 +1,11 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/wait.h> /* IWYU pragma: export */
#include "forward.h"
#include_next <sys/wait.h>
/* since glibc-2.36 */
#ifndef P_PIDFD
# define P_PIDFD 3
#else
assert_cc(P_PIDFD == 3);
_Static_assert(P_PIDFD == 3, "");
#endif
+1 -2
View File
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sched.h>
#include <stdio.h>
#include <sys/prctl.h>
#include <sys/stat.h>
@@ -9,8 +10,6 @@
#include "errno-util.h"
#include "fd-util.h"
#include "memfd-util.h"
#include "missing_mman.h"
#include "missing_sched.h"
#include "string-util.h"
#include "utf8.h"
+2
View File
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/mman.h> /* IWYU pragma: export */
#include "forward.h"
int memfd_create_wrapper(const char *name, unsigned mode);
+1 -1
View File
@@ -127,7 +127,7 @@ basic_sources += missing_syscall_def_h
generate_af_list = find_program('generate-af-list.sh')
af_list_txt = custom_target(
output : 'af-list.txt',
command : [generate_af_list, cpp, files('missing_socket.h')],
command : [generate_af_list, cpp, files('include/sys/socket.h')],
capture : true)
generate_arphrd_list = find_program('generate-arphrd-list.sh')
+1 -1
View File
@@ -4,6 +4,7 @@
/* Missing glibc definitions to access certain kernel APIs */
#include <linux/mempolicy.h>
#include <sched.h>
#include <signal.h>
#include <sys/syscall.h>
#include <sys/xattr.h>
@@ -15,7 +16,6 @@
#include "forward.h"
#include "missing_keyctl.h"
#include "missing_sched.h"
#include "missing_syscall_def.h"
/* ======================================================================= */
-1
View File
@@ -11,7 +11,6 @@
#include "log.h"
#include "missing_magic.h"
#include "missing_namespace.h"
#include "missing_sched.h"
#include "mountpoint-util.h"
#include "namespace-util.h"
#include "parse-util.h"
+2 -1
View File
@@ -1,8 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <sys/pidfd.h> /* IWYU pragma: export */
#include "forward.h"
#include "missing_pidfd.h" /* IWYU pragma: export */
#include "missing_syscall.h" /* IWYU pragma: export */
int pidfd_get_namespace(int fd, unsigned long ns_type_cmd);
+1 -1
View File
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sys/wait.h>
#include <unistd.h>
#include "alloc-util.h"
@@ -8,7 +9,6 @@
#include "format-util.h"
#include "hash-funcs.h"
#include "log.h"
#include "missing_wait.h"
#include "parse-util.h"
#include "pidfd-util.h"
#include "pidref.h"
-1
View File
@@ -34,7 +34,6 @@
#include "locale-util.h"
#include "log.h"
#include "memory-util.h"
#include "missing_sched.h"
#include "missing_syscall.h"
#include "mountpoint-util.h"
#include "namespace-util.h"
+1 -1
View File
@@ -6,6 +6,7 @@
#include <string.h>
#include <sys/auxv.h>
#include <sys/ioctl.h>
#include <sys/random.h>
#include <threads.h>
#include <unistd.h>
@@ -15,7 +16,6 @@
#include "io-util.h"
#include "iovec-util.h"
#include "log.h"
#include "missing_random.h"
#include "parse-util.h"
#include "pidfd-util.h"
#include "process-util.h"
-1
View File
@@ -11,7 +11,6 @@
#include "log.h"
#include "macro.h"
#include "missing_sched.h"
#include "process-util.h"
/**
-1
View File
@@ -13,7 +13,6 @@
#include "forward.h"
#include "memory-util.h"
#include "missing_network.h"
#include "missing_socket.h"
union sockaddr_union {
/* The minimal, abstract version */