blob: a49059e5b47bca897691624947d0ecc25a135c83 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_LINUX_CAPABILITY_H
8#define _UAPI_LINUX_CAPABILITY_H
9#include <linux/types.h>
Ben Cheng655a7c02013-10-16 16:09:24 -070010#define _LINUX_CAPABILITY_VERSION_1 0x19980330
11#define _LINUX_CAPABILITY_U32S_1 1
12#define _LINUX_CAPABILITY_VERSION_2 0x20071026
13#define _LINUX_CAPABILITY_U32S_2 2
Ben Cheng655a7c02013-10-16 16:09:24 -070014#define _LINUX_CAPABILITY_VERSION_3 0x20080522
15#define _LINUX_CAPABILITY_U32S_3 2
16typedef struct __user_cap_header_struct {
Tao Baod7db5942015-01-28 10:07:51 -080017 __u32 version;
Tao Baod7db5942015-01-28 10:07:51 -080018 int pid;
Elliott Hughes0f0c18f2023-03-29 15:53:31 -070019} * cap_user_header_t;
Christopher Ferris8666d042023-09-06 14:55:31 -070020struct __user_cap_data_struct {
Tao Baod7db5942015-01-28 10:07:51 -080021 __u32 effective;
Tao Baod7db5942015-01-28 10:07:51 -080022 __u32 permitted;
23 __u32 inheritable;
Christopher Ferris8666d042023-09-06 14:55:31 -070024};
25typedef struct __user_cap_data_struct * cap_user_data_t;
Ben Cheng655a7c02013-10-16 16:09:24 -070026#define VFS_CAP_REVISION_MASK 0xFF000000
Ben Cheng655a7c02013-10-16 16:09:24 -070027#define VFS_CAP_REVISION_SHIFT 24
28#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
29#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
30#define VFS_CAP_REVISION_1 0x01000000
Ben Cheng655a7c02013-10-16 16:09:24 -070031#define VFS_CAP_U32_1 1
Tao Baod7db5942015-01-28 10:07:51 -080032#define XATTR_CAPS_SZ_1 (sizeof(__le32) * (1 + 2 * VFS_CAP_U32_1))
Ben Cheng655a7c02013-10-16 16:09:24 -070033#define VFS_CAP_REVISION_2 0x02000000
34#define VFS_CAP_U32_2 2
Tao Baod7db5942015-01-28 10:07:51 -080035#define XATTR_CAPS_SZ_2 (sizeof(__le32) * (1 + 2 * VFS_CAP_U32_2))
Christopher Ferris1308ad32017-11-14 17:32:13 -080036#define VFS_CAP_REVISION_3 0x03000000
37#define VFS_CAP_U32_3 2
38#define XATTR_CAPS_SZ_3 (sizeof(__le32) * (2 + 2 * VFS_CAP_U32_3))
39#define XATTR_CAPS_SZ XATTR_CAPS_SZ_3
40#define VFS_CAP_U32 VFS_CAP_U32_3
41#define VFS_CAP_REVISION VFS_CAP_REVISION_3
Ben Cheng655a7c02013-10-16 16:09:24 -070042struct vfs_cap_data {
Tao Baod7db5942015-01-28 10:07:51 -080043 __le32 magic_etc;
44 struct {
45 __le32 permitted;
Tao Baod7db5942015-01-28 10:07:51 -080046 __le32 inheritable;
47 } data[VFS_CAP_U32];
Ben Cheng655a7c02013-10-16 16:09:24 -070048};
Christopher Ferris1308ad32017-11-14 17:32:13 -080049struct vfs_ns_cap_data {
50 __le32 magic_etc;
51 struct {
52 __le32 permitted;
53 __le32 inheritable;
54 } data[VFS_CAP_U32];
55 __le32 rootid;
56};
Ben Cheng655a7c02013-10-16 16:09:24 -070057#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
Ben Cheng655a7c02013-10-16 16:09:24 -070058#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
59#define CAP_CHOWN 0
60#define CAP_DAC_OVERRIDE 1
61#define CAP_DAC_READ_SEARCH 2
Ben Cheng655a7c02013-10-16 16:09:24 -070062#define CAP_FOWNER 3
63#define CAP_FSETID 4
64#define CAP_KILL 5
65#define CAP_SETGID 6
Ben Cheng655a7c02013-10-16 16:09:24 -070066#define CAP_SETUID 7
67#define CAP_SETPCAP 8
68#define CAP_LINUX_IMMUTABLE 9
69#define CAP_NET_BIND_SERVICE 10
Ben Cheng655a7c02013-10-16 16:09:24 -070070#define CAP_NET_BROADCAST 11
71#define CAP_NET_ADMIN 12
72#define CAP_NET_RAW 13
73#define CAP_IPC_LOCK 14
Ben Cheng655a7c02013-10-16 16:09:24 -070074#define CAP_IPC_OWNER 15
75#define CAP_SYS_MODULE 16
76#define CAP_SYS_RAWIO 17
77#define CAP_SYS_CHROOT 18
Ben Cheng655a7c02013-10-16 16:09:24 -070078#define CAP_SYS_PTRACE 19
79#define CAP_SYS_PACCT 20
80#define CAP_SYS_ADMIN 21
81#define CAP_SYS_BOOT 22
Ben Cheng655a7c02013-10-16 16:09:24 -070082#define CAP_SYS_NICE 23
83#define CAP_SYS_RESOURCE 24
84#define CAP_SYS_TIME 25
85#define CAP_SYS_TTY_CONFIG 26
Ben Cheng655a7c02013-10-16 16:09:24 -070086#define CAP_MKNOD 27
87#define CAP_LEASE 28
88#define CAP_AUDIT_WRITE 29
89#define CAP_AUDIT_CONTROL 30
Ben Cheng655a7c02013-10-16 16:09:24 -070090#define CAP_SETFCAP 31
91#define CAP_MAC_OVERRIDE 32
92#define CAP_MAC_ADMIN 33
93#define CAP_SYSLOG 34
Ben Cheng655a7c02013-10-16 16:09:24 -070094#define CAP_WAKE_ALARM 35
95#define CAP_BLOCK_SUSPEND 36
Christopher Ferrisba8d4f42014-09-03 19:56:49 -070096#define CAP_AUDIT_READ 37
Christopher Ferris8177cdf2020-08-03 11:53:55 -070097#define CAP_PERFMON 38
98#define CAP_BPF 39
Christopher Ferris25c18d42020-10-14 17:42:58 -070099#define CAP_CHECKPOINT_RESTORE 40
100#define CAP_LAST_CAP CAP_CHECKPOINT_RESTORE
Christopher Ferrisba8d4f42014-09-03 19:56:49 -0700101#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
Ben Cheng655a7c02013-10-16 16:09:24 -0700102#define CAP_TO_INDEX(x) ((x) >> 5)
Christopher Ferris6cd53a52022-12-12 23:39:16 +0000103#define CAP_TO_MASK(x) (1U << ((x) & 31))
Ben Cheng655a7c02013-10-16 16:09:24 -0700104#endif