include: import kernel headers for several struct and enum definitions

- mempolicy.h for MPOL_DEFAULT and friends,
- sched/types.h for struct sched_attr,
- xattr.h for struct xattr_args.
This commit is contained in:
Yu Watanabe
2025-06-25 00:50:06 +09:00
parent 50cda6433b
commit 118ac16b6e
7 changed files with 307 additions and 40 deletions
+2 -14
View File
@@ -3,8 +3,10 @@
/* Missing glibc definitions to access certain kernel APIs */
#include <linux/mempolicy.h>
#include <signal.h>
#include <sys/syscall.h>
#include <sys/xattr.h>
#include <unistd.h>
#ifdef ARCH_MIPS
@@ -108,14 +110,6 @@ static inline int missing_bpf(int cmd, union bpf_attr *attr, size_t size) {
/* ======================================================================= */
#if !HAVE_SET_MEMPOLICY
enum {
MPOL_DEFAULT,
MPOL_PREFERRED,
MPOL_BIND,
MPOL_INTERLEAVE,
MPOL_LOCAL,
};
static inline long missing_set_mempolicy(int mode, const unsigned long *nodemask,
unsigned long maxnode) {
return syscall(__NR_set_mempolicy, mode, nodemask, maxnode);
@@ -236,12 +230,6 @@ static inline int missing_quotactl_fd(int fd, int cmd, int id, void *addr) {
#if !HAVE_SETXATTRAT
/* since kernel v6.13 (6140be90ec70c39fa844741ca3cc807dd0866394) */
struct xattr_args {
_align_(8) uint64_t value;
uint32_t size;
uint32_t flags;
};
static inline int missing_setxattrat(int fd, const char *path, int at_flags, const char *name, const struct xattr_args *args, size_t size) {
return syscall(__NR_setxattrat, fd, path, at_flags, name, args, size);
}