Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace SYSCALLS.doStat with SYSCALLS.writeStat NFC #23242

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/library_syscall.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ var SyscallsLibrary = {
return dir + '/' + path;
},

doStat(func, path, buf) {
var stat = func(path);
writeStat(buf, stat) {
{{{ makeSetValue('buf', C_STRUCTS.stat.st_dev, 'stat.dev', 'i32') }}};
{{{ makeSetValue('buf', C_STRUCTS.stat.st_mode, 'stat.mode', 'i32') }}};
{{{ makeSetValue('buf', C_STRUCTS.stat.st_nlink, 'stat.nlink', SIZE_TYPE) }}};
Expand Down Expand Up @@ -672,15 +671,15 @@ var SyscallsLibrary = {
},
__syscall_stat64: (path, buf) => {
path = SYSCALLS.getStr(path);
return SYSCALLS.doStat(FS.stat, path, buf);
return SYSCALLS.writeStat(buf, FS.stat(path));
},
__syscall_lstat64: (path, buf) => {
path = SYSCALLS.getStr(path);
return SYSCALLS.doStat(FS.lstat, path, buf);
return SYSCALLS.writeStat(buf, FS.lstat(path));
},
__syscall_fstat64: (fd, buf) => {
var stream = SYSCALLS.getStreamFromFD(fd);
return SYSCALLS.doStat(FS.stat, stream.path, buf);
return SYSCALLS.writeStat(buf, FS.stat(stream.path));
},
__syscall_fchown32: (fd, owner, group) => {
FS.fchown(fd, owner, group);
Expand Down Expand Up @@ -872,7 +871,7 @@ var SyscallsLibrary = {
assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`);
#endif
path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf);
return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path));
},
__syscall_unlinkat: (dirfd, path, flags) => {
path = SYSCALLS.getStr(path);
Expand Down
Loading