]>
Commit | Line | Data |
---|---|---|
3892d516 DB |
1 | #ifndef PRIVILEGE_H |
2 | #define PRIVILEGE_H | |
3 | ||
4 | typedef enum privilege_t { | |
5 | // NOTE: | |
6 | // - Values must be a power of 2 between 0x1 and 0x80000000 inclusive, since they will be used | |
7 | // to form a bit set. | |
8 | // - These values cannot change in the future because they will be encoded into the generated | |
9 | // modules in order to identify their required privilege level now and in the future. | |
10 | pr_none = 0x00000000, // No privileges | |
11 | pr_unknown = 0x00000001, // Unknown privileges | |
12 | pr_stapusr = 0x00000002, // Member of stapusr | |
13 | pr_stapsys = 0x00000004, // Member of stapsys | |
14 | pr_stapdev = 0x00000008, // Member of stapdev | |
bb4470ca | 15 | |
3892d516 | 16 | // Predefined sets |
8bb4f643 | 17 | pr_highest = pr_stapdev, |
73f52eb4 DB |
18 | pr_unprivileged = pr_stapusr, |
19 | pr_privileged = pr_stapsys | pr_stapdev, | |
3892d516 DB |
20 | pr_all = pr_stapusr | pr_stapsys | pr_stapdev |
21 | } privilege_t; | |
22 | ||
73f52eb4 | 23 | // Name of the section in the module used to store privilege information. |
bb4470ca DB |
24 | #define STAP_PRIVILEGE_SECTION ".stap_privilege" |
25 | ||
3892d516 | 26 | // Privilege management. |
3892d516 DB |
27 | #if defined(c_plusplus) || defined(__cplusplus) |
28 | extern "C" { | |
29 | #endif | |
bb4470ca DB |
30 | const char *pr_name (privilege_t p); |
31 | int pr_contains (privilege_t actual, privilege_t required); | |
3892d516 DB |
32 | privilege_t get_privilege_credentials (void); |
33 | #if defined(c_plusplus) || defined(__cplusplus) | |
34 | } | |
35 | #endif | |
36 | ||
37 | #endif // PRIVILEGE_H |