Re: [PATCH v1 1/2] syscalls: Add capset and capget

Maximilian Attems
2011-07-29T20:45:05Z

On Tue, 19 Jul 2011, Mike Waychison wrote:

> Add the capset and capget system calls to klibc so that userland can
> invoke them.
>
> Signed-off-by: Mike Waychison <mikew@google.com>
> ---
> usr/include/sys/capability.h | 10 ++++++++++
> usr/klibc/SYSCALLS.def | 6 ++++++
> usr/klibc/syscalls/syscommon.h | 1 +
> 3 files changed, 17 insertions(+), 0 deletions(-)
> create mode 100644 usr/include/sys/capability.h
>
> diff --git a/usr/include/sys/capability.h b/usr/include/sys/capability.h
> new file mode 100644
> index 0000000..84ad419
> --- /dev/null
> +++ b/usr/include/sys/capability.h
> @@ -0,0 +1,10 @@
> +#ifndef _SYS_CAPABILITY_H
> +#define _SYS_CAPABILITY_H
> +
> +#include <klibc/extern.h>
> +#include <linux/capability.h>
> +
> +__extern int capget(cap_user_header_t hdrp, cap_user_data_t datap);
> +__extern int capset(cap_user_header_t hdrp, const cap_user_data_t datap);
> +
> +#endif /* _SYS_CAPABILITY_H */
> diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def
> index d3279c7..ee3ffa9 100644
> --- a/usr/klibc/SYSCALLS.def
> +++ b/usr/klibc/SYSCALLS.def
> @@ -77,6 +77,12 @@ int setfsgid32,setfsgid::setfsgid(gid_t);
> int setresuid32,setresuid::setresuid(int, uid_t, uid_t, uid_t);
>
> /*
> + * POSIX Capabilities
> + */
> +int capget(cap_user_header_t, cap_user_data_t);
> +int capset(cap_user_header_t, cap_user_data_t);
> +
> +/*
> * Filesystem-related system calls
> */
> int mount(const char *, const char *, const char *, unsigned long, const void *);
> diff --git a/usr/klibc/syscalls/syscommon.h b/usr/klibc/syscalls/syscommon.h
> index 0acae12..78f8858 100644
> --- a/usr/klibc/syscalls/syscommon.h
> +++ b/usr/klibc/syscalls/syscommon.h
> @@ -12,6 +12,7 @@
>
> #include <poll.h>
> #include <sched.h>
> +#include <sys/capability.h>
> #include <sys/dirent.h>
> #include <sys/klog.h>
> #include <sys/mman.h>

this looks good to me.
thanks will add to klibc repo soonest.

--
maks