mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #11063 from yuwata/update-missing-v3
missing: split missing.h into small pieces
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
@@ -91,23 +91,33 @@ basic_sources = files('''
|
||||
memfd-util.h
|
||||
mempool.c
|
||||
mempool.h
|
||||
missing_audit.h
|
||||
missing_btrfs.h
|
||||
missing_btrfs_tree.h
|
||||
missing_capability.h
|
||||
missing_ethtool.h
|
||||
missing_fcntl.h
|
||||
missing_fib_rules.h
|
||||
missing_fou.h
|
||||
missing_fs.h
|
||||
missing_if_bridge.h
|
||||
missing_if_link.h
|
||||
missing_if_tunnel.h
|
||||
missing_input.h
|
||||
missing_keyctl.h
|
||||
missing_magic.h
|
||||
missing_mman.h
|
||||
missing_network.h
|
||||
missing_prctl.h
|
||||
missing_random.h
|
||||
missing_resource.h
|
||||
missing_sched.h
|
||||
missing_securebits.h
|
||||
missing_socket.h
|
||||
missing_stat.h
|
||||
missing_stdlib.h
|
||||
missing_syscall.h
|
||||
missing_timerfd.h
|
||||
missing_type.h
|
||||
missing_vxcan.h
|
||||
mkdir-label.c
|
||||
|
||||
@@ -3,325 +3,22 @@
|
||||
|
||||
/* Missing glibc definitions to access certain kernel APIs */
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/falloc.h>
|
||||
#include <linux/oom.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if HAVE_AUDIT
|
||||
#include <libaudit.h>
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_MIPS
|
||||
#include <asm/sgidefs.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LINUX_VM_SOCKETS_H
|
||||
#include <linux/vm_sockets.h>
|
||||
#else
|
||||
#define VMADDR_CID_ANY -1U
|
||||
struct sockaddr_vm {
|
||||
unsigned short svm_family;
|
||||
unsigned short svm_reserved1;
|
||||
unsigned int svm_port;
|
||||
unsigned int svm_cid;
|
||||
unsigned char svm_zero[sizeof(struct sockaddr) -
|
||||
sizeof(unsigned short) -
|
||||
sizeof(unsigned short) -
|
||||
sizeof(unsigned int) -
|
||||
sizeof(unsigned int)];
|
||||
};
|
||||
#endif /* !HAVE_LINUX_VM_SOCKETS_H */
|
||||
|
||||
#ifndef RLIMIT_RTTIME
|
||||
#define RLIMIT_RTTIME 15
|
||||
#endif
|
||||
|
||||
/* If RLIMIT_RTTIME is not defined, then we cannot use RLIMIT_NLIMITS as is */
|
||||
#define _RLIMIT_MAX (RLIMIT_RTTIME+1 > RLIMIT_NLIMITS ? RLIMIT_RTTIME+1 : RLIMIT_NLIMITS)
|
||||
|
||||
#ifndef F_LINUX_SPECIFIC_BASE
|
||||
#define F_LINUX_SPECIFIC_BASE 1024
|
||||
#endif
|
||||
|
||||
#ifndef F_SETPIPE_SZ
|
||||
#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
|
||||
#endif
|
||||
|
||||
#ifndef F_GETPIPE_SZ
|
||||
#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
|
||||
#endif
|
||||
|
||||
#ifndef F_ADD_SEALS
|
||||
#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
|
||||
#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
|
||||
|
||||
#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
|
||||
#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
|
||||
#define F_SEAL_GROW 0x0004 /* prevent file from growing */
|
||||
#define F_SEAL_WRITE 0x0008 /* prevent writes */
|
||||
#endif
|
||||
|
||||
#ifndef F_OFD_GETLK
|
||||
#define F_OFD_GETLK 36
|
||||
#define F_OFD_SETLK 37
|
||||
#define F_OFD_SETLKW 38
|
||||
#endif
|
||||
|
||||
#ifndef MFD_ALLOW_SEALING
|
||||
#define MFD_ALLOW_SEALING 0x0002U
|
||||
#endif
|
||||
|
||||
#ifndef MFD_CLOEXEC
|
||||
#define MFD_CLOEXEC 0x0001U
|
||||
#endif
|
||||
|
||||
#ifndef IP_FREEBIND
|
||||
#define IP_FREEBIND 15
|
||||
#endif
|
||||
|
||||
#ifndef OOM_SCORE_ADJ_MIN
|
||||
#define OOM_SCORE_ADJ_MIN (-1000)
|
||||
#endif
|
||||
|
||||
#ifndef OOM_SCORE_ADJ_MAX
|
||||
#define OOM_SCORE_ADJ_MAX 1000
|
||||
#endif
|
||||
|
||||
#ifndef AUDIT_SERVICE_START
|
||||
#define AUDIT_SERVICE_START 1130 /* Service (daemon) start */
|
||||
#endif
|
||||
|
||||
#ifndef AUDIT_SERVICE_STOP
|
||||
#define AUDIT_SERVICE_STOP 1131 /* Service (daemon) stop */
|
||||
#endif
|
||||
|
||||
#ifndef TIOCVHANGUP
|
||||
#define TIOCVHANGUP 0x5437
|
||||
#endif
|
||||
|
||||
#ifndef IP_TRANSPARENT
|
||||
#define IP_TRANSPARENT 19
|
||||
#endif
|
||||
|
||||
#ifndef SOL_NETLINK
|
||||
#define SOL_NETLINK 270
|
||||
#endif
|
||||
|
||||
#ifndef NETLINK_LIST_MEMBERSHIPS
|
||||
#define NETLINK_LIST_MEMBERSHIPS 9
|
||||
#endif
|
||||
|
||||
#ifndef SOL_SCTP
|
||||
#define SOL_SCTP 132
|
||||
#endif
|
||||
|
||||
#ifndef GRND_NONBLOCK
|
||||
#define GRND_NONBLOCK 0x0001
|
||||
#endif
|
||||
|
||||
#ifndef GRND_RANDOM
|
||||
#define GRND_RANDOM 0x0002
|
||||
#endif
|
||||
|
||||
#ifndef FS_NOCOW_FL
|
||||
#define FS_NOCOW_FL 0x00800000
|
||||
#endif
|
||||
|
||||
#ifndef CLONE_NEWCGROUP
|
||||
#define CLONE_NEWCGROUP 0x02000000
|
||||
#endif
|
||||
|
||||
#ifndef MS_MOVE
|
||||
#define MS_MOVE 8192
|
||||
#endif
|
||||
|
||||
#ifndef MS_REC
|
||||
#define MS_REC 16384
|
||||
#endif
|
||||
|
||||
#ifndef MS_PRIVATE
|
||||
#define MS_PRIVATE (1<<18)
|
||||
#endif
|
||||
|
||||
#ifndef MS_REC
|
||||
#define MS_REC (1<<19)
|
||||
#endif
|
||||
|
||||
#ifndef MS_SHARED
|
||||
#define MS_SHARED (1<<20)
|
||||
#endif
|
||||
|
||||
#ifndef MS_RELATIME
|
||||
#define MS_RELATIME (1<<21)
|
||||
#endif
|
||||
|
||||
#ifndef MS_KERNMOUNT
|
||||
#define MS_KERNMOUNT (1<<22)
|
||||
#endif
|
||||
|
||||
#ifndef MS_I_VERSION
|
||||
#define MS_I_VERSION (1<<23)
|
||||
#endif
|
||||
|
||||
#ifndef MS_STRICTATIME
|
||||
#define MS_STRICTATIME (1<<24)
|
||||
#endif
|
||||
|
||||
#ifndef MS_LAZYTIME
|
||||
#define MS_LAZYTIME (1<<25)
|
||||
#endif
|
||||
|
||||
#ifndef SCM_SECURITY
|
||||
#define SCM_SECURITY 0x03
|
||||
#endif
|
||||
|
||||
#ifndef DM_DEFERRED_REMOVE
|
||||
#define DM_DEFERRED_REMOVE (1 << 17)
|
||||
#endif
|
||||
|
||||
#ifndef MAX_HANDLE_SZ
|
||||
#define MAX_HANDLE_SZ 128
|
||||
#endif
|
||||
|
||||
#if ! HAVE_SECURE_GETENV
|
||||
# if HAVE___SECURE_GETENV
|
||||
# define secure_getenv __secure_getenv
|
||||
# else
|
||||
# error "neither secure_getenv nor __secure_getenv are available"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef CIFS_MAGIC_NUMBER
|
||||
# define CIFS_MAGIC_NUMBER 0xFF534D42
|
||||
#endif
|
||||
|
||||
#ifndef TFD_TIMER_CANCEL_ON_SET
|
||||
# define TFD_TIMER_CANCEL_ON_SET (1 << 1)
|
||||
#endif
|
||||
|
||||
#ifndef SO_REUSEPORT
|
||||
# define SO_REUSEPORT 15
|
||||
#endif
|
||||
|
||||
#ifndef SO_PEERGROUPS
|
||||
# define SO_PEERGROUPS 59
|
||||
#endif
|
||||
|
||||
#ifndef DRM_IOCTL_SET_MASTER
|
||||
# define DRM_IOCTL_SET_MASTER _IO('d', 0x1e)
|
||||
#endif
|
||||
|
||||
#ifndef DRM_IOCTL_DROP_MASTER
|
||||
# define DRM_IOCTL_DROP_MASTER _IO('d', 0x1f)
|
||||
#endif
|
||||
|
||||
/* The precise definition of __O_TMPFILE is arch specific; use the
|
||||
* values defined by the kernel (note: some are hexa, some are octal,
|
||||
* duplicated as-is from the kernel definitions):
|
||||
* - alpha, parisc, sparc: each has a specific value;
|
||||
* - others: they use the "generic" value.
|
||||
*/
|
||||
|
||||
#ifndef __O_TMPFILE
|
||||
#if defined(__alpha__)
|
||||
#define __O_TMPFILE 0100000000
|
||||
#elif defined(__parisc__) || defined(__hppa__)
|
||||
#define __O_TMPFILE 0400000000
|
||||
#elif defined(__sparc__) || defined(__sparc64__)
|
||||
#define __O_TMPFILE 0x2000000
|
||||
#else
|
||||
#define __O_TMPFILE 020000000
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* a horrid kludge trying to make sure that this will fail on old kernels */
|
||||
#ifndef O_TMPFILE
|
||||
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
|
||||
#endif
|
||||
|
||||
#ifndef BPF_XOR
|
||||
#define BPF_XOR 0xa0
|
||||
#endif
|
||||
|
||||
/* Note that LOOPBACK_IFINDEX is currently not exported by the
|
||||
* kernel/glibc, but hardcoded internally by the kernel. However, as
|
||||
* it is exported to userspace indirectly via rtnetlink and the
|
||||
* ioctls, and made use of widely we define it here too, in a way that
|
||||
* is compatible with the kernel's internal definition. */
|
||||
#ifndef LOOPBACK_IFINDEX
|
||||
#define LOOPBACK_IFINDEX 1
|
||||
#endif
|
||||
|
||||
#ifndef MAX_AUDIT_MESSAGE_LENGTH
|
||||
#define MAX_AUDIT_MESSAGE_LENGTH 8970
|
||||
#endif
|
||||
|
||||
#ifndef AUDIT_NLGRP_MAX
|
||||
#define AUDIT_NLGRP_READLOG 1
|
||||
#endif
|
||||
|
||||
#ifndef RENAME_NOREPLACE
|
||||
#define RENAME_NOREPLACE (1 << 0)
|
||||
#endif
|
||||
|
||||
#ifndef KCMP_FILE
|
||||
#define KCMP_FILE 0
|
||||
#endif
|
||||
|
||||
#ifndef ETHERTYPE_LLDP
|
||||
#define ETHERTYPE_LLDP 0x88cc
|
||||
#endif
|
||||
|
||||
#ifndef SOL_ALG
|
||||
#define SOL_ALG 279
|
||||
#endif
|
||||
|
||||
#ifndef AF_VSOCK
|
||||
#define AF_VSOCK 40
|
||||
#endif
|
||||
|
||||
#ifndef EXT4_IOC_RESIZE_FS
|
||||
# define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
|
||||
#endif
|
||||
|
||||
#ifndef NS_GET_NSTYPE
|
||||
#define NS_GET_NSTYPE _IO(0xb7, 0x3)
|
||||
#endif
|
||||
|
||||
#ifndef FALLOC_FL_KEEP_SIZE
|
||||
#define FALLOC_FL_KEEP_SIZE 0x01
|
||||
#endif
|
||||
|
||||
#ifndef FALLOC_FL_PUNCH_HOLE
|
||||
#define FALLOC_FL_PUNCH_HOLE 0x02
|
||||
#endif
|
||||
|
||||
#ifndef PF_KTHREAD
|
||||
#define PF_KTHREAD 0x00200000
|
||||
#endif
|
||||
|
||||
/* The maximum thread/process name length including trailing NUL byte. This mimics the kernel definition of the same
|
||||
* name, which we need in userspace at various places but is not defined in userspace currently, neither under this
|
||||
* name nor any other. */
|
||||
#ifndef TASK_COMM_LEN
|
||||
#define TASK_COMM_LEN 16
|
||||
#endif
|
||||
|
||||
#include "missing_audit.h"
|
||||
#include "missing_btrfs_tree.h"
|
||||
#include "missing_capability.h"
|
||||
#include "missing_fcntl.h"
|
||||
#include "missing_fs.h"
|
||||
#include "missing_input.h"
|
||||
#include "missing_magic.h"
|
||||
#include "missing_mman.h"
|
||||
#include "missing_network.h"
|
||||
#include "missing_prctl.h"
|
||||
#include "missing_random.h"
|
||||
#include "missing_resource.h"
|
||||
#include "missing_sched.h"
|
||||
#include "missing_socket.h"
|
||||
#include "missing_stdlib.h"
|
||||
#include "missing_timerfd.h"
|
||||
#include "missing_type.h"
|
||||
|
||||
#include "missing_syscall.h"
|
||||
|
||||
24
src/basic/missing_audit.h
Normal file
24
src/basic/missing_audit.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <linux/audit.h>
|
||||
|
||||
#if HAVE_AUDIT
|
||||
#include <libaudit.h>
|
||||
#endif
|
||||
|
||||
#ifndef AUDIT_SERVICE_START
|
||||
#define AUDIT_SERVICE_START 1130 /* Service (daemon) start */
|
||||
#endif
|
||||
|
||||
#ifndef AUDIT_SERVICE_STOP
|
||||
#define AUDIT_SERVICE_STOP 1131 /* Service (daemon) stop */
|
||||
#endif
|
||||
|
||||
#ifndef MAX_AUDIT_MESSAGE_LENGTH
|
||||
#define MAX_AUDIT_MESSAGE_LENGTH 8970
|
||||
#endif
|
||||
|
||||
#ifndef AUDIT_NLGRP_MAX
|
||||
#define AUDIT_NLGRP_READLOG 1
|
||||
#endif
|
||||
60
src/basic/missing_fcntl.h
Normal file
60
src/basic/missing_fcntl.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef F_LINUX_SPECIFIC_BASE
|
||||
#define F_LINUX_SPECIFIC_BASE 1024
|
||||
#endif
|
||||
|
||||
#ifndef F_SETPIPE_SZ
|
||||
#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
|
||||
#endif
|
||||
|
||||
#ifndef F_GETPIPE_SZ
|
||||
#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
|
||||
#endif
|
||||
|
||||
#ifndef F_ADD_SEALS
|
||||
#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
|
||||
#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
|
||||
|
||||
#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
|
||||
#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
|
||||
#define F_SEAL_GROW 0x0004 /* prevent file from growing */
|
||||
#define F_SEAL_WRITE 0x0008 /* prevent writes */
|
||||
#endif
|
||||
|
||||
#ifndef F_OFD_GETLK
|
||||
#define F_OFD_GETLK 36
|
||||
#define F_OFD_SETLK 37
|
||||
#define F_OFD_SETLKW 38
|
||||
#endif
|
||||
|
||||
#ifndef MAX_HANDLE_SZ
|
||||
#define MAX_HANDLE_SZ 128
|
||||
#endif
|
||||
|
||||
/* The precise definition of __O_TMPFILE is arch specific; use the
|
||||
* values defined by the kernel (note: some are hexa, some are octal,
|
||||
* duplicated as-is from the kernel definitions):
|
||||
* - alpha, parisc, sparc: each has a specific value;
|
||||
* - others: they use the "generic" value.
|
||||
*/
|
||||
|
||||
#ifndef __O_TMPFILE
|
||||
#if defined(__alpha__)
|
||||
#define __O_TMPFILE 0100000000
|
||||
#elif defined(__parisc__) || defined(__hppa__)
|
||||
#define __O_TMPFILE 0400000000
|
||||
#elif defined(__sparc__) || defined(__sparc64__)
|
||||
#define __O_TMPFILE 0x2000000
|
||||
#else
|
||||
#define __O_TMPFILE 020000000
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* a horrid kludge trying to make sure that this will fail on old kernels */
|
||||
#ifndef O_TMPFILE
|
||||
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
|
||||
#endif
|
||||
63
src/basic/missing_fs.h
Normal file
63
src/basic/missing_fs.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
/* linux/fs.h */
|
||||
#ifndef RENAME_NOREPLACE /* 0a7c3937a1f23f8cb5fc77ae01661e9968a51d0c (3.15) */
|
||||
#define RENAME_NOREPLACE (1 << 0)
|
||||
#endif
|
||||
|
||||
/* linux/fs.h or sys/mount.h */
|
||||
#ifndef MS_MOVE
|
||||
#define MS_MOVE 8192
|
||||
#endif
|
||||
|
||||
#ifndef MS_REC
|
||||
#define MS_REC 16384
|
||||
#endif
|
||||
|
||||
#ifndef MS_PRIVATE
|
||||
#define MS_PRIVATE (1<<18)
|
||||
#endif
|
||||
|
||||
#ifndef MS_SLAVE
|
||||
#define MS_SLAVE (1<<19)
|
||||
#endif
|
||||
|
||||
#ifndef MS_SHARED
|
||||
#define MS_SHARED (1<<20)
|
||||
#endif
|
||||
|
||||
#ifndef MS_RELATIME
|
||||
#define MS_RELATIME (1<<21)
|
||||
#endif
|
||||
|
||||
#ifndef MS_KERNMOUNT
|
||||
#define MS_KERNMOUNT (1<<22)
|
||||
#endif
|
||||
|
||||
#ifndef MS_I_VERSION
|
||||
#define MS_I_VERSION (1<<23)
|
||||
#endif
|
||||
|
||||
#ifndef MS_STRICTATIME
|
||||
#define MS_STRICTATIME (1<<24)
|
||||
#endif
|
||||
|
||||
#ifndef MS_LAZYTIME
|
||||
#define MS_LAZYTIME (1<<25)
|
||||
#endif
|
||||
|
||||
/* Not exposed yet. Defined at fs/ext4/ext4.h */
|
||||
#ifndef EXT4_IOC_RESIZE_FS
|
||||
#define EXT4_IOC_RESIZE_FS _IOW('f', 16, __u64)
|
||||
#endif
|
||||
|
||||
/* Not exposed yet. Defined at fs/cifs/cifsglob.h */
|
||||
#ifndef CIFS_MAGIC_NUMBER
|
||||
#define CIFS_MAGIC_NUMBER 0xFF534D42
|
||||
#endif
|
||||
|
||||
/* linux/nsfs.h */
|
||||
#ifndef NS_GET_NSTYPE /* d95fa3c76a66b6d76b1e109ea505c55e66360f3c (4.11) */
|
||||
#define NS_GET_NSTYPE _IO(0xb7, 0x3)
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <linux/input.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
/* linux@c7dc65737c9a607d3e6f8478659876074ad129b8 (3.12) */
|
||||
#ifndef EVIOCREVOKE
|
||||
@@ -11,9 +12,9 @@
|
||||
/* linux@06a16293f71927f756dcf37558a79c0b05a91641 (4.4) */
|
||||
#ifndef EVIOCSMASK
|
||||
struct input_mask {
|
||||
uint32_t type;
|
||||
uint32_t codes_size;
|
||||
uint64_t codes_ptr;
|
||||
__u32 type;
|
||||
__u32 codes_size;
|
||||
__u64 codes_ptr;
|
||||
};
|
||||
|
||||
#define EVIOCGMASK _IOR('E', 0x92, struct input_mask)
|
||||
|
||||
12
src/basic/missing_mman.h
Normal file
12
src/basic/missing_mman.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
#ifndef MFD_ALLOW_SEALING
|
||||
#define MFD_ALLOW_SEALING 0x0002U
|
||||
#endif
|
||||
|
||||
#ifndef MFD_CLOEXEC
|
||||
#define MFD_CLOEXEC 0x0001U
|
||||
#endif
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <linux/loop.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <net/ethernet.h>
|
||||
|
||||
#include "missing_ethtool.h"
|
||||
#include "missing_fib_rules.h"
|
||||
@@ -116,6 +117,11 @@
|
||||
#define NET_NAME_RENAMED 4
|
||||
#endif
|
||||
|
||||
/* netlink.h */
|
||||
#ifndef NETLINK_LIST_MEMBERSHIPS /* b42be38b2778eda2237fc759e55e3b698b05b315 (4.2) */
|
||||
#define NETLINK_LIST_MEMBERSHIPS 9
|
||||
#endif
|
||||
|
||||
/* rtnetlink.h */
|
||||
#ifndef RTA_PREF
|
||||
#define RTA_PREF 20
|
||||
@@ -128,3 +134,17 @@
|
||||
#ifndef RTA_EXPIRES
|
||||
#define RTA_EXPIRES 23
|
||||
#endif
|
||||
|
||||
/* Note that LOOPBACK_IFINDEX is currently not exported by the
|
||||
* kernel/glibc, but hardcoded internally by the kernel. However, as
|
||||
* it is exported to userspace indirectly via rtnetlink and the
|
||||
* ioctls, and made use of widely we define it here too, in a way that
|
||||
* is compatible with the kernel's internal definition. */
|
||||
#ifndef LOOPBACK_IFINDEX
|
||||
#define LOOPBACK_IFINDEX 1
|
||||
#endif
|
||||
|
||||
/* Not exposed yet. Similar values are defined in net/ethernet.h */
|
||||
#ifndef ETHERTYPE_LLDP
|
||||
#define ETHERTYPE_LLDP 0x88cc
|
||||
#endif
|
||||
|
||||
16
src/basic/missing_random.h
Normal file
16
src/basic/missing_random.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#if USE_SYS_RANDOM_H
|
||||
# include <sys/random.h>
|
||||
#else
|
||||
# include <linux/random.h>
|
||||
#endif
|
||||
|
||||
#ifndef GRND_NONBLOCK
|
||||
#define GRND_NONBLOCK 0x0001
|
||||
#endif
|
||||
|
||||
#ifndef GRND_RANDOM
|
||||
#define GRND_RANDOM 0x0002
|
||||
#endif
|
||||
11
src/basic/missing_resource.h
Normal file
11
src/basic/missing_resource.h
Normal file
@@ -0,0 +1,11 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#ifndef RLIMIT_RTTIME
|
||||
#define RLIMIT_RTTIME 15
|
||||
#endif
|
||||
|
||||
/* If RLIMIT_RTTIME is not defined, then we cannot use RLIMIT_NLIMITS as is */
|
||||
#define _RLIMIT_MAX (RLIMIT_RTTIME+1 > RLIMIT_NLIMITS ? RLIMIT_RTTIME+1 : RLIMIT_NLIMITS)
|
||||
21
src/basic/missing_sched.h
Normal file
21
src/basic/missing_sched.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <sched.h>
|
||||
|
||||
#ifndef CLONE_NEWCGROUP
|
||||
#define CLONE_NEWCGROUP 0x02000000
|
||||
#endif
|
||||
|
||||
/* Not exposed yet. Defined at include/linux/sched.h */
|
||||
#ifndef PF_KTHREAD
|
||||
#define PF_KTHREAD 0x00200000
|
||||
#endif
|
||||
|
||||
/* The maximum thread/process name length including trailing NUL byte. This mimics the kernel definition of the same
|
||||
* name, which we need in userspace at various places but is not defined in userspace currently, neither under this
|
||||
* name nor any other. */
|
||||
/* Not exposed yet. Defined at include/linux/sched.h */
|
||||
#ifndef TASK_COMM_LEN
|
||||
#define TASK_COMM_LEN 16
|
||||
#endif
|
||||
60
src/basic/missing_socket.h
Normal file
60
src/basic/missing_socket.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
#if HAVE_LINUX_VM_SOCKETS_H
|
||||
#include <linux/vm_sockets.h>
|
||||
#else
|
||||
#define VMADDR_CID_ANY -1U
|
||||
struct sockaddr_vm {
|
||||
unsigned short svm_family;
|
||||
unsigned short svm_reserved1;
|
||||
unsigned int svm_port;
|
||||
unsigned int svm_cid;
|
||||
unsigned char svm_zero[sizeof(struct sockaddr) -
|
||||
sizeof(unsigned short) -
|
||||
sizeof(unsigned short) -
|
||||
sizeof(unsigned int) -
|
||||
sizeof(unsigned int)];
|
||||
};
|
||||
#endif /* !HAVE_LINUX_VM_SOCKETS_H */
|
||||
|
||||
#ifndef AF_VSOCK
|
||||
#define AF_VSOCK 40
|
||||
#endif
|
||||
|
||||
#ifndef SO_REUSEPORT
|
||||
#define SO_REUSEPORT 15
|
||||
#endif
|
||||
|
||||
#ifndef SO_PEERGROUPS
|
||||
#define SO_PEERGROUPS 59
|
||||
#endif
|
||||
|
||||
#ifndef SOL_NETLINK
|
||||
#define SOL_NETLINK 270
|
||||
#endif
|
||||
|
||||
#ifndef SOL_ALG
|
||||
#define SOL_ALG 279
|
||||
#endif
|
||||
|
||||
/* Not exposed yet. Defined in include/linux/socket.h. */
|
||||
#ifndef SOL_SCTP
|
||||
#define SOL_SCTP 132
|
||||
#endif
|
||||
|
||||
/* Not exposed yet. Defined in include/linux/socket.h */
|
||||
#ifndef SCM_SECURITY
|
||||
#define SCM_SECURITY 0x03
|
||||
#endif
|
||||
|
||||
/* netinet/in.h */
|
||||
#ifndef IP_FREEBIND
|
||||
#define IP_FREEBIND 15
|
||||
#endif
|
||||
|
||||
#ifndef IP_TRANSPARENT
|
||||
#define IP_TRANSPARENT 19
|
||||
#endif
|
||||
@@ -11,32 +11,32 @@
|
||||
/* a528d35e8bfcc521d7cb70aaf03e1bd296c8493f (4.11) */
|
||||
#if !HAVE_STRUCT_STATX
|
||||
struct statx_timestamp {
|
||||
int64_t tv_sec;
|
||||
uint32_t tv_nsec;
|
||||
uint32_t __reserved;
|
||||
__s64 tv_sec;
|
||||
__u32 tv_nsec;
|
||||
__s32 __reserved;
|
||||
};
|
||||
struct statx {
|
||||
uint32_t stx_mask;
|
||||
uint32_t stx_blksize;
|
||||
uint64_t stx_attributes;
|
||||
uint32_t stx_nlink;
|
||||
uint32_t stx_uid;
|
||||
uint32_t stx_gid;
|
||||
uint16_t stx_mode;
|
||||
uint16_t __spare0[1];
|
||||
uint64_t stx_ino;
|
||||
uint64_t stx_size;
|
||||
uint64_t stx_blocks;
|
||||
uint64_t stx_attributes_mask;
|
||||
__u32 stx_mask;
|
||||
__u32 stx_blksize;
|
||||
__u64 stx_attributes;
|
||||
__u32 stx_nlink;
|
||||
__u32 stx_uid;
|
||||
__u32 stx_gid;
|
||||
__u16 stx_mode;
|
||||
__u16 __spare0[1];
|
||||
__u64 stx_ino;
|
||||
__u64 stx_size;
|
||||
__u64 stx_blocks;
|
||||
__u64 stx_attributes_mask;
|
||||
struct statx_timestamp stx_atime;
|
||||
struct statx_timestamp stx_btime;
|
||||
struct statx_timestamp stx_ctime;
|
||||
struct statx_timestamp stx_mtime;
|
||||
uint32_t stx_rdev_major;
|
||||
uint32_t stx_rdev_minor;
|
||||
uint32_t stx_dev_major;
|
||||
uint32_t stx_dev_minor;
|
||||
uint64_t __spare2[14];
|
||||
__u32 stx_rdev_major;
|
||||
__u32 stx_rdev_minor;
|
||||
__u32 stx_dev_major;
|
||||
__u32 stx_dev_minor;
|
||||
__u64 __spare2[14];
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
13
src/basic/missing_stdlib.h
Normal file
13
src/basic/missing_stdlib.h
Normal file
@@ -0,0 +1,13 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/* stdlib.h */
|
||||
#if !HAVE_SECURE_GETENV
|
||||
# if HAVE___SECURE_GETENV
|
||||
# define secure_getenv __secure_getenv
|
||||
# else
|
||||
# error "neither secure_getenv nor __secure_getenv are available"
|
||||
# endif
|
||||
#endif
|
||||
@@ -6,10 +6,20 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef ARCH_MIPS
|
||||
#include <asm/sgidefs.h>
|
||||
#endif
|
||||
|
||||
#include "missing_keyctl.h"
|
||||
#include "missing_stat.h"
|
||||
|
||||
/* linux/kcmp.h */
|
||||
#ifndef KCMP_FILE /* 3f4994cfc15f38a3159c6e3a4b3ab2e1481a6b02 (3.19) */
|
||||
#define KCMP_FILE 0
|
||||
#endif
|
||||
|
||||
#if !HAVE_PIVOT_ROOT
|
||||
static inline int missing_pivot_root(const char *new_root, const char *put_old) {
|
||||
return syscall(__NR_pivot_root, new_root, put_old);
|
||||
@@ -257,7 +267,7 @@ static inline int missing_kcmp(pid_t pid1, pid_t pid2, int type, unsigned long i
|
||||
/* ======================================================================= */
|
||||
|
||||
#if !HAVE_KEYCTL
|
||||
static inline long missing_keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4,unsigned long arg5) {
|
||||
static inline long missing_keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5) {
|
||||
# ifdef __NR_keyctl
|
||||
return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
|
||||
# else
|
||||
|
||||
8
src/basic/missing_timerfd.h
Normal file
8
src/basic/missing_timerfd.h
Normal file
@@ -0,0 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <sys/timerfd.h>
|
||||
|
||||
#ifndef TFD_TIMER_CANCEL_ON_SET
|
||||
#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
#include <linux/oom.h>
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#include <elf.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <linux/random.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
#include <linux/if_packet.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdbool.h>
|
||||
@@ -8,13 +12,10 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/if_infiniband.h>
|
||||
#include <linux/if_packet.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "missing.h"
|
||||
#include "util.h"
|
||||
#include "missing_socket.h"
|
||||
#include "sparse-endian.h"
|
||||
|
||||
union sockaddr_union {
|
||||
/* The minimal, abstract version */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user