mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-20 00:09:06 +08:00
Otherwise, we will have the following compilation error:
/home/yhs/work/bcc-new/src/cc/libbpf/src/bpf_prog_linfo.c:
In function ‘dissect_jited_func’:
/home/yhs/work/bcc-new/src/cc/libbpf/src/bpf_prog_linfo.c:88:10:
error: ‘EINVAL’ undeclared (first use in this function)
return -EINVAL;
The original linux/err.h at linux:tools/include directory
does include "asm/errno.h" as well.
Signed-off-by: Yonghong Song <yhs@fb.com>
34 lines
589 B
C
34 lines
589 B
C
/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
|
|
|
|
#ifndef __LINUX_ERR_H
|
|
#define __LINUX_ERR_H
|
|
|
|
#include <linux/types.h>
|
|
#include <asm/errno.h>
|
|
|
|
#define MAX_ERRNO 4095
|
|
|
|
#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
|
|
|
|
static inline void * ERR_PTR(long error_)
|
|
{
|
|
return (void *) error_;
|
|
}
|
|
|
|
static inline long PTR_ERR(const void *ptr)
|
|
{
|
|
return (long) ptr;
|
|
}
|
|
|
|
static inline bool IS_ERR(const void *ptr)
|
|
{
|
|
return IS_ERR_VALUE((unsigned long)ptr);
|
|
}
|
|
|
|
static inline bool IS_ERR_OR_NULL(const void *ptr)
|
|
{
|
|
return (!ptr) || IS_ERR_VALUE((unsigned long)ptr);
|
|
}
|
|
|
|
#endif
|