mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:17:34 +00:00
Kernel+LibC+LibCore+UserspaceEmulator: Implement faccessat(2)
Co-Authored-By: Daniel Bertalan <dani@danielbertalan.dev>
This commit is contained in:
parent
fa692e13f9
commit
2a502fe232
13 changed files with 89 additions and 39 deletions
|
@ -798,12 +798,20 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
|
|||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html
|
||||
int access(char const* pathname, int mode)
|
||||
{
|
||||
return faccessat(AT_FDCWD, pathname, mode, 0);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html
|
||||
int faccessat(int dirfd, char const* pathname, int mode, int flags)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
int rc = syscall(SC_access, pathname, strlen(pathname), mode);
|
||||
|
||||
Syscall::SC_faccessat_params params { dirfd, { pathname, strlen(pathname) }, mode, flags };
|
||||
int rc = syscall(SC_faccessat, ¶ms);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ int pipe(int pipefd[2]);
|
|||
int pipe2(int pipefd[2], int flags);
|
||||
unsigned int alarm(unsigned int seconds);
|
||||
int access(char const* pathname, int mode);
|
||||
int faccessat(int dirfd, char const* pathname, int mode, int flags);
|
||||
int isatty(int fd);
|
||||
int mknod(char const* pathname, mode_t, dev_t);
|
||||
long fpathconf(int fd, int name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue