1 /* vi: set sw=4 ts=4: */
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10 #include <sys/syscall.h>
14 #if defined __NR_fstatat64 && !defined __NR_lstat
17 int lstat(const char *file_name, struct stat *buf)
19 return fstatat(AT_FDCWD, file_name, buf, AT_SYMLINK_NOFOLLOW);
21 libc_hidden_def(lstat)
23 /* For systems which have both, prefer the old one */
25 # include "xstatconv.h"
26 int lstat(const char *file_name, struct stat *buf)
30 /* normal stat call has limited values for various stat elements
31 * e.g. uid device major/minor etc.
32 * so we use 64 variant if available
33 * in order to get newer versions of stat elements
35 struct kernel_stat64 kbuf;
36 result = INLINE_SYSCALL(lstat64, 2, file_name, &kbuf);
38 __xstat32_conv(&kbuf, buf);
41 struct kernel_stat kbuf;
43 result = INLINE_SYSCALL(lstat, 2, file_name, &kbuf);
45 __xstat_conv(&kbuf, buf);
47 # endif /* __NR_lstat64 */
50 libc_hidden_def(lstat)
52 # if ! defined __NR_fstatat64 && ! defined __NR_lstat64 \
53 && defined __UCLIBC_HAS_LFS__
54 strong_alias_untyped(lstat,lstat64)
55 libc_hidden_def(lstat64)
58 #endif /* __NR_fstatat64 */