Skip to content

Commit f028aa1

Browse files
authored
Remove redundant __syscall_symlink. NFC (#23006)
We have `__syscall_symlinkat` so there is no need to also define `__syscall_symlink`. Also, remove the warnings from these `at` syscalls which are actually tested these days.
1 parent bc2123f commit f028aa1

File tree

6 files changed

+5
-31
lines changed

6 files changed

+5
-31
lines changed

src/library_sigs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ sigs = {
273273
__syscall_socket__sig: 'iiiiiii',
274274
__syscall_stat64__sig: 'ipp',
275275
__syscall_statfs64__sig: 'ippp',
276-
__syscall_symlink__sig: 'ipp',
277276
__syscall_symlinkat__sig: 'ipip',
278277
__syscall_truncate64__sig: 'ipj',
279278
__syscall_unlinkat__sig: 'iipi',

src/library_syscall.js

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,6 @@ var SyscallsLibrary = {
300300
}
301301
#endif // SYSCALLS_REQUIRE_FILESYSTEM
302302
},
303-
__syscall_symlink: (target, linkpath) => {
304-
target = SYSCALLS.getStr(target);
305-
linkpath = SYSCALLS.getStr(linkpath);
306-
FS.symlink(target, linkpath);
307-
return 0;
308-
},
309303
__syscall_fchmod: (fd, mode) => {
310304
FS.fchmod(fd, mode);
311305
return 0;
@@ -830,9 +824,6 @@ var SyscallsLibrary = {
830824
return FS.open(path, flags, mode).fd;
831825
},
832826
__syscall_mkdirat: (dirfd, path, mode) => {
833-
#if SYSCALL_DEBUG
834-
dbg('warning: untested syscall');
835-
#endif
836827
path = SYSCALLS.getStr(path);
837828
path = SYSCALLS.calculateAt(dirfd, path);
838829
// remove a trailing slash, if one - /a/b/ has basename of '', but
@@ -843,9 +834,6 @@ var SyscallsLibrary = {
843834
return 0;
844835
},
845836
__syscall_mknodat: (dirfd, path, mode, dev) => {
846-
#if SYSCALL_DEBUG
847-
dbg('warning: untested syscall');
848-
#endif
849837
path = SYSCALLS.getStr(path);
850838
path = SYSCALLS.calculateAt(dirfd, path);
851839
// we don't want this in the JS API as it uses mknod to create all nodes.
@@ -862,9 +850,6 @@ var SyscallsLibrary = {
862850
return 0;
863851
},
864852
__syscall_fchownat: (dirfd, path, owner, group, flags) => {
865-
#if SYSCALL_DEBUG
866-
dbg('warning: untested syscall');
867-
#endif
868853
path = SYSCALLS.getStr(path);
869854
var nofollow = flags & {{{ cDefs.AT_SYMLINK_NOFOLLOW }}};
870855
flags = flags & (~{{{ cDefs.AT_SYMLINK_NOFOLLOW }}});
@@ -906,11 +891,10 @@ var SyscallsLibrary = {
906891
FS.rename(oldpath, newpath);
907892
return 0;
908893
},
909-
__syscall_symlinkat: (target, newdirfd, linkpath) => {
910-
#if SYSCALL_DEBUG
911-
dbg('warning: untested syscall');
912-
#endif
913-
linkpath = SYSCALLS.calculateAt(newdirfd, linkpath);
894+
__syscall_symlinkat: (target, dirfd, linkpath) => {
895+
target = SYSCALLS.getStr(target);
896+
linkpath = SYSCALLS.getStr(linkpath);
897+
linkpath = SYSCALLS.calculateAt(dirfd, linkpath);
914898
FS.symlink(target, linkpath);
915899
return 0;
916900
},
@@ -937,9 +921,6 @@ var SyscallsLibrary = {
937921
return 0;
938922
},
939923
__syscall_faccessat: (dirfd, path, amode, flags) => {
940-
#if SYSCALL_DEBUG
941-
dbg('warning: untested syscall');
942-
#endif
943924
path = SYSCALLS.getStr(path);
944925
#if ASSERTIONS
945926
assert(flags === 0 || flags == {{{ cDefs.AT_EACCESS }}});

system/lib/libc/musl/arch/emscripten/bits/syscall.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define SYS_setsid __syscall_setsid
1515
#define SYS_setrlimit __syscall_setrlimit
1616
#define SYS_getrusage __syscall_getrusage
17-
#define SYS_symlink __syscall_symlink
1817
#define SYS_munmap __syscall_munmap
1918
#define SYS_fchmod __syscall_fchmod
2019
#define SYS_getpriority __syscall_getpriority

system/lib/libc/musl/arch/emscripten/syscall_arch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ int __syscall_getpgrp(void);
3131
int __syscall_setsid(void);
3232
int __syscall_setrlimit(int resource, intptr_t limit);
3333
int __syscall_getrusage(int who, intptr_t usage);
34-
int __syscall_symlink(intptr_t target, intptr_t linkpath);
3534
int __syscall_munmap(intptr_t addr, size_t len);
3635
int __syscall_fchmod(int fd, int mode);
3736
int __syscall_getpriority(int which, int who);

system/lib/wasmfs/js_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ int _wasmfs_unlink(char* path) {
151151
int _wasmfs_chdir(char* path) { return __syscall_chdir((intptr_t)path); }
152152

153153
int _wasmfs_symlink(char* old_path, char* new_path) {
154-
return __syscall_symlink((intptr_t)old_path, (intptr_t)new_path);
154+
return __syscall_symlinkat((intptr_t)old_path, AT_FDCWD, (intptr_t)new_path);
155155
}
156156

157157
intptr_t _wasmfs_readlink(char* path) {

system/lib/wasmfs/syscalls.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,10 +1095,6 @@ int __syscall_symlinkat(intptr_t target, int newdirfd, intptr_t linkpath) {
10951095
return 0;
10961096
}
10971097

1098-
int __syscall_symlink(intptr_t target, intptr_t linkpath) {
1099-
return __syscall_symlinkat(target, AT_FDCWD, linkpath);
1100-
}
1101-
11021098
// TODO: Test this with non-AT_FDCWD values.
11031099
int __syscall_readlinkat(int dirfd,
11041100
intptr_t path,

0 commit comments

Comments
 (0)