sys/socket.h: add new SO_ socket options from linux v5.11
[musl] / src / stat / fstat.c
index 88ac6f3..9bbb46d 100644 (file)
@@ -1,10 +1,15 @@
+#define _BSD_SOURCE
 #include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
 #include "syscall.h"
-#include "libc.h"
 
-int fstat(int fd, struct stat *buf)
+int fstat(int fd, struct stat *st)
 {
-       return syscall2(__NR_fstat, fd, (long)buf);
+       if (fd<0) return __syscall_ret(-EBADF);
+       return fstatat(fd, "", st, AT_EMPTY_PATH);
 }
 
-LFS64(fstat);
+#if !_REDIR_TIME64
+weak_alias(fstat, fstat64);
+#endif