Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Oct 2011 23:52:31 +0200
From:      "Christopher J. Ruwe" <cjr@cruwe.de>
To:        <freebsd-hackers@freebsd.org>
Subject:   _SC_GETPW_R_SIZE_MAX undefined in sysconf.c, what is correct value?
Message-ID:  <20111023235231.71f73ea3@dijkstra>

next in thread | raw e-mail | index | archive | help
--Sig_/bPMhCG8I9AM9ThsjFZaDu71
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

I need to get the maximum size of an pwd-entry to determine the correct
buffersize for calling getpwnam_r("uname",&pwd, buf, bufsize, &pwdp). I
would like to use sysconf(_SC_GETPW_R_SIZE_MAX) to determine bufsize,
which unfornutately fails (returns -1). Currently, I used 16384, which
seems to be too much, bit works for the time being.

=46rom recent mails I get that _SC_GETPW_R_SIZE_MAX is not available on FreeB=
SD, e.g., http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2009-Septem=
ber/173081.html and http://www.redhat.com/archives/libvir-list/2011-May/msg=
01013.html. This assertion seems to be backed by /usr/srclib/libc/gen/sysco=
nf.c, line 374.

=46rom Stevens & Rago, Adavanced Programming in the UNIX Environment, I can g=
et that FreeBSD supports all possible members in the passwd structure, but =
where can I determine the maximum size of these so that I can calculate the=
 ax size of the pwd struct therefrom? Does anybody know or know where to lo=
ok what maximum size a pwd-entry can have?=20

Knowing the maximum size a pwd structure can have, it seems like to be an i=
dea to define the correct value in sysconf.c. As that is not done though su=
ggested in the code, are there any obstacles in defining that value so nobo=
dy has done that so far?

Thanks for any help, cheers,=20
--=20
Christopher J. Ruwe
TZ GMT + 2

--Sig_/bPMhCG8I9AM9ThsjFZaDu71
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iQIcBAEBAgAGBQJOpIymAAoJEJTIKW/o3iwUwHsP/A7EMfLFaT57uxIrF2aQ9QQC
cmNsRnIOtisvAyMDsLZP4uepjX7gK0H2y7jOa8R3XpoxrCVri2MLAgKhaLosMB/X
u1jbLzdaSeFW8hsUej9Jcm56fdA9aKGSaasVQt0H5fQuoFqjakijQ75Ao3pQvUbr
8VpiwBTUNDFN/HLssgkylXrbrIyzij2V1SUhp4eUmwOWeovfQgO4j2DZos19fxh+
8OJxMz9W52z60O+TPhywLlH1Urx5dulAg2DM0uLqFOzYdjnuqXqQsLB+NmDUCJLb
tqD15nc62jWI7CGcmlRJJhwk9xt8JHw/N6AfDKzG1pD2hQhOsHRt22InDdJj90S6
ip6ScxrgH0cobYFrFsmwnjm6zcTX6Kggr1H17W3UWp90vMT3tGphT6vydJBLHfuO
7nIbpQTs4CawcGD3hfaC64fvmpkp0MDAJbUnUfLSV2BSXj1NjZJXLVSx0FUYZEBJ
ymRgy6NDuU+H7yi9iMPxhAQ5JBmB35TESAMY3QbPir0ARJ03McNN0IGaeHdDXU/9
GOHY9kNOQRDfpt0+iMvI/LH8StG/Cm/fhI7oFSKJ47gyP2AgwrJfvyYhJvr7T78p
EsoIG8ocXO6cCtIN9JRCEBcO8f+EYdFpI2U9csP05+srrt/vpAfg7CZ4vqtIuHdO
FtTqn9JG68195QkxtcG0
=6mH+
-----END PGP SIGNATURE-----

--Sig_/bPMhCG8I9AM9ThsjFZaDu71--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111023235231.71f73ea3>