[PATCH][BZ 18234] struct stat is not posix conform
Carlos O'Donell
carlos@redhat.com
Wed May 20 17:55:00 GMT 2015
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.
More information about the Libc-alpha
mailing list