This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nonstrings in Glibc


On Tue, Nov 21, 2017 at 4:20 PM, Martin Sebor <msebor@gmail.com> wrote:
>
> I see two struct dirent in my Glibc build on x86_64: one in
> bits/dirent.h and another in sysdeps/unix/sysv/linux/bits/dirent.h.
> AFAICT, the first one is the one that's installed and the second
> one is used internally within Glibc.  Did I get that right?

No, that's not right. The top-level bits directory contains _fallback_
bits headers, to be used only if no sysdeps directory overrides them;
I don't know why it's in the top level instead of in sysdeps/generic
(which is where you'd expect it to be) but it's probably something
horrible to do with the include search path.

On Linux-based configurations, sysdeps/unix/sysv/linux/bits/dirent.h
should be both installed and used internally.

>  Should
> one of these be annotated with attribute nonstring? (POSIX requires
> d_name to be nul-terminated and there are assumptions in Glibc that
> rely on it being so, such as the _D_EXACT_NAMLEN() macro, that
> trigger the non-string warning if I annotate the latter.)

If POSIX requires d_name to be nul-terminated, then I think it's safe
to say that attribute nonstring is not appropriate for it (assuming I
understand the point of attribute nonstring, anyway, which I only know
about courtesy this thread).

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]