This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: The lack of UNIX_PATH_MAX on sys/un.h
- From: <tomas at tuxteam dot de>
- To: libc-help at sourceware dot org
- Date: Fri, 8 Dec 2017 10:17:07 +0100
- Subject: Re: The lack of UNIX_PATH_MAX on sys/un.h
- Authentication-results: sourceware.org; auth=none
- References: <20171207213300.GB25005@omri-desktop> <99ebc569-0be3-2cd4-ee17-083cd78b91f1@redhat.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thu, Dec 07, 2017 at 10:49:57PM +0100, Florian Weimer wrote:
> On 12/07/2017 10:33 PM, omri wrote:
>
> >The change to use sys/un.h is fairly trivial but I was using the UNIX_PATH_MAX
> >definition.
> >
> >Is there any reason this isn't defined in glibc? are there any reservations from adding it?
>
> I don't think it is in any standard.
>
> UNIX_PATH_MAX is also a misnomer, it's just the size of the defined
> array in struct sockaddr_un. The actual kernel limit is somewhere
> around PATH_MAX.
Poking around the 'nets seems to confirm that. Other people stumbled
upon that [1], [2], and the consensus seems to be to steer clear of
UNIX_PATH_MAX wich sometimes is even inconsistent.
Instead, sizeof(address.sun_path) seems to be a good alternative.
[1] http://git.661346.n2.nabble.com/PATCH-0-3-index-helper-fix-UNIX-PATH-MAX-redefinition-error-on-cygwin-td7652915.html
[2] https://bugs.launchpad.net/lsb/+bug/1327331
Cheers
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
iEYEARECAAYFAloqWJIACgkQBcgs9XrR2kb8MgCfUs84Nu/PVyy6iPxEQWySfdPg
s2wAnihiyXiHQQc9W6TX65iY4J/MDHae
=ea6a
-----END PGP SIGNATURE-----