Skip to content

Commit

Permalink
Include support for euidaccess/eaccess (#22455)
Browse files Browse the repository at this point in the history
Fixes: #22392
  • Loading branch information
sbc100 committed Aug 27, 2024
1 parent 646bc43 commit e7883d5
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/library_syscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ var SyscallsLibrary = {
#endif
path = SYSCALLS.getStr(path);
#if ASSERTIONS
assert(flags === 0);
assert(flags === 0 || flags == {{{ cDefs.AT_EACCESS }}});
#endif
path = SYSCALLS.calculateAt(dirfd, path);
if (amode & ~{{{ cDefs.S_IRWXO }}}) {
Expand Down
1 change: 1 addition & 0 deletions src/struct_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"F_DUPFD",
"F_SETLK",
"O_WRONLY",
"AT_EACCESS",
"AT_FDCWD",
"AT_SYMLINK_NOFOLLOW",
"AT_REMOVEDIR",
Expand Down
1 change: 1 addition & 0 deletions src/struct_info_generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"AL_VELOCITY": 4102,
"ATOMICS_WAIT_NOT_EQUAL": 1,
"ATOMICS_WAIT_TIMED_OUT": 2,
"AT_EACCESS": 512,
"AT_EMPTY_PATH": 4096,
"AT_FDCWD": -100,
"AT_NO_AUTOMOUNT": 2048,
Expand Down
1 change: 1 addition & 0 deletions src/struct_info_generated_wasm64.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"AL_VELOCITY": 4102,
"ATOMICS_WAIT_NOT_EQUAL": 1,
"ATOMICS_WAIT_TIMED_OUT": 2,
"AT_EACCESS": 512,
"AT_EMPTY_PATH": 4096,
"AT_FDCWD": -100,
"AT_NO_AUTOMOUNT": 2048,
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions test/other/test_euidaccess.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#define _GNU_SOURCE

#include <unistd.h>
#include <stdio.h>

int main() {
printf("eaccess:%d\n", eaccess(".", F_OK));
printf("euidaccess:%d\n", euidaccess(".", F_OK));
return 0;
}
2 changes: 2 additions & 0 deletions test/other/test_euidaccess.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eaccess:0
euidaccess:0
5 changes: 4 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -12407,7 +12407,10 @@ def test_deterministic(self):
self.assertIdentical(one, two)

def test_err(self):
self.do_other_test('test_err.cpp')
self.do_other_test('test_err.c')

def test_euidaccess(self):
self.do_other_test('test_euidaccess.c')

def test_shared_flag(self):
# Test that `-shared` flag causes object file generation but gives a warning
Expand Down
2 changes: 1 addition & 1 deletion tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ def get_files(self):
])
libc_files += files_in_path(
path='system/lib/libc/musl/src/legacy',
filenames=['getpagesize.c', 'err.c'])
filenames=['getpagesize.c', 'err.c', 'euidaccess.c'])

libc_files += files_in_path(
path='system/lib/libc/musl/src/linux',
Expand Down

0 comments on commit e7883d5

Please sign in to comment.