capability.h 2.8 KB
Newer Older
R
r00357803 已提交
1
/*
W
wenjun 已提交
2 3
 * ----------------------------------------------------------------------
 * Copyright (c) 2020 Huawei Device Co., Ltd.
R
r00357803 已提交
4
 *
W
wenjun 已提交
5 6 7 8 9 10 11
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
R
r00357803 已提交
12
 *
W
wenjun 已提交
13 14
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
R
r00357803 已提交
15
 *
W
wenjun 已提交
16 17 18 19 20 21 22 23
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 * ----------------------------------------------------------------------
R
r00357803 已提交
24 25
 */

C
c00346986 已提交
26 27 28 29 30 31 32 33 34
#ifndef _SYS_CAPABILITY_H
#define _SYS_CAPABILITY_H

#ifdef __cplusplus
extern "C" {
#endif

#include <linux/capability.h>

R
r00357803 已提交
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
// posix capabilities
#define OHOS_CAP_CHOWN                       0
#define OHOS_CAP_DAC_EXECUTE                 1
#define OHOS_CAP_DAC_WRITE                   2
#define OHOS_CAP_DAC_READ_SEARCH             3
#define OHOS_CAP_FOWNER                      4
#define OHOS_CAP_KILL                        5
#define OHOS_CAP_SETGID                      6
#define OHOS_CAP_SETUID                      7

// socket capabilities
#define OHOS_CAP_NET_BIND_SERVICE            8
#define OHOS_CAP_NET_BROADCAST               9
#define OHOS_CAP_NET_ADMIN                   10
#define OHOS_CAP_NET_RAW                     11

// fs capabilities
#define OHOS_CAP_FS_MOUNT                    12
#define OHOS_CAP_FS_FORMAT                   13

// process capabilities
#define OHOS_CAP_SCHED_SETPRIORITY           14

// time capabilities
#define OHOS_CAP_SET_TIMEOFDAY               15
#define OHOS_CAP_CLOCK_SETTIME               16

// process capabilities
#define OHOS_CAP_CAPSET                      17

// reboot capability
#define OHOS_CAP_REBOOT                      18
// self deined privileged syscalls
#define OHOS_CAP_SHELL_EXEC                  19

C
c00346986 已提交
70 71
int capget(cap_user_header_t hdr_ptr, cap_user_data_t data_ptr);
int capset(cap_user_header_t hdr_ptr, const cap_user_data_t data_ptr);
R
r00357803 已提交
72 73
int ohos_capget(unsigned int *caps);
int ohos_capset(unsigned int caps);
C
c00346986 已提交
74 75 76 77 78 79

#ifdef __cplusplus
}
#endif

#endif /* _SYS_CAPABILITY_H */