diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-11-17 09:01:53 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-11-20 10:30:23 +0100 |
commit | b8bd90f68fb787cc321365c6de161d6b77c8353f (patch) | |
tree | cd78640ad422bebb2fe5c9a5dcf92f4f00646fa3 /cpukit/libcsupport/src/uenvgetgroups.c | |
parent | samples/fileio: Use unlimited objects (diff) | |
download | rtems-b8bd90f68fb787cc321365c6de161d6b77c8353f.tar.bz2 |
Add supplementary groups to user environment
Diffstat (limited to '')
-rw-r--r-- | cpukit/libcsupport/src/uenvgetgroups.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/uenvgetgroups.c b/cpukit/libcsupport/src/uenvgetgroups.c new file mode 100644 index 0000000000..9645a9618b --- /dev/null +++ b/cpukit/libcsupport/src/uenvgetgroups.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Dornierstr. 4 + * D-82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/userenv.h> +#include <rtems.h> + +#include <sys/types.h> +#include <unistd.h> + +void rtems_current_user_env_getgroups(void) +{ + rtems_user_env_t *uenv = rtems_current_user_env_get(); + int ngroups = (int) RTEMS_ARRAY_SIZE( uenv->groups ); + + ngroups = getgroups( ngroups, &uenv->groups[ 0 ] ); + if ( ngroups > 0 ) { + uenv->ngroups = (size_t) ngroups; + } else { + uenv->ngroups = 0; + } +} |