1 /* vi: set sw=4 ts=4: */
2 /*
3 * lstat64() for uClibc
4 *
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6 *
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 */
9
10 #include <_lfs_64.h>
11 #include <sys/syscall.h>
12
13 # include <unistd.h>
14 # include <sys/stat.h>
15
16 #if defined __NR_fstatat64 && !defined __NR_lstat64
17 # include <fcntl.h>
18
lstat64(const char * file_name,struct stat64 * buf)19 int lstat64(const char *file_name, struct stat64 *buf)
20 {
21 return fstatat64(AT_FDCWD, file_name, buf, AT_SYMLINK_NOFOLLOW);
22 }
23 libc_hidden_def(lstat64)
24
25 /* For systems which have both, prefer the old one */
26 #elif defined __NR_lstat64
27 # include "xstatconv.h"
28 # define __NR___syscall_lstat64 __NR_lstat64
29 static __always_inline _syscall2(int, __syscall_lstat64, const char *, file_name,
30 struct kernel_stat64 *, buf)
31
32 int lstat64(const char *file_name, struct stat64 *buf)
33 {
34 int result;
35 struct kernel_stat64 kbuf;
36
37 result = __syscall_lstat64(file_name, &kbuf);
38 if (result == 0) {
39 __xstat64_conv(&kbuf, buf);
40 }
41 return result;
42 }
43 libc_hidden_def(lstat64)
44 #endif
45