modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/grp.h (about) 1 /* Copyright (C) 1991-2016 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 /* 19 * POSIX Standard: 9.2.1 Group Database Access <grp.h> 20 */ 21 22 #ifndef _GRP_H 23 #define _GRP_H 1 24 25 #include <features.h> 26 27 __BEGIN_DECLS 28 #include <bits/types.h> 29 #define __need_size_t 30 #include <stddef.h> 31 /* For the Single Unix specification we must define this type here. */ 32 #if (defined __USE_XOPEN || defined __USE_XOPEN2K) && !defined __gid_t_defined 33 typedef __gid_t gid_t; 34 #define __gid_t_defined 35 #endif 36 37 /* The group structure. */ 38 struct group { 39 char *gr_name; /* Group name. */ 40 char *gr_passwd; /* Password. */ 41 __gid_t gr_gid; /* Group ID. */ 42 char **gr_mem; /* Member list. */ 43 }; 44 45 #ifdef __USE_MISC 46 #define __need_FILE 47 #include <stdio.h> 48 #endif 49 50 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 51 /* Rewind the group-file stream. 52 53 This function is a possible cancellation point and therefore not 54 marked with __THROW. */ 55 extern void setgrent(void); 56 57 /* Close the group-file stream. 58 59 This function is a possible cancellation point and therefore not 60 marked with __THROW. */ 61 extern void endgrent(void); 62 63 /* Read an entry from the group-file stream, opening it if necessary. 64 65 This function is a possible cancellation point and therefore not 66 marked with __THROW. */ 67 extern struct group *getgrent(void); 68 #endif 69 70 #ifdef __USE_MISC 71 /* Read a group entry from STREAM. 72 73 This function is not part of POSIX and therefore no official 74 cancellation point. But due to similarity with an POSIX interface 75 or due to the implementation it is a cancellation point and 76 therefore not marked with __THROW. */ 77 extern struct group *fgetgrent(FILE * __stream); 78 #endif 79 80 #ifdef __USE_GNU 81 /* Write the given entry onto the given stream. 82 83 This function is not part of POSIX and therefore no official 84 cancellation point. But due to similarity with an POSIX interface 85 or due to the implementation it is a cancellation point and 86 therefore not marked with __THROW. */ 87 extern int putgrent(const struct group *__restrict __p, FILE * __restrict __f); 88 #endif 89 90 /* Search for an entry with a matching group ID. 91 92 This function is a possible cancellation point and therefore not 93 marked with __THROW. */ 94 extern struct group *getgrgid(__gid_t __gid); 95 96 /* Search for an entry with a matching group name. 97 98 This function is a possible cancellation point and therefore not 99 marked with __THROW. */ 100 extern struct group *getgrnam(const char *__name); 101 102 #ifdef __USE_POSIX 103 104 #ifdef __USE_MISC 105 /* Reasonable value for the buffer sized used in the reentrant 106 functions below. But better use `sysconf'. */ 107 #define NSS_BUFLEN_GROUP 1024 108 #endif 109 110 /* Reentrant versions of some of the functions above. 111 112 PLEASE NOTE: the `getgrent_r' function is not (yet) standardized. 113 The interface may change in later versions of this library. But 114 the interface is designed following the principals used for the 115 other reentrant functions so the chances are good this is what the 116 POSIX people would choose. 117 118 This function is not part of POSIX and therefore no official 119 cancellation point. But due to similarity with an POSIX interface 120 or due to the implementation it is a cancellation point and 121 therefore not marked with __THROW. */ 122 123 #ifdef __USE_GNU 124 extern int getgrent_r(struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); 125 #endif 126 127 /* Search for an entry with a matching group ID. 128 129 This function is a possible cancellation point and therefore not 130 marked with __THROW. */ 131 extern int getgrgid_r(__gid_t __gid, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); 132 133 /* Search for an entry with a matching group name. 134 135 This function is a possible cancellation point and therefore not 136 marked with __THROW. */ 137 extern int getgrnam_r(const char *__restrict __name, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); 138 139 #ifdef __USE_MISC 140 /* Read a group entry from STREAM. This function is not standardized 141 an probably never will. 142 143 This function is not part of POSIX and therefore no official 144 cancellation point. But due to similarity with an POSIX interface 145 or due to the implementation it is a cancellation point and 146 therefore not marked with __THROW. */ 147 extern int fgetgrent_r(FILE * __restrict __stream, struct group *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct group **__restrict __result); 148 #endif 149 150 #endif /* POSIX or reentrant */ 151 152 #ifdef __USE_MISC 153 154 #define __need_size_t 155 #include <stddef.h> 156 157 /* Set the group set for the current user to GROUPS (N of them). */ 158 extern int setgroups(size_t __n, const __gid_t * __groups) __THROW; 159 160 /* Store at most *NGROUPS members of the group set for USER into 161 *GROUPS. Also include GROUP. The actual number of groups found is 162 returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. 163 164 This function is not part of POSIX and therefore no official 165 cancellation point. But due to similarity with an POSIX interface 166 or due to the implementation it is a cancellation point and 167 therefore not marked with __THROW. */ 168 extern int getgrouplist(const char *__user, __gid_t __group, __gid_t * __groups, int *__ngroups); 169 170 /* Initialize the group set for the current user 171 by reading the group database and using all groups 172 of which USER is a member. Also include GROUP. 173 174 This function is not part of POSIX and therefore no official 175 cancellation point. But due to similarity with an POSIX interface 176 or due to the implementation it is a cancellation point and 177 therefore not marked with __THROW. */ 178 extern int initgroups(const char *__user, __gid_t __group); 179 180 #endif /* Use misc. */ 181 182 __END_DECLS 183 #endif /* grp.h */