mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 15:34:31 +00:00
feat(userspace/libc): implement fstat()
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
08319ef4c7
commit
c83c542f5b
@ -87,7 +87,7 @@ extern "C"
|
||||
int chmod(const char *, mode_t);
|
||||
int fchmod(int, mode_t);
|
||||
int fchmodat(int, const char *, mode_t, int);
|
||||
int fstat(int, struct stat *);
|
||||
int fstat(int fildes, struct stat *buf);
|
||||
int fstatat(int, const char *restrict, struct stat *restrict, int);
|
||||
int futimens(int, const struct timespec[2]);
|
||||
int lstat(const char *restrict, struct stat *restrict);
|
||||
|
@ -22,7 +22,25 @@
|
||||
export int chmod(const char *, mode_t);
|
||||
export int fchmod(int, mode_t);
|
||||
export int fchmodat(int, const char *, mode_t, int);
|
||||
export int fstat(int, struct stat *);
|
||||
|
||||
export int fstat(int fildes, struct stat *buf)
|
||||
{
|
||||
if (fildes < 0)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int result = call_fstat(fildes, buf);
|
||||
if (result == -1)
|
||||
{
|
||||
errno = result;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
export int fstatat(int, const char *restrict, struct stat *restrict, int);
|
||||
export int futimens(int, const struct timespec[2]);
|
||||
export int lstat(const char *restrict, struct stat *restrict);
|
||||
|
Loading…
x
Reference in New Issue
Block a user