~ubuntu-branches/ubuntu/saucy/manpages/saucy

« back to all changes in this revision

Viewing changes to man3/getpwnam.3

  • Committer: Package Import Robot
  • Author(s): Loïc Minier
  • Date: 2011-10-17 13:06:22 UTC
  • mfrom: (1.1.46 upstream) (2.2.11 sid)
  • Revision ID: package-import@ubuntu.com-20111017130622-rbdw3julnma2baqu
Tags: 3.32-0.2ubuntu1
* Merge from Debian testing/unstable; remaining changes:
  - ptrace.2, prctl.2: document Ubuntu-specific PTRACE_ATTACH,
    PR_SET_PTRACER behavior.
* Keep Debian's glibc-doc version in the Replaces as it's satisfactory for
  upgrades from natty and lucid.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
.\" Modified 2003-11-15 by aeb
33
33
.\" 2008-11-07, mtk, Added an example program for getpwnam_r().
34
34
.\"
35
 
.TH GETPWNAM 3  2009-03-30 "GNU" "Linux Programmer's Manual"
 
35
.TH GETPWNAM 3  2010-10-21 "GNU" "Linux Programmer's Manual"
36
36
.SH NAME
37
37
getpwnam, getpwnam_r, getpwuid, getpwuid_r \- get password file entry
38
38
.SH SYNOPSIS
84
84
that matches the user ID
85
85
.IR uid .
86
86
.PP
87
 
The
88
 
.BR getpwnam_r ()
89
 
and
90
 
.BR getpwuid_r ()
91
 
functions obtain the same information, but store the retrieved
92
 
.I passwd
93
 
structure in the space pointed to by
94
 
.IR pwd .
95
 
This
96
 
.I passwd
97
 
structure contains pointers to strings, and these strings
98
 
are stored in the buffer
99
 
.I buf
100
 
of size
101
 
.IR buflen .
102
 
A pointer to the result (in case of success) or NULL (in case no entry
103
 
was found or an error occurred) is stored in
104
 
.IR *result .
105
 
.PP
106
87
The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
107
88
.sp
108
89
.in +4n
112
93
    char   *pw_passwd;     /* user password */
113
94
    uid_t   pw_uid;        /* user ID */
114
95
    gid_t   pw_gid;        /* group ID */
115
 
    char   *pw_gecos;      /* real name */
 
96
    char   *pw_gecos;      /* user information */
116
97
    char   *pw_dir;        /* home directory */
117
98
    char   *pw_shell;      /* shell program */
118
99
};
119
100
.fi
120
101
.in
121
102
.PP
122
 
The maximum needed size for
 
103
See
 
104
.BR passwd (5)
 
105
for more information about these fields.
 
106
.PP
 
107
The
 
108
.BR getpwnam_r ()
 
109
and
 
110
.BR getpwuid_r ()
 
111
functions obtain the same information as
 
112
.BR getpwnam ()
 
113
and
 
114
.BR getpwuid (),
 
115
but store the retrieved
 
116
.I passwd
 
117
structure in the space pointed to by
 
118
.IR pwd .
 
119
The string fields pointed to by the members of the
 
120
.I passwd
 
121
structure are stored in the buffer
 
122
.I buf
 
123
of size
 
124
.IR buflen .
 
125
A pointer to the result (in case of success) or NULL (in case no entry
 
126
was found or an error occurred) is stored in
 
127
.IR *result .
 
128
.PP
 
129
The maximum size needed for
123
130
.I buf
124
131
can be found using
125
132
.BR sysconf (3)
209
216
System Databases and Name Service Switch configuration file
210
217
.SH "CONFORMING TO"
211
218
SVr4, 4.3BSD, POSIX.1-2001.
 
219
The
 
220
.I pw_gecos
 
221
field is not specified in POSIX, but is present on most implementations.
212
222
.SH NOTES
213
223
The formulation given above under "RETURN VALUE" is from POSIX.1-2001.
214
224
It does not call "not found" an error, and hence does not specify what value
220
230
.I errno
221
231
should be left unchanged if an entry is not found.
222
232
Experiments on various
223
 
Unix-like systems show that lots of different values occur in this
 
233
UNIX-like systems show that lots of different values occur in this
224
234
situation: 0, ENOENT, EBADF, ESRCH, EWOULDBLOCK, EPERM and probably others.
225
235
.\" more precisely:
226
236
.\" AIX 5.1 - gives ESRCH
312
322
.BR nsswitch.conf (5),
313
323
.BR passwd (5)
314
324
.SH COLOPHON
315
 
This page is part of release 3.27 of the Linux
 
325
This page is part of release 3.32 of the Linux
316
326
.I man-pages
317
327
project.
318
328
A description of the project,