OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_CAPABILITY_H_ |
| 6 #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_CAPABILITY_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 // The following macros are taken from linux/capability.h. |
| 11 // We only support capability version 3, which was introduced in Linux 2.6.26. |
| 12 #ifndef _LINUX_CAPABILITY_VERSION_3 |
| 13 #define _LINUX_CAPABILITY_VERSION_3 0x20080522 |
| 14 #endif |
| 15 #ifndef _LINUX_CAPABILITY_U32S_3 |
| 16 #define _LINUX_CAPABILITY_U32S_3 2 |
| 17 #endif |
| 18 #ifndef CAP_TO_INDEX |
| 19 #define CAP_TO_INDEX(x) ((x) >> 5) // 1 << 5 == bits in __u32 |
| 20 #endif |
| 21 #ifndef CAP_TO_MASK |
| 22 #define CAP_TO_MASK(x) (1 << ((x) & 31)) // mask for indexed __u32 |
| 23 #endif |
| 24 #ifndef CAP_SYS_CHROOT |
| 25 #define CAP_SYS_CHROOT 18 |
| 26 #endif |
| 27 #ifndef CAP_SYS_ADMIN |
| 28 #define CAP_SYS_ADMIN 21 |
| 29 #endif |
| 30 |
| 31 struct cap_hdr { |
| 32 uint32_t version; |
| 33 int pid; |
| 34 }; |
| 35 |
| 36 struct cap_data { |
| 37 uint32_t effective; |
| 38 uint32_t permitted; |
| 39 uint32_t inheritable; |
| 40 }; |
| 41 |
| 42 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_CAPABILITY_H_ |
OLD | NEW |