fix: 把内核恢复成 GitHub 原版
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
|
||||
#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
static inline unsigned int __arch_hweight32(unsigned int w)
|
||||
{
|
||||
return __sw_hweight32(w);
|
||||
}
|
||||
|
||||
static inline unsigned int __arch_hweight16(unsigned int w)
|
||||
{
|
||||
return __sw_hweight16(w);
|
||||
}
|
||||
|
||||
static inline unsigned int __arch_hweight8(unsigned int w)
|
||||
{
|
||||
return __sw_hweight8(w);
|
||||
}
|
||||
|
||||
static inline unsigned long __arch_hweight64(__u64 w)
|
||||
{
|
||||
return __sw_hweight64(w);
|
||||
}
|
||||
#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
|
||||
#define _ASM_GENERIC_BITOPS_ARCH_HWEIGHT_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
static inline unsigned int __arch_hweight32(unsigned int w)
|
||||
{
|
||||
return __sw_hweight32(w);
|
||||
}
|
||||
|
||||
static inline unsigned int __arch_hweight16(unsigned int w)
|
||||
{
|
||||
return __sw_hweight16(w);
|
||||
}
|
||||
|
||||
static inline unsigned int __arch_hweight8(unsigned int w)
|
||||
{
|
||||
return __sw_hweight8(w);
|
||||
}
|
||||
|
||||
static inline unsigned long __arch_hweight64(__u64 w)
|
||||
{
|
||||
return __sw_hweight64(w);
|
||||
}
|
||||
#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_
|
||||
#define _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/bitsperlong.h>
|
||||
|
||||
/*
|
||||
* Just alias the test versions, all of the compiler built-in atomics "fetch",
|
||||
* and optimizing compile-time constants on x86 isn't worth the complexity.
|
||||
*/
|
||||
#define set_bit test_and_set_bit
|
||||
#define clear_bit test_and_clear_bit
|
||||
|
||||
#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_
|
||||
#define _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <asm/bitsperlong.h>
|
||||
|
||||
/*
|
||||
* Just alias the test versions, all of the compiler built-in atomics "fetch",
|
||||
* and optimizing compile-time constants on x86 isn't worth the complexity.
|
||||
*/
|
||||
#define set_bit test_and_set_bit
|
||||
#define clear_bit test_and_clear_bit
|
||||
|
||||
#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ */
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_BITS_PER_LONG
|
||||
#define __ASM_GENERIC_BITS_PER_LONG
|
||||
|
||||
#include <uapi/asm-generic/bitsperlong.h>
|
||||
|
||||
#ifdef __SIZEOF_LONG__
|
||||
#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
|
||||
#else
|
||||
#define BITS_PER_LONG __WORDSIZE
|
||||
#endif
|
||||
|
||||
#if BITS_PER_LONG != __BITS_PER_LONG
|
||||
#error Inconsistent word size. Check asm/bitsperlong.h
|
||||
#endif
|
||||
|
||||
#ifndef BITS_PER_LONG_LONG
|
||||
#define BITS_PER_LONG_LONG 64
|
||||
#endif
|
||||
|
||||
#define small_const_nbits(nbits) \
|
||||
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0)
|
||||
|
||||
#endif /* __ASM_GENERIC_BITS_PER_LONG */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __ASM_GENERIC_BITS_PER_LONG
|
||||
#define __ASM_GENERIC_BITS_PER_LONG
|
||||
|
||||
#include <uapi/asm-generic/bitsperlong.h>
|
||||
|
||||
#ifdef __SIZEOF_LONG__
|
||||
#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
|
||||
#else
|
||||
#define BITS_PER_LONG __WORDSIZE
|
||||
#endif
|
||||
|
||||
#if BITS_PER_LONG != __BITS_PER_LONG
|
||||
#error Inconsistent word size. Check asm/bitsperlong.h
|
||||
#endif
|
||||
|
||||
#ifndef BITS_PER_LONG_LONG
|
||||
#define BITS_PER_LONG_LONG 64
|
||||
#endif
|
||||
|
||||
#define small_const_nbits(nbits) \
|
||||
(__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0)
|
||||
|
||||
#endif /* __ASM_GENERIC_BITS_PER_LONG */
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TOOLS_ASM_ALTERNATIVE_ASM_H
|
||||
#define _TOOLS_ASM_ALTERNATIVE_ASM_H
|
||||
|
||||
#if defined(__s390x__)
|
||||
#ifdef __ASSEMBLY__
|
||||
.macro ALTERNATIVE oldinstr, newinstr, feature
|
||||
\oldinstr
|
||||
.endm
|
||||
#endif
|
||||
#else
|
||||
|
||||
/* Just disable it so we can build arch/x86/lib/memcpy_64.S for perf bench: */
|
||||
|
||||
#define ALTERNATIVE #
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TOOLS_ASM_ALTERNATIVE_ASM_H
|
||||
#define _TOOLS_ASM_ALTERNATIVE_ASM_H
|
||||
|
||||
#if defined(__s390x__)
|
||||
#ifdef __ASSEMBLY__
|
||||
.macro ALTERNATIVE oldinstr, newinstr, feature
|
||||
\oldinstr
|
||||
.endm
|
||||
#endif
|
||||
#else
|
||||
|
||||
/* Just disable it so we can build arch/x86/lib/memcpy_64.S for perf bench: */
|
||||
|
||||
#define ALTERNATIVE #
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __TOOLS_LINUX_ATOMIC_H
|
||||
#define __TOOLS_LINUX_ATOMIC_H
|
||||
|
||||
#include <asm/atomic.h>
|
||||
|
||||
void atomic_long_set(atomic_long_t *v, long i);
|
||||
|
||||
/* atomic_cmpxchg_relaxed */
|
||||
#ifndef atomic_cmpxchg_relaxed
|
||||
#define atomic_cmpxchg_relaxed atomic_cmpxchg
|
||||
#define atomic_cmpxchg_release atomic_cmpxchg
|
||||
#endif /* atomic_cmpxchg_relaxed */
|
||||
|
||||
#endif /* __TOOLS_LINUX_ATOMIC_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __TOOLS_LINUX_ATOMIC_H
|
||||
#define __TOOLS_LINUX_ATOMIC_H
|
||||
|
||||
#include <asm/atomic.h>
|
||||
|
||||
void atomic_long_set(atomic_long_t *v, long i);
|
||||
|
||||
/* atomic_cmpxchg_relaxed */
|
||||
#ifndef atomic_cmpxchg_relaxed
|
||||
#define atomic_cmpxchg_relaxed atomic_cmpxchg
|
||||
#define atomic_cmpxchg_release atomic_cmpxchg
|
||||
#endif /* atomic_cmpxchg_relaxed */
|
||||
|
||||
#endif /* __TOOLS_LINUX_ATOMIC_H */
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TOOLS_PERF_LINUX_BUG_H
|
||||
#define _TOOLS_PERF_LINUX_BUG_H
|
||||
|
||||
/* Force a compilation error if condition is true, but also produce a
|
||||
result (of value 0 and type size_t), so the expression can be used
|
||||
e.g. in a structure initializer (or where-ever else comma expressions
|
||||
aren't permitted). */
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
|
||||
#endif /* _TOOLS_PERF_LINUX_BUG_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TOOLS_PERF_LINUX_BUG_H
|
||||
#define _TOOLS_PERF_LINUX_BUG_H
|
||||
|
||||
/* Force a compilation error if condition is true, but also produce a
|
||||
result (of value 0 and type size_t), so the expression can be used
|
||||
e.g. in a structure initializer (or where-ever else comma expressions
|
||||
aren't permitted). */
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
|
||||
#endif /* _TOOLS_PERF_LINUX_BUG_H */
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_LIST_SORT_H
|
||||
#define _LINUX_LIST_SORT_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct list_head;
|
||||
|
||||
typedef int __attribute__((nonnull(2,3))) (*list_cmp_func_t)(void *,
|
||||
const struct list_head *, const struct list_head *);
|
||||
|
||||
__attribute__((nonnull(2,3)))
|
||||
void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp);
|
||||
#endif
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_LIST_SORT_H
|
||||
#define _LINUX_LIST_SORT_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct list_head;
|
||||
|
||||
typedef int __attribute__((nonnull(2,3))) (*list_cmp_func_t)(void *,
|
||||
const struct list_head *, const struct list_head *);
|
||||
|
||||
__attribute__((nonnull(2,3)))
|
||||
void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp);
|
||||
#endif
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_NUMA_H
|
||||
#define _LINUX_NUMA_H
|
||||
|
||||
|
||||
#ifdef CONFIG_NODES_SHIFT
|
||||
#define NODES_SHIFT CONFIG_NODES_SHIFT
|
||||
#else
|
||||
#define NODES_SHIFT 0
|
||||
#endif
|
||||
|
||||
#define MAX_NUMNODES (1 << NODES_SHIFT)
|
||||
|
||||
#define NUMA_NO_NODE (-1)
|
||||
|
||||
static inline bool numa_valid_node(int nid)
|
||||
{
|
||||
return nid >= 0 && nid < MAX_NUMNODES;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_NUMA_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_NUMA_H
|
||||
#define _LINUX_NUMA_H
|
||||
|
||||
|
||||
#ifdef CONFIG_NODES_SHIFT
|
||||
#define NODES_SHIFT CONFIG_NODES_SHIFT
|
||||
#else
|
||||
#define NODES_SHIFT 0
|
||||
#endif
|
||||
|
||||
#define MAX_NUMNODES (1 << NODES_SHIFT)
|
||||
|
||||
#define NUMA_NO_NODE (-1)
|
||||
|
||||
static inline bool numa_valid_node(int nid)
|
||||
{
|
||||
return nid >= 0 && nid < MAX_NUMNODES;
|
||||
}
|
||||
|
||||
#endif /* _LINUX_NUMA_H */
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LIBLOCKDEP_RCU_H_
|
||||
#define _LIBLOCKDEP_RCU_H_
|
||||
|
||||
int rcu_scheduler_active;
|
||||
|
||||
static inline int rcu_lockdep_current_cpu_online(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int rcu_is_cpu_idle(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline bool rcu_is_watching(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#define rcu_assign_pointer(p, v) do { (p) = (v); } while (0)
|
||||
#define RCU_INIT_POINTER(p, v) do { (p) = (v); } while (0)
|
||||
|
||||
#endif
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LIBLOCKDEP_RCU_H_
|
||||
#define _LIBLOCKDEP_RCU_H_
|
||||
|
||||
int rcu_scheduler_active;
|
||||
|
||||
static inline int rcu_lockdep_current_cpu_online(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int rcu_is_cpu_idle(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline bool rcu_is_watching(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#define rcu_assign_pointer(p, v) do { (p) = (v); } while (0)
|
||||
#define RCU_INIT_POINTER(p, v) do { (p) = (v); } while (0)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __LINUX_STRINGIFY_H
|
||||
#define __LINUX_STRINGIFY_H
|
||||
|
||||
/* Indirect stringification. Doing two levels allows the parameter to be a
|
||||
* macro itself. For example, compile with -DFOO=bar, __stringify(FOO)
|
||||
* converts to "bar".
|
||||
*/
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
#endif /* !__LINUX_STRINGIFY_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __LINUX_STRINGIFY_H
|
||||
#define __LINUX_STRINGIFY_H
|
||||
|
||||
/* Indirect stringification. Doing two levels allows the parameter to be a
|
||||
* macro itself. For example, compile with -DFOO=bar, __stringify(FOO)
|
||||
* converts to "bar".
|
||||
*/
|
||||
|
||||
#define __stringify_1(x...) #x
|
||||
#define __stringify(x...) __stringify_1(x)
|
||||
|
||||
#endif /* !__LINUX_STRINGIFY_H */
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TOOLS_LINUX_TIME64_H
|
||||
#define _TOOLS_LINUX_TIME64_H
|
||||
|
||||
#define MSEC_PER_SEC 1000L
|
||||
#define USEC_PER_MSEC 1000L
|
||||
#define NSEC_PER_USEC 1000L
|
||||
#define NSEC_PER_MSEC 1000000L
|
||||
#define USEC_PER_SEC 1000000L
|
||||
#define NSEC_PER_SEC 1000000000L
|
||||
#define FSEC_PER_SEC 1000000000000000LL
|
||||
|
||||
#endif /* _LINUX_TIME64_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _TOOLS_LINUX_TIME64_H
|
||||
#define _TOOLS_LINUX_TIME64_H
|
||||
|
||||
#define MSEC_PER_SEC 1000L
|
||||
#define USEC_PER_MSEC 1000L
|
||||
#define NSEC_PER_USEC 1000L
|
||||
#define NSEC_PER_MSEC 1000000L
|
||||
#define USEC_PER_SEC 1000000L
|
||||
#define NSEC_PER_SEC 1000000000L
|
||||
#define FSEC_PER_SEC 1000000000000000LL
|
||||
|
||||
#endif /* _LINUX_TIME64_H */
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* signal function definitions for NOLIBC
|
||||
* Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_SIGNAL_H
|
||||
#define _NOLIBC_SIGNAL_H
|
||||
|
||||
#include "std.h"
|
||||
#include "arch.h"
|
||||
#include "types.h"
|
||||
#include "sys.h"
|
||||
|
||||
/* This one is not marked static as it's needed by libgcc for divide by zero */
|
||||
__attribute__((weak,unused,section(".text.nolibc_raise")))
|
||||
int raise(int signal)
|
||||
{
|
||||
return sys_kill(sys_getpid(), signal);
|
||||
}
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "nolibc.h"
|
||||
|
||||
#endif /* _NOLIBC_SIGNAL_H */
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* signal function definitions for NOLIBC
|
||||
* Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_SIGNAL_H
|
||||
#define _NOLIBC_SIGNAL_H
|
||||
|
||||
#include "std.h"
|
||||
#include "arch.h"
|
||||
#include "types.h"
|
||||
#include "sys.h"
|
||||
|
||||
/* This one is not marked static as it's needed by libgcc for divide by zero */
|
||||
__attribute__((weak,unused,section(".text.nolibc_raise")))
|
||||
int raise(int signal)
|
||||
{
|
||||
return sys_kill(sys_getpid(), signal);
|
||||
}
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "nolibc.h"
|
||||
|
||||
#endif /* _NOLIBC_SIGNAL_H */
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* Variadic argument support for NOLIBC
|
||||
* Copyright (C) 2005-2020 Rich Felker, et al.
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_STDARG_H
|
||||
#define _NOLIBC_STDARG_H
|
||||
|
||||
typedef __builtin_va_list va_list;
|
||||
#define va_start(v, l) __builtin_va_start(v, l)
|
||||
#define va_end(v) __builtin_va_end(v)
|
||||
#define va_arg(v, l) __builtin_va_arg(v, l)
|
||||
#define va_copy(d, s) __builtin_va_copy(d, s)
|
||||
|
||||
#endif /* _NOLIBC_STDARG_H */
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* Variadic argument support for NOLIBC
|
||||
* Copyright (C) 2005-2020 Rich Felker, et al.
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_STDARG_H
|
||||
#define _NOLIBC_STDARG_H
|
||||
|
||||
typedef __builtin_va_list va_list;
|
||||
#define va_start(v, l) __builtin_va_start(v, l)
|
||||
#define va_end(v) __builtin_va_end(v)
|
||||
#define va_arg(v, l) __builtin_va_arg(v, l)
|
||||
#define va_copy(d, s) __builtin_va_copy(d, s)
|
||||
|
||||
#endif /* _NOLIBC_STDARG_H */
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* time function definitions for NOLIBC
|
||||
* Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_TIME_H
|
||||
#define _NOLIBC_TIME_H
|
||||
|
||||
#include "std.h"
|
||||
#include "arch.h"
|
||||
#include "types.h"
|
||||
#include "sys.h"
|
||||
|
||||
static __attribute__((unused))
|
||||
time_t time(time_t *tptr)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
/* note, cannot fail here */
|
||||
sys_gettimeofday(&tv, NULL);
|
||||
|
||||
if (tptr)
|
||||
*tptr = tv.tv_sec;
|
||||
return tv.tv_sec;
|
||||
}
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "nolibc.h"
|
||||
|
||||
#endif /* _NOLIBC_TIME_H */
|
||||
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
|
||||
/*
|
||||
* time function definitions for NOLIBC
|
||||
* Copyright (C) 2017-2022 Willy Tarreau <w@1wt.eu>
|
||||
*/
|
||||
|
||||
#ifndef _NOLIBC_TIME_H
|
||||
#define _NOLIBC_TIME_H
|
||||
|
||||
#include "std.h"
|
||||
#include "arch.h"
|
||||
#include "types.h"
|
||||
#include "sys.h"
|
||||
|
||||
static __attribute__((unused))
|
||||
time_t time(time_t *tptr)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
/* note, cannot fail here */
|
||||
sys_gettimeofday(&tv, NULL);
|
||||
|
||||
if (tptr)
|
||||
*tptr = tv.tv_sec;
|
||||
return tv.tv_sec;
|
||||
}
|
||||
|
||||
/* make sure to include all global symbols */
|
||||
#include "nolibc.h"
|
||||
|
||||
#endif /* _NOLIBC_TIME_H */
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
// SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause)
|
||||
/* Copyright (C) 2018 Netronome Systems, Inc. */
|
||||
|
||||
#ifndef __TOOLS_LIBC_COMPAT_H
|
||||
#define __TOOLS_LIBC_COMPAT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <linux/overflow.h>
|
||||
|
||||
#ifdef COMPAT_NEED_REALLOCARRAY
|
||||
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
|
||||
{
|
||||
size_t bytes;
|
||||
|
||||
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
|
||||
return NULL;
|
||||
return realloc(ptr, bytes);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
// SPDX-License-Identifier: (LGPL-2.0+ OR BSD-2-Clause)
|
||||
/* Copyright (C) 2018 Netronome Systems, Inc. */
|
||||
|
||||
#ifndef __TOOLS_LIBC_COMPAT_H
|
||||
#define __TOOLS_LIBC_COMPAT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <linux/overflow.h>
|
||||
|
||||
#ifdef COMPAT_NEED_REALLOCARRAY
|
||||
static inline void *reallocarray(void *ptr, size_t nmemb, size_t size)
|
||||
{
|
||||
size_t bytes;
|
||||
|
||||
if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
|
||||
return NULL;
|
||||
return realloc(ptr, bytes);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#if defined(__aarch64__)
|
||||
#include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h"
|
||||
#elif defined(__arc__)
|
||||
#include "../../arch/arc/include/uapi/asm/bpf_perf_event.h"
|
||||
#elif defined(__s390__)
|
||||
#include "../../arch/s390/include/uapi/asm/bpf_perf_event.h"
|
||||
#elif defined(__riscv)
|
||||
#include "../../arch/riscv/include/uapi/asm/bpf_perf_event.h"
|
||||
#elif defined(__loongarch__)
|
||||
#include "../../arch/loongarch/include/uapi/asm/bpf_perf_event.h"
|
||||
#else
|
||||
#include <uapi/asm-generic/bpf_perf_event.h>
|
||||
#endif
|
||||
#if defined(__aarch64__)
|
||||
#include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h"
|
||||
#elif defined(__arc__)
|
||||
#include "../../arch/arc/include/uapi/asm/bpf_perf_event.h"
|
||||
#elif defined(__s390__)
|
||||
#include "../../arch/s390/include/uapi/asm/bpf_perf_event.h"
|
||||
#elif defined(__riscv)
|
||||
#include "../../arch/riscv/include/uapi/asm/bpf_perf_event.h"
|
||||
#elif defined(__loongarch__)
|
||||
#include "../../arch/loongarch/include/uapi/asm/bpf_perf_event.h"
|
||||
#else
|
||||
#include <uapi/asm-generic/bpf_perf_event.h>
|
||||
#endif
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include "../../../arch/x86/include/uapi/asm/errno.h"
|
||||
#elif defined(__powerpc__)
|
||||
#include "../../../arch/powerpc/include/uapi/asm/errno.h"
|
||||
#elif defined(__sparc__)
|
||||
#include "../../../arch/sparc/include/uapi/asm/errno.h"
|
||||
#elif defined(__alpha__)
|
||||
#include "../../../arch/alpha/include/uapi/asm/errno.h"
|
||||
#elif defined(__mips__)
|
||||
#include "../../../arch/mips/include/uapi/asm/errno.h"
|
||||
#elif defined(__hppa__)
|
||||
#include "../../../arch/parisc/include/uapi/asm/errno.h"
|
||||
#else
|
||||
#include <asm-generic/errno.h>
|
||||
#endif
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include "../../../arch/x86/include/uapi/asm/errno.h"
|
||||
#elif defined(__powerpc__)
|
||||
#include "../../../arch/powerpc/include/uapi/asm/errno.h"
|
||||
#elif defined(__sparc__)
|
||||
#include "../../../arch/sparc/include/uapi/asm/errno.h"
|
||||
#elif defined(__alpha__)
|
||||
#include "../../../arch/alpha/include/uapi/asm/errno.h"
|
||||
#elif defined(__mips__)
|
||||
#include "../../../arch/mips/include/uapi/asm/errno.h"
|
||||
#elif defined(__hppa__)
|
||||
#include "../../../arch/parisc/include/uapi/asm/errno.h"
|
||||
#else
|
||||
#include <asm-generic/errno.h>
|
||||
#endif
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/* bits.h: Macros for dealing with bitmasks. */
|
||||
|
||||
#ifndef _UAPI_LINUX_BITS_H
|
||||
#define _UAPI_LINUX_BITS_H
|
||||
|
||||
#define __GENMASK(h, l) \
|
||||
(((~_UL(0)) - (_UL(1) << (l)) + 1) & \
|
||||
(~_UL(0) >> (__BITS_PER_LONG - 1 - (h))))
|
||||
|
||||
#define __GENMASK_ULL(h, l) \
|
||||
(((~_ULL(0)) - (_ULL(1) << (l)) + 1) & \
|
||||
(~_ULL(0) >> (__BITS_PER_LONG_LONG - 1 - (h))))
|
||||
|
||||
#define __GENMASK_U128(h, l) \
|
||||
((_BIT128((h)) << 1) - (_BIT128(l)))
|
||||
|
||||
#endif /* _UAPI_LINUX_BITS_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/* bits.h: Macros for dealing with bitmasks. */
|
||||
|
||||
#ifndef _UAPI_LINUX_BITS_H
|
||||
#define _UAPI_LINUX_BITS_H
|
||||
|
||||
#define __GENMASK(h, l) \
|
||||
(((~_UL(0)) - (_UL(1) << (l)) + 1) & \
|
||||
(~_UL(0) >> (__BITS_PER_LONG - 1 - (h))))
|
||||
|
||||
#define __GENMASK_ULL(h, l) \
|
||||
(((~_ULL(0)) - (_ULL(1) << (l)) + 1) & \
|
||||
(~_ULL(0) >> (__BITS_PER_LONG_LONG - 1 - (h))))
|
||||
|
||||
#define __GENMASK_U128(h, l) \
|
||||
((_BIT128((h)) << 1) - (_BIT128(l)))
|
||||
|
||||
#endif /* _UAPI_LINUX_BITS_H */
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/* Copyright (c) 2016 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__
|
||||
#define _UAPI__LINUX_BPF_PERF_EVENT_H__
|
||||
|
||||
#include <asm/bpf_perf_event.h>
|
||||
|
||||
struct bpf_perf_event_data {
|
||||
bpf_user_pt_regs_t regs;
|
||||
__u64 sample_period;
|
||||
__u64 addr;
|
||||
};
|
||||
|
||||
#endif /* _UAPI__LINUX_BPF_PERF_EVENT_H__ */
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
/* Copyright (c) 2016 Facebook
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of version 2 of the GNU General Public
|
||||
* License as published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__
|
||||
#define _UAPI__LINUX_BPF_PERF_EVENT_H__
|
||||
|
||||
#include <asm/bpf_perf_event.h>
|
||||
|
||||
struct bpf_perf_event_data {
|
||||
bpf_user_pt_regs_t regs;
|
||||
__u64 sample_period;
|
||||
__u64 addr;
|
||||
};
|
||||
|
||||
#endif /* _UAPI__LINUX_BPF_PERF_EVENT_H__ */
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _UAPI_LINUX_HW_BREAKPOINT_H
|
||||
#define _UAPI_LINUX_HW_BREAKPOINT_H
|
||||
|
||||
enum {
|
||||
HW_BREAKPOINT_LEN_1 = 1,
|
||||
HW_BREAKPOINT_LEN_2 = 2,
|
||||
HW_BREAKPOINT_LEN_3 = 3,
|
||||
HW_BREAKPOINT_LEN_4 = 4,
|
||||
HW_BREAKPOINT_LEN_5 = 5,
|
||||
HW_BREAKPOINT_LEN_6 = 6,
|
||||
HW_BREAKPOINT_LEN_7 = 7,
|
||||
HW_BREAKPOINT_LEN_8 = 8,
|
||||
};
|
||||
|
||||
enum {
|
||||
HW_BREAKPOINT_EMPTY = 0,
|
||||
HW_BREAKPOINT_R = 1,
|
||||
HW_BREAKPOINT_W = 2,
|
||||
HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W,
|
||||
HW_BREAKPOINT_X = 4,
|
||||
HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
|
||||
};
|
||||
|
||||
#endif /* _UAPI_LINUX_HW_BREAKPOINT_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _UAPI_LINUX_HW_BREAKPOINT_H
|
||||
#define _UAPI_LINUX_HW_BREAKPOINT_H
|
||||
|
||||
enum {
|
||||
HW_BREAKPOINT_LEN_1 = 1,
|
||||
HW_BREAKPOINT_LEN_2 = 2,
|
||||
HW_BREAKPOINT_LEN_3 = 3,
|
||||
HW_BREAKPOINT_LEN_4 = 4,
|
||||
HW_BREAKPOINT_LEN_5 = 5,
|
||||
HW_BREAKPOINT_LEN_6 = 6,
|
||||
HW_BREAKPOINT_LEN_7 = 7,
|
||||
HW_BREAKPOINT_LEN_8 = 8,
|
||||
};
|
||||
|
||||
enum {
|
||||
HW_BREAKPOINT_EMPTY = 0,
|
||||
HW_BREAKPOINT_R = 1,
|
||||
HW_BREAKPOINT_W = 2,
|
||||
HW_BREAKPOINT_RW = HW_BREAKPOINT_R | HW_BREAKPOINT_W,
|
||||
HW_BREAKPOINT_X = 4,
|
||||
HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
|
||||
};
|
||||
|
||||
#endif /* _UAPI_LINUX_HW_BREAKPOINT_H */
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _UAPI_LINUX_KCMP_H
|
||||
#define _UAPI_LINUX_KCMP_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Comparison type */
|
||||
enum kcmp_type {
|
||||
KCMP_FILE,
|
||||
KCMP_VM,
|
||||
KCMP_FILES,
|
||||
KCMP_FS,
|
||||
KCMP_SIGHAND,
|
||||
KCMP_IO,
|
||||
KCMP_SYSVSEM,
|
||||
KCMP_EPOLL_TFD,
|
||||
|
||||
KCMP_TYPES,
|
||||
};
|
||||
|
||||
/* Slot for KCMP_EPOLL_TFD */
|
||||
struct kcmp_epoll_slot {
|
||||
__u32 efd; /* epoll file descriptor */
|
||||
__u32 tfd; /* target file number */
|
||||
__u32 toff; /* target offset within same numbered sequence */
|
||||
};
|
||||
|
||||
#endif /* _UAPI_LINUX_KCMP_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
||||
#ifndef _UAPI_LINUX_KCMP_H
|
||||
#define _UAPI_LINUX_KCMP_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Comparison type */
|
||||
enum kcmp_type {
|
||||
KCMP_FILE,
|
||||
KCMP_VM,
|
||||
KCMP_FILES,
|
||||
KCMP_FS,
|
||||
KCMP_SIGHAND,
|
||||
KCMP_IO,
|
||||
KCMP_SYSVSEM,
|
||||
KCMP_EPOLL_TFD,
|
||||
|
||||
KCMP_TYPES,
|
||||
};
|
||||
|
||||
/* Slot for KCMP_EPOLL_TFD */
|
||||
struct kcmp_epoll_slot {
|
||||
__u32 efd; /* epoll file descriptor */
|
||||
__u32 tfd; /* target file number */
|
||||
__u32 toff; /* target offset within same numbered sequence */
|
||||
};
|
||||
|
||||
#endif /* _UAPI_LINUX_KCMP_H */
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
||||
/*
|
||||
* Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_TC_BPF_H
|
||||
#define __LINUX_TC_BPF_H
|
||||
|
||||
#include <linux/pkt_cls.h>
|
||||
|
||||
struct tc_act_bpf {
|
||||
tc_gen;
|
||||
};
|
||||
|
||||
enum {
|
||||
TCA_ACT_BPF_UNSPEC,
|
||||
TCA_ACT_BPF_TM,
|
||||
TCA_ACT_BPF_PARMS,
|
||||
TCA_ACT_BPF_OPS_LEN,
|
||||
TCA_ACT_BPF_OPS,
|
||||
TCA_ACT_BPF_FD,
|
||||
TCA_ACT_BPF_NAME,
|
||||
TCA_ACT_BPF_PAD,
|
||||
TCA_ACT_BPF_TAG,
|
||||
TCA_ACT_BPF_ID,
|
||||
__TCA_ACT_BPF_MAX,
|
||||
};
|
||||
#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1)
|
||||
|
||||
#endif
|
||||
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
||||
/*
|
||||
* Copyright (c) 2015 Jiri Pirko <jiri@resnulli.us>
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_TC_BPF_H
|
||||
#define __LINUX_TC_BPF_H
|
||||
|
||||
#include <linux/pkt_cls.h>
|
||||
|
||||
struct tc_act_bpf {
|
||||
tc_gen;
|
||||
};
|
||||
|
||||
enum {
|
||||
TCA_ACT_BPF_UNSPEC,
|
||||
TCA_ACT_BPF_TM,
|
||||
TCA_ACT_BPF_PARMS,
|
||||
TCA_ACT_BPF_OPS_LEN,
|
||||
TCA_ACT_BPF_OPS,
|
||||
TCA_ACT_BPF_FD,
|
||||
TCA_ACT_BPF_NAME,
|
||||
TCA_ACT_BPF_PAD,
|
||||
TCA_ACT_BPF_TAG,
|
||||
TCA_ACT_BPF_ID,
|
||||
__TCA_ACT_BPF_MAX,
|
||||
};
|
||||
#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __VDSO_UNALIGNED_H
|
||||
#define __VDSO_UNALIGNED_H
|
||||
|
||||
#define __get_unaligned_t(type, ptr) ({ \
|
||||
const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
|
||||
__pptr->x; \
|
||||
})
|
||||
|
||||
#define __put_unaligned_t(type, val, ptr) do { \
|
||||
struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
|
||||
__pptr->x = (val); \
|
||||
} while (0)
|
||||
|
||||
#endif /* __VDSO_UNALIGNED_H */
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __VDSO_UNALIGNED_H
|
||||
#define __VDSO_UNALIGNED_H
|
||||
|
||||
#define __get_unaligned_t(type, ptr) ({ \
|
||||
const struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
|
||||
__pptr->x; \
|
||||
})
|
||||
|
||||
#define __put_unaligned_t(type, val, ptr) do { \
|
||||
struct { type x; } __packed *__pptr = (typeof(__pptr))(ptr); \
|
||||
__pptr->x = (val); \
|
||||
} while (0)
|
||||
|
||||
#endif /* __VDSO_UNALIGNED_H */
|
||||
|
||||
Reference in New Issue
Block a user