Warning: That file was not part of the compilation database. It may have many parsing errors.

1/*
2 * <sys/capability.h>
3 *
4 * Copyright (C) 1997 Aleph One
5 * Copyright (C) 1997-8,2008 Andrew G. Morgan <morgan@kernel.org>
6 *
7 * defunct POSIX.1e Standard: 25.2 Capabilities <sys/capability.h>
8 */
9
10#ifndef _SYS_CAPABILITY_H
11#define _SYS_CAPABILITY_H
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/*
18 * This file complements the kernel file by providing prototype
19 * information for the user library.
20 */
21
22#include <sys/types.h>
23#include <stdint.h>
24#include <linux/types.h>
25
26#ifndef __user
27#define __user
28#endif
29#include <linux/capability.h>
30
31/*
32 * POSIX capability types
33 */
34
35/*
36 * Opaque capability handle (defined internally by libcap)
37 * internal capability representation
38 */
39typedef struct _cap_struct *cap_t;
40
41/* "external" capability representation is a (void *) */
42
43/*
44 * This is the type used to identify capabilities
45 */
46
47typedef int cap_value_t;
48
49/*
50 * Set identifiers
51 */
52typedef enum {
53 CAP_EFFECTIVE=0, /* Specifies the effective flag */
54 CAP_PERMITTED=1, /* Specifies the permitted flag */
55 CAP_INHERITABLE=2 /* Specifies the inheritable flag */
56} cap_flag_t;
57
58/*
59 * These are the states available to each capability
60 */
61typedef enum {
62 CAP_CLEAR=0, /* The flag is cleared/disabled */
63 CAP_SET=1 /* The flag is set/enabled */
64} cap_flag_value_t;
65
66/*
67 * User-space capability manipulation routines
68 */
69
70/* libcap/cap_alloc.c */
71extern cap_t cap_dup(cap_t);
72extern int cap_free(void *);
73extern cap_t cap_init(void);
74
75/* libcap/cap_flag.c */
76extern int cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *);
77extern int cap_set_flag(cap_t, cap_flag_t, int, const cap_value_t *,
78 cap_flag_value_t);
79extern int cap_clear(cap_t);
80extern int cap_clear_flag(cap_t, cap_flag_t);
81
82/* libcap/cap_file.c */
83extern cap_t cap_get_fd(int);
84extern cap_t cap_get_file(const char *);
85extern uid_t cap_get_nsowner(cap_t);
86extern int cap_set_fd(int, cap_t);
87extern int cap_set_file(const char *, cap_t);
88extern int cap_set_nsowner(cap_t, uid_t);
89
90/* libcap/cap_proc.c */
91extern cap_t cap_get_proc(void);
92extern cap_t cap_get_pid(pid_t);
93extern int cap_set_proc(cap_t);
94
95extern int cap_get_bound(cap_value_t);
96extern int cap_drop_bound(cap_value_t);
97#define CAP_IS_SUPPORTED(cap) (cap_get_bound(cap) >= 0)
98
99extern int cap_get_ambient(cap_value_t);
100extern int cap_set_ambient(cap_value_t, cap_flag_value_t);
101extern int cap_reset_ambient(void);
102#define CAP_AMBIENT_SUPPORTED() (cap_get_ambient(CAP_CHOWN) >= 0)
103
104/* libcap/cap_extint.c */
105extern ssize_t cap_size(cap_t);
106extern ssize_t cap_copy_ext(void *, cap_t, ssize_t);
107extern cap_t cap_copy_int(const void *);
108
109/* libcap/cap_text.c */
110extern cap_t cap_from_text(const char *);
111extern char * cap_to_text(cap_t, ssize_t *);
112extern int cap_from_name(const char *, cap_value_t *);
113extern char * cap_to_name(cap_value_t);
114
115#define CAP_DIFFERS(result, flag) (((result) & (1 << (flag))) != 0)
116extern int cap_compare(cap_t, cap_t);
117
118/* system calls - look to libc for function to system call mapping */
119extern int capset(cap_user_header_t header, cap_user_data_t data);
120extern int capget(cap_user_header_t header, const cap_user_data_t data);
121
122/* deprecated - use cap_get_pid() */
123extern int capgetp(pid_t pid, cap_t cap_d);
124
125/* not valid with filesystem capability support - use cap_set_proc() */
126extern int capsetp(pid_t pid, cap_t cap_d);
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif /* _SYS_CAPABILITY_H */
133

Warning: That file was not part of the compilation database. It may have many parsing errors.