Skip to content

Commit e7883d5

Browse files
authored
Include support for euidaccess/eaccess (#22455)
Fixes: #22392
1 parent 646bc43 commit e7883d5

9 files changed

+21
-3
lines changed

src/library_syscall.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ var SyscallsLibrary = {
950950
#endif
951951
path = SYSCALLS.getStr(path);
952952
#if ASSERTIONS
953-
assert(flags === 0);
953+
assert(flags === 0 || flags == {{{ cDefs.AT_EACCESS }}});
954954
#endif
955955
path = SYSCALLS.calculateAt(dirfd, path);
956956
if (amode & ~{{{ cDefs.S_IRWXO }}}) {

src/struct_info.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
"F_DUPFD",
100100
"F_SETLK",
101101
"O_WRONLY",
102+
"AT_EACCESS",
102103
"AT_FDCWD",
103104
"AT_SYMLINK_NOFOLLOW",
104105
"AT_REMOVEDIR",

src/struct_info_generated.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"AL_VELOCITY": 4102,
4040
"ATOMICS_WAIT_NOT_EQUAL": 1,
4141
"ATOMICS_WAIT_TIMED_OUT": 2,
42+
"AT_EACCESS": 512,
4243
"AT_EMPTY_PATH": 4096,
4344
"AT_FDCWD": -100,
4445
"AT_NO_AUTOMOUNT": 2048,

src/struct_info_generated_wasm64.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"AL_VELOCITY": 4102,
4040
"ATOMICS_WAIT_NOT_EQUAL": 1,
4141
"ATOMICS_WAIT_TIMED_OUT": 2,
42+
"AT_EACCESS": 512,
4243
"AT_EMPTY_PATH": 4096,
4344
"AT_FDCWD": -100,
4445
"AT_NO_AUTOMOUNT": 2048,
File renamed without changes.

test/other/test_euidaccess.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#define _GNU_SOURCE
2+
3+
#include <unistd.h>
4+
#include <stdio.h>
5+
6+
int main() {
7+
printf("eaccess:%d\n", eaccess(".", F_OK));
8+
printf("euidaccess:%d\n", euidaccess(".", F_OK));
9+
return 0;
10+
}

test/other/test_euidaccess.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eaccess:0
2+
euidaccess:0

test/test_other.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12407,7 +12407,10 @@ def test_deterministic(self):
1240712407
self.assertIdentical(one, two)
1240812408

1240912409
def test_err(self):
12410-
self.do_other_test('test_err.cpp')
12410+
self.do_other_test('test_err.c')
12411+
12412+
def test_euidaccess(self):
12413+
self.do_other_test('test_euidaccess.c')
1241112414

1241212415
def test_shared_flag(self):
1241312416
# Test that `-shared` flag causes object file generation but gives a warning

tools/system_libs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ def get_files(self):
12351235
])
12361236
libc_files += files_in_path(
12371237
path='system/lib/libc/musl/src/legacy',
1238-
filenames=['getpagesize.c', 'err.c'])
1238+
filenames=['getpagesize.c', 'err.c', 'euidaccess.c'])
12391239

12401240
libc_files += files_in_path(
12411241
path='system/lib/libc/musl/src/linux',

0 commit comments

Comments
 (0)