diff --git a/lib/bsp/syscalls/syscalls.cpp b/lib/bsp/syscalls/syscalls.cpp index 0098a79..fe899a1 100644 --- a/lib/bsp/syscalls/syscalls.cpp +++ b/lib/bsp/syscalls/syscalls.cpp @@ -13,12 +13,12 @@ * limitations under the License. */ #include "syscalls.h" -#include #include #include +#include #include -#include #include +#include using namespace sys; @@ -85,10 +85,11 @@ off_t sys_lseek(int fildes, off_t offset, int whence) } } -int sys_fstat(int fd, struct stat *buf) +int sys_fstat(int fd, struct kernel_stat *buf) { try { + memset(buf, 0, sizeof(struct kernel_stat)); auto &obj = system_handle_to_object(fd); if (auto f = obj.as()) { diff --git a/lib/bsp/syscalls/syscalls.h b/lib/bsp/syscalls/syscalls.h index 8400951..9a0bb3d 100644 --- a/lib/bsp/syscalls/syscalls.h +++ b/lib/bsp/syscalls/syscalls.h @@ -23,9 +23,29 @@ extern "C" { #endif +struct kernel_stat +{ + unsigned long long st_dev; + unsigned long long st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned long long st_rdev; + unsigned long long __pad1; + long long st_size; + int st_blksize; + int __pad2; + long long st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + int __glibc_reserved[2]; +}; + int sys_open(const char *name, int flags, int mode); off_t sys_lseek(int fildes, off_t offset, int whence); -int sys_fstat(int fd, struct stat *buf); +int sys_fstat(int fd, struct kernel_stat *buf); #ifdef __cplusplus }