Warning: This file is not a C or C++ file. It does not have highlighting.

1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __ERR_H__
3#define __ERR_H__
4
5#define MAX_ERRNO 4095
6#define IS_ERR_VALUE(x) (unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO
7
8static inline int IS_ERR_OR_NULL(const void *ptr)
9{
10 return !ptr || IS_ERR_VALUE((unsigned long)ptr);
11}
12
13static inline long PTR_ERR(const void *ptr)
14{
15 return (long) ptr;
16}
17
18#endif /* __ERR_H__ */
19

Warning: This file is not a C or C++ file. It does not have highlighting.

source code of linux/tools/testing/selftests/bpf/progs/err.h