]> Git Repo - uclibc-ng.git/blame - include/pwd.h
Revert "glibc compat: bump glibc minor version"
[uclibc-ng.git] / include / pwd.h
CommitLineData
005d20f0 1/* Copyright (C) 1991,1992,1995-2001,2003,2004 Free Software Foundation, Inc.
e83a36ce
EA
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
266bdc1f
MF
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
e83a36ce
EA
17
18/*
19 * POSIX Standard: 9.2.2 User Database Access <pwd.h>
20 */
21
22#ifndef _PWD_H
23#define _PWD_H 1
64bc6412 24
64bc6412 25#include <features.h>
64bc6412 26
ce8ee8d9
DM
27__BEGIN_DECLS
28
e83a36ce
EA
29#include <bits/types.h>
30
31#define __need_size_t
32#include <stddef.h>
33
005d20f0 34#if defined __USE_XOPEN || defined __USE_XOPEN2K
e83a36ce
EA
35/* The Single Unix specification says that some more types are
36 available here. */
37# ifndef __gid_t_defined
38typedef __gid_t gid_t;
39# define __gid_t_defined
40# endif
41
42# ifndef __uid_t_defined
43typedef __uid_t uid_t;
44# define __uid_t_defined
45# endif
46#endif
47
64bc6412
EA
48/* The passwd structure. */
49struct passwd
50{
51 char *pw_name; /* Username. */
52 char *pw_passwd; /* Password. */
e83a36ce
EA
53 __uid_t pw_uid; /* User ID. */
54 __gid_t pw_gid; /* Group ID. */
64bc6412
EA
55 char *pw_gecos; /* Real name. */
56 char *pw_dir; /* Home directory. */
57 char *pw_shell; /* Shell program. */
58};
59
60
e83a36ce
EA
61#if defined __USE_SVID || defined __USE_GNU
62# define __need_FILE
63# include <stdio.h>
64#endif
65
64bc6412 66
e83a36ce 67#if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN_EXTENDED
005d20f0 68/* Rewind the password-file stream.
64bc6412 69
005d20f0
PM
70 This function is a possible cancellation point and therefore not
71 marked with __THROW. */
72extern void setpwent (void);
64bc6412 73
005d20f0
PM
74/* Close the password-file stream.
75
76 This function is a possible cancellation point and therefore not
77 marked with __THROW. */
78extern void endpwent (void);
79
80/* Read an entry from the password-file stream, opening it if necessary.
81
82 This function is a possible cancellation point and therefore not
83 marked with __THROW. */
84extern struct passwd *getpwent (void);
e83a36ce 85#endif
791312e7 86
e83a36ce 87#ifdef __USE_SVID
005d20f0
PM
88/* Read an entry from STREAM.
89
90 This function is not part of POSIX and therefore no official
91 cancellation point. But due to similarity with an POSIX interface
92 or due to the implementation it is a cancellation point and
93 therefore not marked with __THROW. */
94extern struct passwd *fgetpwent (FILE *__stream);
95
96/* Write the given entry onto the given stream.
791312e7 97
005d20f0
PM
98 This function is not part of POSIX and therefore no official
99 cancellation point. But due to similarity with an POSIX interface
100 or due to the implementation it is a cancellation point and
101 therefore not marked with __THROW. */
290e19f8 102extern int putpwent (const struct passwd *__restrict __p,
005d20f0 103 FILE *__restrict __f);
e83a36ce 104#endif
64bc6412 105
005d20f0 106/* Search for an entry with a matching user ID.
e83a36ce 107
005d20f0
PM
108 This function is a possible cancellation point and therefore not
109 marked with __THROW. */
110extern struct passwd *getpwuid (__uid_t __uid);
111
112/* Search for an entry with a matching username.
113
114 This function is a possible cancellation point and therefore not
115 marked with __THROW. */
290e19f8 116extern struct passwd *getpwnam (const char *__name);
a716f8ad 117libc_hidden_proto(getpwnam)
e83a36ce
EA
118
119#if defined __USE_POSIX || defined __USE_MISC
120
121# ifdef __USE_MISC
122/* Reasonable value for the buffer sized used in the reentrant
123 functions below. But better use `sysconf'. */
124# define NSS_BUFLEN_PASSWD 1024
125# endif
126
127/* Reentrant versions of some of the functions above.
128
129 PLEASE NOTE: the `getpwent_r' function is not (yet) standardized.
130 The interface may change in later versions of this library. But
131 the interface is designed following the principals used for the
132 other reentrant functions so the chances are good this is what the
133 POSIX people would choose. */
134
135# if defined __USE_SVID || defined __USE_MISC
005d20f0
PM
136/* This function is not part of POSIX and therefore no official
137 cancellation point. But due to similarity with an POSIX interface
138 or due to the implementation it is a cancellation point and
139 therefore not marked with __THROW. */
e83a36ce
EA
140extern int getpwent_r (struct passwd *__restrict __resultbuf,
141 char *__restrict __buffer, size_t __buflen,
005d20f0 142 struct passwd **__restrict __result);
cb97aade 143libc_hidden_proto(getpwent_r)
e83a36ce
EA
144# endif
145
146extern int getpwuid_r (__uid_t __uid,
147 struct passwd *__restrict __resultbuf,
148 char *__restrict __buffer, size_t __buflen,
005d20f0 149 struct passwd **__restrict __result);
cb97aade 150libc_hidden_proto(getpwuid_r)
e83a36ce 151
290e19f8 152extern int getpwnam_r (const char *__restrict __name,
e83a36ce
EA
153 struct passwd *__restrict __resultbuf,
154 char *__restrict __buffer, size_t __buflen,
005d20f0 155 struct passwd **__restrict __result);
cb97aade 156libc_hidden_proto(getpwnam_r)
e83a36ce
EA
157
158
159# ifdef __USE_SVID
160/* Read an entry from STREAM. This function is not standardized and
005d20f0
PM
161 probably never will.
162
163 This function is not part of POSIX and therefore no official
164 cancellation point. But due to similarity with an POSIX interface
165 or due to the implementation it is a cancellation point and
166 therefore not marked with __THROW. */
e83a36ce
EA
167extern int fgetpwent_r (FILE *__restrict __stream,
168 struct passwd *__restrict __resultbuf,
169 char *__restrict __buffer, size_t __buflen,
005d20f0 170 struct passwd **__restrict __result);
cb97aade 171libc_hidden_proto(fgetpwent_r)
e83a36ce
EA
172# endif
173
174#endif /* POSIX or reentrant */
175
176#ifdef __USE_GNU
177/* Re-construct the password-file line for the given uid
178 in the given buffer. This knows the format that the caller
005d20f0
PM
179 will expect, but this need not be the format of the password file.
180
181 This function is not part of POSIX and therefore no official
182 cancellation point. But due to similarity with an POSIX interface
183 or due to the implementation it is a cancellation point and
184 therefore not marked with __THROW. */
185extern int getpw (__uid_t __uid, char *__buffer);
64bc6412
EA
186#endif
187
ce8ee8d9 188__END_DECLS
791312e7 189
64bc6412 190#endif /* pwd.h */
This page took 0.252581 seconds and 4 git commands to generate.