capability.h 989 字节
Newer Older
M
m00302376 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (c) 2019 Richard Palethorpe <rpalethorpe@suse.com>
 */

#ifndef LAPI_CAPABILITY_H
#define LAPI_CAPABILITY_H

#include "config.h"

#ifdef HAVE_SYS_CAPABILITY_H
# include <sys/capability.h>
/**
 * Some old libcap-devel(1.96~2.16) define _LINUX_TYPES_H in
 * sys/capability.h that makes ltp-lib cann't include linux/types.h
 * essentially. Here undefine it if include such old header-file.
 */
# ifndef HAVE_NEWER_LIBCAP
#  undef _LINUX_TYPES_H
# endif
#endif

#ifndef CAP_NET_RAW
# define CAP_NET_RAW          13
#endif

#ifndef CAP_SYS_ADMIN
# define CAP_SYS_ADMIN        21
#endif

#ifndef CAP_SYS_TIME
# define CAP_SYS_TIME         25
#endif

#ifndef CAP_AUDIT_READ
# define CAP_AUDIT_READ       37
#endif

#ifndef CAP_SYS_RESOURCE
# define CAP_SYS_RESOURCE     24
#endif

#ifndef CAP_TO_INDEX
# define CAP_TO_INDEX(x)     ((x) >> 5)
#endif

#ifndef CAP_TO_MASK
# define CAP_TO_MASK(x)      (1 << ((x) & 31))
#endif

#endif