From b8bd90f68fb787cc321365c6de161d6b77c8353f Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 17 Nov 2014 09:01:53 +0100 Subject: Add supplementary groups to user environment --- cpukit/include/rtems/userenv.h | 74 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 65 insertions(+), 9 deletions(-) (limited to 'cpukit/include') diff --git a/cpukit/include/rtems/userenv.h b/cpukit/include/rtems/userenv.h index 631d773ae5..7d6ffb05a5 100644 --- a/cpukit/include/rtems/userenv.h +++ b/cpukit/include/rtems/userenv.h @@ -25,6 +25,7 @@ * limits.h is supposed to provide _POSIX_LOGIN_NAME_MAX * XXX: We do not rely on this. */ +#include #include #include @@ -52,18 +53,64 @@ extern "C" { #endif #endif +/** + * @brief User environment. + */ typedef struct { + /** + * @brief The anchor directory for relative paths. + */ rtems_filesystem_global_location_t *current_directory; + + /** + * @brief The anchor directory for absolute paths. + */ rtems_filesystem_global_location_t *root_directory; - /* Default mode for all files. */ - mode_t umask; - /* _POSIX_types */ - uid_t uid; - gid_t gid; - uid_t euid; - gid_t egid; - char login_buffer[LOGIN_NAME_MAX]; - pid_t pgrp; /* process group id */ + + /** + * @brief The file mode creation mask. + */ + mode_t umask; + + /** + * @brief The real user ID. + */ + uid_t uid; + + /** + * @brief The real group ID. + */ + gid_t gid; + + /** + * @brief The effective user ID. + */ + uid_t euid; + + /** + * @brief The effective group ID. + */ + gid_t egid; + + /** + * @brief The login buffer. + */ + char login_buffer[LOGIN_NAME_MAX]; + + /** + * @brief The process group ID. + */ + pid_t pgrp; + + /** + * @brief The count of supplementary group IDs. + */ + size_t ngroups; + + /** + * @brief The list of supplementary group IDs. + */ + gid_t groups[NGROUPS]; } rtems_user_env_t; extern rtems_user_env_t rtems_global_user_env; @@ -116,6 +163,15 @@ rtems_status_code rtems_libio_set_private_env(void); */ void rtems_libio_use_global_env(void); +/** + * @brief Gets the supplementary group IDs using the current user ID and + * updates the table of supplementary group IDs in the current user + * environment. + * + * In case of an error, the count of supplementary group IDs is set to zero. + */ +void rtems_current_user_env_getgroups(void); + /** @} */ #ifdef __cplusplus -- cgit v1.2.3