Skip to content

Commit

Permalink
Fix sys_stat
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnycase committed Nov 2, 2018
1 parent ec9db39 commit 03b7fcb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/bsp/syscalls/syscalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* limitations under the License.
*/
#include "syscalls.h"
#include <kernel/driver_impl.hpp>
#include <devices.h>
#include <filesystem.h>
#include <kernel/driver_impl.hpp>
#include <string.h>
#include <sys/unistd.h>
#include <sys/fcntl.h>
#include <sys/unistd.h>

using namespace sys;

Expand Down Expand Up @@ -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<filesystem_file>())
{
Expand Down
22 changes: 21 additions & 1 deletion lib/bsp/syscalls/syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 03b7fcb

Please sign in to comment.