Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
7d40e69b
Commit
7d40e69b
authored
Jul 20, 2010
by
Daniel Lezcano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a macro to wrap a privilegied function
This macro is a helper to call a function into a [un]privilegied section. Signed-off-by:
Daniel Lezcano
<
dlezcano@fr.ibm.com
>
parent
b3357a6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
3 deletions
+30
-3
caps.h
src/lxc/caps.h
+30
-3
No files found.
src/lxc/caps.h
View file @
7d40e69b
...
...
@@ -22,7 +22,34 @@
*/
#ifndef _caps_h
#define _caps_h
int
lxc_caps_down
(
void
);
int
lxc_caps_up
(
void
);
int
lxc_caps_init
(
void
);
extern
int
lxc_caps_down
(
void
);
extern
int
lxc_caps_up
(
void
);
extern
int
lxc_caps_init
(
void
);
#define lxc_priv(__lxc_function) \
({ \
int __ret, __ret2, __errno = 0; \
__ret = lxc_caps_up(); \
if (__ret) \
goto __out; \
__ret = __lxc_function; \
if (__ret) \
__errno = errno; \
__ret2 = lxc_caps_down(); \
__out: __ret ? errno = __errno,__ret : __ret2; \
})
#define lxc_unpriv(__lxc_function) \
({ \
int __ret, __ret2, __errno = 0; \
__ret = lxc_caps_down(); \
if (__ret) \
goto __out; \
__ret = __lxc_function; \
if (__ret) \
__errno = errno; \
__ret2 = lxc_caps_up(); \
__out: __ret ? errno = __errno,__ret : __ret2; \
})
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment