modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/pwd.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.2 User Database Access <pwd.h> 20 */ 21 22 #ifndef _PWD_H 23 #define _PWD_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 #if defined __USE_XOPEN || defined __USE_XOPEN2K 32 /* The Single Unix specification says that some more types are 33 available here. */ 34 #ifndef __gid_t_defined 35 typedef __gid_t gid_t; 36 #define __gid_t_defined 37 #endif 38 39 #ifndef __uid_t_defined 40 typedef __uid_t uid_t; 41 #define __uid_t_defined 42 #endif 43 #endif 44 45 /* The passwd structure. */ 46 struct passwd { 47 char *pw_name; /* Username. */ 48 char *pw_passwd; /* Password. */ 49 __uid_t pw_uid; /* User ID. */ 50 __gid_t pw_gid; /* Group ID. */ 51 char *pw_gecos; /* Real name. */ 52 char *pw_dir; /* Home directory. */ 53 char *pw_shell; /* Shell program. */ 54 }; 55 56 #ifdef __USE_MISC 57 #define __need_FILE 58 #include <stdio.h> 59 #endif 60 61 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 62 /* Rewind the password-file stream. 63 64 This function is a possible cancellation point and therefore not 65 marked with __THROW. */ 66 extern void setpwent(void); 67 68 /* Close the password-file stream. 69 70 This function is a possible cancellation point and therefore not 71 marked with __THROW. */ 72 extern void endpwent(void); 73 74 /* Read an entry from the password-file stream, opening it if necessary. 75 76 This function is a possible cancellation point and therefore not 77 marked with __THROW. */ 78 extern struct passwd *getpwent(void); 79 #endif 80 81 #ifdef __USE_MISC 82 /* Read an entry from STREAM. 83 84 This function is not part of POSIX and therefore no official 85 cancellation point. But due to similarity with an POSIX interface 86 or due to the implementation it is a cancellation point and 87 therefore not marked with __THROW. */ 88 extern struct passwd *fgetpwent(FILE * __stream) __nonnull((1)); 89 90 /* Write the given entry onto the given stream. 91 92 This function is not part of POSIX and therefore no official 93 cancellation point. But due to similarity with an POSIX interface 94 or due to the implementation it is a cancellation point and 95 therefore not marked with __THROW. */ 96 extern int putpwent(const struct passwd *__restrict __p, FILE * __restrict __f); 97 #endif 98 99 /* Search for an entry with a matching user ID. 100 101 This function is a possible cancellation point and therefore not 102 marked with __THROW. */ 103 extern struct passwd *getpwuid(__uid_t __uid); 104 105 /* Search for an entry with a matching username. 106 107 This function is a possible cancellation point and therefore not 108 marked with __THROW. */ 109 extern struct passwd *getpwnam(const char *__name) __nonnull((1)); 110 111 #ifdef __USE_POSIX 112 113 #ifdef __USE_MISC 114 /* Reasonable value for the buffer sized used in the reentrant 115 functions below. But better use `sysconf'. */ 116 #define NSS_BUFLEN_PASSWD 1024 117 #endif 118 119 /* Reentrant versions of some of the functions above. 120 121 PLEASE NOTE: the `getpwent_r' function is not (yet) standardized. 122 The interface may change in later versions of this library. But 123 the interface is designed following the principals used for the 124 other reentrant functions so the chances are good this is what the 125 POSIX people would choose. */ 126 127 #ifdef __USE_MISC 128 /* This function is not part of POSIX and therefore no official 129 cancellation point. But due to similarity with an POSIX interface 130 or due to the implementation it is a cancellation point and 131 therefore not marked with __THROW. */ 132 extern int getpwent_r(struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) __nonnull((1, 2, 4)); 133 #endif 134 135 extern int getpwuid_r(__uid_t __uid, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) __nonnull((2, 3, 5)); 136 137 extern int getpwnam_r(const char *__restrict __name, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) __nonnull((1, 2, 3, 5)); 138 139 #ifdef __USE_MISC 140 /* Read an entry from STREAM. This function is not standardized and 141 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 fgetpwent_r(FILE * __restrict __stream, struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) __nonnull((1, 2, 3, 5)); 148 #endif 149 150 #endif /* POSIX or reentrant */ 151 152 #ifdef __USE_GNU 153 /* Re-construct the password-file line for the given uid 154 in the given buffer. This knows the format that the caller 155 will expect, but this need not be the format of the password file. 156 157 This function is not part of POSIX and therefore no official 158 cancellation point. But due to similarity with an POSIX interface 159 or due to the implementation it is a cancellation point and 160 therefore not marked with __THROW. */ 161 extern int getpw(__uid_t __uid, char *__buffer); 162 #endif 163 164 __END_DECLS 165 #endif /* pwd.h */