[PATCH] stat: Use stat64 syscall if available

Mike Frysinger vapier at gentoo.org
Fri Feb 3 12:58:13 UTC 2012


On Thursday 02 February 2012 19:12:00 Khem Raj wrote:
> --- a/libc/sysdeps/linux/common/stat.c
> +++ b/libc/sysdeps/linux/common/stat.c
> 
>  int stat(const char *file_name, struct stat *buf)
>  {
>  	int result;
> +#ifdef __NR_stat64
> +	struct kernel_stat64 kbuf;
> +	result = INLINE_SYSCALL(stat64, 2, file_name, &kbuf);
> +	if (result == 0) {
> +		__xstat32_conv(&kbuf, buf);
> +	}
> +#else
>  	struct kernel_stat kbuf;
> 
> -	result = __syscall_stat(file_name, &kbuf);
> +	result = INLINE_SYSCALL(stat, 2, file_name, &kbuf);
>  	if (result == 0) {
>  		__xstat_conv(&kbuf, buf);
>  	}
> +#endif
>  	return result;
>  }

might be useful to add a comment why you're calling stat64 ... because that 
fills out more fields than stat does typically
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20120203/f90be11b/attachment.asc>


More information about the uClibc mailing list