This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH][BZ 18234] struct stat is not posix conform
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: Szabolcs Nagy <szabolcs dot nagy at arm dot com>, GNU C Library <libc-alpha at sourceware dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Ramana Radhakrishnan <Ramana dot Radhakrishnan at arm dot com>
- Date: Wed, 20 May 2015 12:24:25 -0400
- Subject: Re: [PATCH][BZ 18234] struct stat is not posix conform
- Authentication-results: sourceware.org; auth=none
- References: <555CA657 dot 2050300 at arm dot com>
On 05/20/2015 11:20 AM, Szabolcs Nagy wrote:
> the generic definition of struct stat on linux miss the
> st_atim, st_mtim and st_ctim members when _POSIX_C_SOURCE
> is defined (affects at least aarch64 and arm).
>
> i did not see regressions on aarch64.
>
> 2015-05-20 Szabolcs Nagy <szabolcs.nagy@arm.com>
>
> [BZ #18234]
> * sysdeps/unix/sysv/linux/generic/bits/stat.h (struct stat): Make
> st_atim, st_ctim, st_mtim visible under __USE_XOPEN2K8.
I like the idea of the change.
Firstly it needs a test case.
Secondly, it changes when these members are made available, and that
might break applications unless you show that __USE_MISC is a subset
of __USE_XOPEN2K8, which I don't think it is.
Therefore you will have to use "__USE_MISC || __USE_XOPEN2K8" preceeded
by a lengthy comment about the fact that in _DEFAULT_SOURCE you'll get
these members, but in strict compliance you need to have POSIX Issue 7.
Joseph, does that sound right to you?
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/stat.h b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> index 42cb198..82e6b1d 100644
> --- a/sysdeps/unix/sysv/linux/generic/bits/stat.h
> +++ b/sysdeps/unix/sysv/linux/generic/bits/stat.h
> @@ -66,7 +66,7 @@ struct stat
> __blksize_t st_blksize; /* Optimal block size for I/O. */
> int __pad2;
> __field64(__blkcnt_t, __blkcnt64_t, st_blocks); /* 512-byte blocks */
> -#ifdef __USE_MISC
> +#ifdef __USE_XOPEN2K8
> /* Nanosecond resolution timestamps are stored in a format
> equivalent to 'struct timespec'. This is the type used
> whenever possible but the Unix namespace rules do not allow the
Cheers,
Carlos.