mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:28:12 +00:00
Kernel+LibC: Merge sys$stat() and sys$lstat()
There is now only one sys$stat() instead of two separate syscalls.
This commit is contained in:
parent
b67035c3ac
commit
580a94bc44
4 changed files with 24 additions and 35 deletions
|
@ -278,24 +278,25 @@ int close(int fd)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int lstat(const char* path, struct stat* statbuf)
|
||||
static int do_stat(const char* path, struct stat* statbuf, bool follow_symlinks)
|
||||
{
|
||||
if (!path) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
int rc = syscall(SC_lstat, path, strlen(path), statbuf);
|
||||
Syscall::SC_stat_params params { { path, strlen(path) }, statbuf, follow_symlinks };
|
||||
int rc = syscall(SC_stat, ¶ms);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int lstat(const char* path, struct stat* statbuf)
|
||||
{
|
||||
return do_stat(path, statbuf, false);
|
||||
}
|
||||
|
||||
int stat(const char* path, struct stat* statbuf)
|
||||
{
|
||||
if (!path) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
int rc = syscall(SC_stat, path, strlen(path), statbuf);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
return do_stat(path, statbuf, true);
|
||||
}
|
||||
|
||||
int fstat(int fd, struct stat* statbuf)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue