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 #elif __WORDSIZE == 64 && defined __NR_newfstatat
26 int lstat(const char *file_name
, struct stat
*buf
)
28 return fstatat(AT_FDCWD
, file_name
, buf
, AT_SYMLINK_NOFOLLOW
);
30 libc_hidden_def(lstat
)
32 /* For systems which have both, prefer the old one */
34 # include "xstatconv.h"
35 int lstat(const char *file_name
, struct stat
*buf
)
39 /* normal stat call has limited values for various stat elements
40 * e.g. uid device major/minor etc.
41 * so we use 64 variant if available
42 * in order to get newer versions of stat elements
44 struct kernel_stat64 kbuf
;
45 result
= INLINE_SYSCALL(lstat64
, 2, file_name
, &kbuf
);
47 __xstat32_conv(&kbuf
, buf
);
50 struct kernel_stat kbuf
;
52 result
= INLINE_SYSCALL(lstat
, 2, file_name
, &kbuf
);
54 __xstat_conv(&kbuf
, buf
);
56 # endif /* __NR_lstat64 */
59 libc_hidden_def(lstat
)
61 # if ! defined __NR_fstatat64 && ! defined __NR_lstat64
62 strong_alias_untyped(lstat
,lstat64
)
63 libc_hidden_def(lstat64
)
66 #endif /* __NR_fstatat64 */