xref: /original-bsd/lib/libc/gen/pwcache.3 (revision 07711933)
1.\" Copyright (c) 1989, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)pwcache.3	8.1 (Berkeley) 06/09/93
7.\"
8.Dd
9.Dt PWCACHE 3
10.Os
11.Sh NAME
12.Nm pwcache
13.Nd cache password and group entries
14.Sh SYNOPSIS
15.Fn user_from_uid "uid_t uid" "int nouser"
16.Fn group_from_gid "gid_t gid" "int nogroup"
17.Sh DESCRIPTION
18.Pp
19The
20.Fn user_from_uid
21function returns the user name associated with the argument
22.Fa uid .
23The user name is cached so that multiple calls with the same
24.Fa uid
25do not require additional calls to
26.Xr getpwuid 3 .
27If there is no user associated with the
28.Fa uid ,
29a pointer is returned
30to a string representation of the
31.Fa uid ,
32unless the argument
33.Fa nouser
34is non-zero, in which case a
35.Dv NULL
36pointer is returned.
37.Pp
38The
39.Fn group_from_gid
40function returns the group name associated with the argument
41.Fa gid .
42The group name is cached so that multiple calls with the same
43.Fa gid
44do not require additional calls to
45.Xr getgrgid 3 .
46If there is no group associated with the
47.Fa gid ,
48a pointer is returned
49to a string representation of the
50.Fa gid ,
51unless the argument
52.Fa nogroup
53is non-zero, in which case a
54.Dv NULL
55pointer is returned.
56.Sh SEE ALSO
57.Xr getgrgid 3 ,
58.Xr getpwuid 3
59.Sh HISTORY
60The
61.Fn user_from_id
62and
63.Fn group_from_id
64functions first appeared in 4.4BSD.
65