diff options
author | 2015-10-30 03:12:33 +0000 | |
---|---|---|
committer | 2015-10-30 03:12:33 +0000 | |
commit | cdcc8da3a1b77a596fe88d0328a6c785bfe9732d (patch) | |
tree | d9289c5331d6b3cff51a10b7a49c4a75bc944510 /lib/libc | |
parent | mark usage __dead (diff) | |
download | wireguard-openbsd-cdcc8da3a1b77a596fe88d0328a6c785bfe9732d.tar.xz wireguard-openbsd-cdcc8da3a1b77a596fe88d0328a6c785bfe9732d.zip |
For getgrent.3:
- delete the commented out setgrfile bits, as well as the MLINK
- rename getgr{nam,gid}_r()'s 'buffer' parameters to 'buf' to be
consistent with getpwnam(3) and practically all other section 3 manpages
- we have sysconf(_SC_GETGR_R_SIZE_MAX) now, so uncomment and revise the text
For getpwnam.3:
- rename buflen to bufsize for consistency
- rewrite the description of the getpw{nam,uid}_r functions to
match the better getgr{nam,gid}_r() description, adding sysconf() bits
Add sysconf(3) to SEE ALSO for both
encouraged by schwarze@
ok millert@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/gen/getgrent.3 | 24 | ||||
-rw-r--r-- | lib/libc/gen/getpwnam.3 | 36 |
3 files changed, 36 insertions, 28 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index b41f08ab8c7..54b58c92dc7 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.70 2015/09/13 17:08:03 guenther Exp $ +# $OpenBSD: Makefile.inc,v 1.71 2015/10/30 03:12:33 guenther Exp $ # gen sources .PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/gen ${LIBCSRCDIR}/gen @@ -100,7 +100,7 @@ MLINKS+=getdomainname.3 setdomainname.3 MLINKS+=getfsent.3 endfsent.3 getfsent.3 getfsfile.3 getfsent.3 getfsspec.3 \ getfsent.3 setfsent.3 MLINKS+=getgrent.3 endgrent.3 getgrent.3 setgroupent.3 getgrent.3 getgrgid.3 \ - getgrent.3 getgrnam.3 getgrent.3 setgrent.3 getgrent.3 setgrfile.3 \ + getgrent.3 getgrnam.3 getgrent.3 setgrent.3 \ getgrent.3 getgrgid_r.3 getgrent.3 getgrnam_r.3 MLINKS+=gethostname.3 sethostname.3 MLINKS+=getnetgrent.3 endnetgrent.3 getnetgrent.3 innetgr.3 \ diff --git a/lib/libc/gen/getgrent.3 b/lib/libc/gen/getgrent.3 index a5f03ec830d..0db9933ed59 100644 --- a/lib/libc/gen/getgrent.3 +++ b/lib/libc/gen/getgrent.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getgrent.3,v 1.20 2015/01/15 03:19:43 millert Exp $ +.\" $OpenBSD: getgrent.3,v 1.21 2015/10/30 03:12:33 guenther Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: January 15 2015 $ +.Dd $Mdocdate: October 30 2015 $ .Dt GETGRENT 3 .Os .Sh NAME @@ -37,7 +37,6 @@ .Nm getgrgid , .Nm getgrgid_r , .Nm setgroupent , -.\" .Nm setgrfile , .Nm setgrent , .Nm endgrent .Nd group database operations @@ -48,15 +47,13 @@ .Ft struct group * .Fn getgrnam "const char *name" .Ft int -.Fn getgrnam_r "const char *name" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" +.Fn getgrnam_r "const char *name" "struct group *grp" "char *buf" "size_t bufsize" "struct group **result" .Ft struct group * .Fn getgrgid "gid_t gid" .Ft int -.Fn getgrgid_r "gid_t gid" "struct group *grp" "char *buffer" "size_t bufsize" "struct group **result" +.Fn getgrgid_r "gid_t gid" "struct group *grp" "char *buf" "size_t bufsize" "struct group **result" .Ft int .Fn setgroupent "int stayopen" -.\" .Ft void -.\" .Fn setgrfile "const char *name" .Ft void .Fn setgrent void .Ft void @@ -135,14 +132,12 @@ or .Fa name . Storage referenced by the group structure will be allocated from the memory provided with the -.Fa buffer +.Fa buf parameter, which is .Fa bufsiz characters in size. -.\" The maximum size needed for this buffer can be determined with the -.\" .Dv _SC_GETGR_R_SIZE_MAX -.\" .Xr sysconf 2 -.\" parameter. +The maximum size needed for this buffer can be determined with +.Fn sysconf _SC_GETGR_R_SIZE_MAX . .Ss YP support If YP is active, the functions .Fn getgrent @@ -205,7 +200,7 @@ functions may fail if: .Bl -tag -width Er .It Bq Er ERANGE The storage supplied via -.Fa buffer +.Fa buf and .Fa bufsize is too small and cannot contain all the strings to be returned in @@ -240,6 +235,7 @@ and functions do not set errno. .Sh SEE ALSO .Xr getpwent 3 , +.Xr sysconf 3 , .Xr ypclnt 3 , .Xr group 5 , .Xr yp 8 @@ -285,7 +281,7 @@ appeared in .Bx 4.3 Reno . .Pp The historic function -.Xr setgrfile 3 , +.Fn setgrfile , which allowed the specification of alternate group databases, has been deprecated and is no longer available. .Sh BUGS diff --git a/lib/libc/gen/getpwnam.3 b/lib/libc/gen/getpwnam.3 index 9701d799242..11f0c68192e 100644 --- a/lib/libc/gen/getpwnam.3 +++ b/lib/libc/gen/getpwnam.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getpwnam.3,v 1.8 2015/10/27 04:41:18 guenther Exp $ +.\" $OpenBSD: getpwnam.3,v 1.9 2015/10/30 03:12:33 guenther Exp $ .\" .\" Copyright (c) 1988, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: October 27 2015 $ +.Dd $Mdocdate: October 30 2015 $ .Dt GETPWNAM 3 .Os .Sh NAME @@ -44,9 +44,9 @@ .Ft struct passwd * .Fn getpwuid "uid_t uid" .Ft int -.Fn getpwnam_r "const char *login" "struct passwd *pwstore" "char *buf" "size_t buflen" "struct passwd **result" +.Fn getpwnam_r "const char *login" "struct passwd *pwstore" "char *buf" "size_t bufsize" "struct passwd **result" .Ft int -.Fn getpwuid_r "uid_t uid" "struct passwd *pwstore" "char *buf" "size_t buflen" "struct passwd **result" +.Fn getpwuid_r "uid_t uid" "struct passwd *pwstore" "char *buf" "size_t bufsize" "struct passwd **result" .Ft int .Fn setpassent "int stayopen" .Sh DESCRIPTION @@ -78,16 +78,27 @@ and search the password database for the given login name or user ID, respectively, always returning the first one encountered. .Pp -The re-entrant versions, +The .Fn getpwnam_r and -.Fn getpwuid_r , -behave similarly but the various strings associated with the result -are stored in -.Fa buf , -and +.Fn getpwuid_r +functions both update the passwd structure pointed to by .Fa pwstore -is updated to reference those strings. +and store a pointer to that structure at the location pointed to by +.Fa result . +The structure is filled with an entry from the password database with a +matching +.Fa name +or +.Fa uid . +Storage referenced by the passwd structure will be allocated from +the memory provided with the +.Fa buf +parameter, which is +.Fa bufsiz +characters in size. +The maximum size needed for this buffer can be determined with +.Fn sysconf _SC_GETPW_R_SIZE_MAX . .Pp .Fn setpassent accomplishes two purposes. @@ -189,7 +200,7 @@ functions may fail if: The storage supplied via .Fa buf and -.Fa buflen +.Fa bufsize is too small and cannot contain all the strings to be returned in .Fa pwstore . .El @@ -214,6 +225,7 @@ subsystem. .Xr getgrouplist 3 , .Xr getpwent 3 , .Xr pw_dup 3 , +.Xr sysconf 3 , .Xr passwd 5 , .Xr Makefile.yp 8 , .Xr pwd_mkdb 8 , |