• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef BASE_STARTUP_APPSPAWN_ADAPTER_H
17 #define BASE_STARTUP_APPSPAWN_ADAPTER_H
18 #ifdef __LINUX__
19 #include <linux/capability.h>
20 #else
21 #include <sys/capability.h>
22 #endif
23 
24 #ifdef __cplusplus
25 #if __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28 #endif /* __cplusplus */
29 
30 #ifdef __LINUX__
31 /* Control the ambient capability set */
32 #ifndef PR_CAP_AMBIENT
33 #define PR_CAP_AMBIENT          47
34 #endif
35 #ifndef PR_CAP_AMBIENT_IS_SET
36 #define PR_CAP_AMBIENT_IS_SET      1
37 #endif
38 #ifndef PR_CAP_AMBIENT_RAISE
39 #define PR_CAP_AMBIENT_RAISE       2
40 #endif
41 #ifndef PR_CAP_AMBIENT_LOWER
42 #define PR_CAP_AMBIENT_LOWER       3
43 #endif
44 #ifndef PR_CAP_AMBIENT_CLEAR_ALL
45 #define PR_CAP_AMBIENT_CLEAR_ALL   4
46 #endif
47 extern int capset(void *a, void *b);
48 #endif
49 
50 int KeepCapability();
51 int SetAmbientCapability(int cap);
52 
53 #ifdef __cplusplus
54 #if __cplusplus
55 }
56 #endif
57 #endif
58 
59 #endif  // BASE_STARTUP_APPSPAWN_ADAPTER_H
60