modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/pwd.h (about) 1 /* Copyright (C) 1991-2018 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 # include <bits/types/FILE.h> 58 #endif 59 60 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 61 /* Rewind the password-file stream. 62 63 This function is a possible cancellation point and therefore not 64 marked with __THROW. */ 65 extern void setpwent(void); 66 67 /* Close the password-file stream. 68 69 This function is a possible cancellation point and therefore not 70 marked with __THROW. */ 71 extern void endpwent(void); 72 73 /* Read an entry from the password-file stream, opening it if necessary. 74 75 This function is a possible cancellation point and therefore not 76 marked with __THROW. */ 77 extern struct passwd *getpwent(void); 78 #endif 79 80 #ifdef __USE_MISC 81 /* Read an entry from 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 struct passwd *fgetpwent(FILE * __stream) __nonnull((1)); 88 89 /* Write the given entry onto the given stream. 90 91 This function is not part of POSIX and therefore no official 92 cancellation point. But due to similarity with an POSIX interface 93 or due to the implementation it is a cancellation point and 94 therefore not marked with __THROW. */ 95 extern int putpwent(const struct passwd *__restrict __p, FILE * __restrict __f); 96 #endif 97 98 /* Search for an entry with a matching user ID. 99 100 This function is a possible cancellation point and therefore not 101 marked with __THROW. */ 102 extern struct passwd *getpwuid(__uid_t __uid); 103 104 /* Search for an entry with a matching username. 105 106 This function is a possible cancellation point and therefore not 107 marked with __THROW. */ 108 extern struct passwd *getpwnam(const char *__name) __nonnull((1)); 109 110 #ifdef __USE_POSIX 111 112 # ifdef __USE_MISC 113 /* Reasonable value for the buffer sized used in the reentrant 114 functions below. But better use `sysconf'. */ 115 # define NSS_BUFLEN_PASSWD 1024 116 # endif 117 118 /* Reentrant versions of some of the functions above. 119 120 PLEASE NOTE: the `getpwent_r' function is not (yet) standardized. 121 The interface may change in later versions of this library. But 122 the interface is designed following the principals used for the 123 other reentrant functions so the chances are good this is what the 124 POSIX people would choose. */ 125 126 # ifdef __USE_MISC 127 /* This function is not part of POSIX and therefore no official 128 cancellation point. But due to similarity with an POSIX interface 129 or due to the implementation it is a cancellation point and 130 therefore not marked with __THROW. */ 131 extern int getpwent_r(struct passwd *__restrict __resultbuf, char *__restrict __buffer, size_t __buflen, struct passwd **__restrict __result) __nonnull((1, 2, 4)); 132 # endif 133 134 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)); 135 136 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)); 137 138 # ifdef __USE_MISC 139 /* Read an entry from STREAM. This function is not standardized and 140 probably never will. 141 142 This function is not part of POSIX and therefore no official 143 cancellation point. But due to similarity with an POSIX interface 144 or due to the implementation it is a cancellation point and 145 therefore not marked with __THROW. */ 146 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)); 147 # endif 148 149 #endif /* POSIX or reentrant */ 150 151 #ifdef __USE_GNU 152 /* Re-construct the password-file line for the given uid 153 in the given buffer. This knows the format that the caller 154 will expect, but this need not be the format of the password file. 155 156 This function is not part of POSIX and therefore no official 157 cancellation point. But due to similarity with an POSIX interface 158 or due to the implementation it is a cancellation point and 159 therefore not marked with __THROW. */ 160 extern int getpw(__uid_t __uid, char *__buffer); 161 #endif 162 163 __END_DECLS 164 #endif /* pwd.h */