Hi Yann,

thanks for the patch, applied and pushed.

best regards
 Waldemar

Yann Sionneau wrote,

> Kernel stat/stat64 structure and uClibc-ng ones were not
> in sync regarding the timespec fields.
> Kernel had them but uClibc did not expose it in some cases.
> 
> Man page says that stat struct should have timespec fields if:
> * _POSIX_C_SOURCE is defined to 200809L or greater
> or
> * _XOPEN_SOURCE is defined to 700 or greater
> or
> * _BSD_SOURCE is defined
> or
> * _SVID_SOURCE is defined
> 
> In the case of buildroot vim build, neither _BSD_SOURCE nor _SVID_SOURCE were 
> defined.
> Only _POSIX_C_SOURCE and _XOPEN_SOURCE were defined.
> 
> uClibc-ng header only checked for _BSD_SOURCE and _SVID_SOURCE via __USE_MISC.
> 
> This patch adds a check to __USE_XOPEN2K8 which is defined
> if _POSIX_C_SOURCE >= 200809L or _XOPEN_SOURCE >= 700
> 
> This for instance fixes a crash at startup of vim (not the busybox one) on 
> aarch64 and all other
> arch where in kernel STAT_HAVE_NSEC is set and where stat.h in uClibc-ng 
> comes from libc/sysdeps/linux/common-generic/bits
> 
> Signed-off-by: Yann Sionneau <[email protected]>
> ---
>  libc/sysdeps/linux/common-generic/bits/stat.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libc/sysdeps/linux/common-generic/bits/stat.h 
> b/libc/sysdeps/linux/common-generic/bits/stat.h
> index 2f72d357a..045c0f486 100644
> --- a/libc/sysdeps/linux/common-generic/bits/stat.h
> +++ b/libc/sysdeps/linux/common-generic/bits/stat.h
> @@ -47,7 +47,7 @@ struct stat
>      int st_blksize;                          /* Optimal block size for I/O. 
> */
>      int __pad2;
>      long long st_blocks;                     /* Number 512-byte blocks 
> allocated */
> -#ifdef __USE_MISC
> +#if defined(__USE_MISC) || defined(__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
> @@ -88,7 +88,7 @@ struct stat64
>      int st_blksize;                          /* Optimal block size for I/O. 
> */
>      int __pad4;
>      long long st_blocks;                     /* Number 512-byte blocks 
> allocated */
> -# ifdef __USE_MISC
> +# if defined(__USE_MISC) || defined(__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
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> devel mailing list
> [email protected]
> https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel
_______________________________________________
devel mailing list
[email protected]
https://mailman.uclibc-ng.org/cgi-bin/mailman/listinfo/devel

Reply via email to