diff options
author | Richard Yao <ryao@gentoo.org> | 2012-11-18 15:55:33 -0500 |
---|---|---|
committer | Richard Yao <ryao@cs.stonybrook.edu> | 2012-11-18 16:10:09 -0500 |
commit | 189d09a42e054bebd91ea9690fede33b41996260 (patch) | |
tree | 009ca085c281c228700cc14564f6ffa12f0b8f80 /src | |
parent | 2182f784f06dd0bf7e3b82d91c2f29bde71dfadf (diff) |
Define unshare() macro to avoid dependence on __GNU_SOURCE
unshare() is a linux syscall that we need. Unfortunately, access to it
depends on __GNU_SOURCE, which we would like to avoid. As such, we
define a macro to invoke it by its syscall code. This is necessary to
avoid the following warning from Clang:
implicit declaration of function 'unshare' is invalid in C99
[-Wimplicit-function-declaration]
Signed-off-by: Richard Yao <ryao@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/test/test-udev.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/test-udev.c b/src/test/test-udev.c index 2a25f2d9b0..4f21e6c2dd 100644 --- a/src/test/test-udev.c +++ b/src/test/test-udev.c @@ -34,6 +34,14 @@ #include "udev.h" +#ifndef SYS_unshare +#error "libc fails to set SYS_unshare: please file a bug report with eudev" +#endif + +#ifndef unshare +#define unshare(__X) syscall(SYS_unshare, __X) +#endif + void udev_main_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) {} |