-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Use correct data types in syscall layer. NFC #27108
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
Open
kleisauke
wants to merge
7
commits into
emscripten-core:main
Choose a base branch
from
kleisauke:correct-syscall-data-types
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1b61cc8
Use correct data types in syscall layer. NFC
kleisauke b366d11
Automatic rebaseline of signature info. NFC
kleisauke 3dbfd72
Automatic rebaseline of codesize expectations. NFC
kleisauke e71de6b
[wasm64] Keep nfds_t 32-bit. NFC
kleisauke aaf68d2
Merge branch 'main' into correct-syscall-data-types
kleisauke bab5b44
Merge branch 'main' into correct-syscall-data-types
kleisauke 5da1765
Remove redundant cast
kleisauke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,10 +25,10 @@ | |
| #include <emscripten/version.h> | ||
| #include <emscripten/stack.h> | ||
|
|
||
| static int g_pid = 42; | ||
| static int g_pgid = 42; | ||
| static int g_ppid = 1; | ||
| static int g_sid = 42; | ||
| static pid_t g_pid = 42; | ||
| static pid_t g_pgid = 42; | ||
| static pid_t g_ppid = 1; | ||
| static pid_t g_sid = 42; | ||
|
|
||
| #ifdef NDEBUG | ||
| #define REPORT(name) | ||
|
|
@@ -68,7 +68,7 @@ weak int __syscall_uname(intptr_t buf) { | |
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_setpgid(int pid, int pgid) { | ||
| weak int __syscall_setpgid(pid_t pid, pid_t pgid) { | ||
| if (pid && pid != g_pid) { | ||
| return -ESRCH; | ||
| } | ||
|
|
@@ -82,41 +82,41 @@ weak int __syscall_sync() { | |
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_getsid(int pid) { | ||
| weak pid_t __syscall_getsid(pid_t pid) { | ||
| if (pid && pid != g_pid) { | ||
| return -ESRCH; | ||
| } | ||
| return g_sid; | ||
| } | ||
|
|
||
| weak int __syscall_getpgid(int pid) { | ||
| weak pid_t __syscall_getpgid(pid_t pid) { | ||
| if (pid && pid != g_pid) { | ||
| return -ESRCH; | ||
| } | ||
| return g_pgid; | ||
| } | ||
|
|
||
| weak int __syscall_getpid() { | ||
| weak pid_t __syscall_getpid() { | ||
| return g_pid; | ||
| } | ||
|
|
||
| weak int __syscall_getppid() { | ||
| weak pid_t __syscall_getppid() { | ||
| return g_ppid; | ||
| } | ||
|
|
||
| weak int __syscall_linkat(int olddirfd, intptr_t oldpath, int newdirfd, intptr_t newpath, int flags) { | ||
| return -EMLINK; // no hardlinks for us | ||
| } | ||
|
|
||
| weak int __syscall_getgroups32(int size, intptr_t list) { | ||
| if (size < 1) { | ||
| weak int __syscall_getgroups32(int count, intptr_t list) { | ||
| if (count < 1) { | ||
| return -EINVAL; | ||
| } | ||
| ((gid_t*)list)[0] = 0; | ||
| return 1; | ||
| } | ||
|
|
||
| weak int __syscall_setsid() { | ||
| weak pid_t __syscall_setsid() { | ||
| return 0; // no-op | ||
| } | ||
|
|
||
|
|
@@ -137,31 +137,31 @@ weak int __syscall_getrusage(int who, intptr_t usage) { | |
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_getpriority(int which, int who) { | ||
| weak int __syscall_getpriority(int which, id_t who) { | ||
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_setpriority(int which, int who, int prio) { | ||
| weak int __syscall_setpriority(int which, id_t who, int prio) { | ||
| return -EPERM; | ||
| } | ||
|
|
||
| weak int __syscall_setdomainname(intptr_t name, size_t size) { | ||
| return -EPERM; | ||
| } | ||
|
|
||
| weak int __syscall_getuid32(void) { | ||
| weak uid_t __syscall_getuid32(void) { | ||
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_getgid32(void) { | ||
| weak gid_t __syscall_getgid32(void) { | ||
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_geteuid32(void) { | ||
| weak uid_t __syscall_geteuid32(void) { | ||
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_getegid32(void) { | ||
| weak gid_t __syscall_getegid32(void) { | ||
| return 0; | ||
| } | ||
|
|
||
|
|
@@ -221,7 +221,7 @@ weak int __syscall_munlockall() { | |
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_prlimit64(int pid, int resource, intptr_t new_limit, intptr_t old_limit) { | ||
| weak int __syscall_prlimit64(pid_t pid, int resource, intptr_t new_limit, intptr_t old_limit) { | ||
| REPORT(prlimit64); | ||
| struct rlimit *old = (struct rlimit *)old_limit; | ||
| if (new_limit) { | ||
|
|
@@ -248,15 +248,19 @@ weak int __syscall_prlimit64(int pid, int resource, intptr_t new_limit, intptr_t | |
| return 0; | ||
| } | ||
|
|
||
| weak int __syscall_setsockopt(int sockfd, int level, int optname, intptr_t optval, size_t optlen, int dummy) { | ||
| weak int __syscall_setsockopt(int sockfd, int level, int optname, intptr_t optval, socklen_t optlen, int dummy) { | ||
| REPORT(setsockopt); | ||
| return -ENOPROTOOPT; // The option is unknown at the level indicated. | ||
| } | ||
|
|
||
| weak pid_t __syscall_wait4(pid_t pid, intptr_t wstatus, int options, int rusage) { | ||
| REPORT(wait4); | ||
| return -1; | ||
| } | ||
|
|
||
| UNIMPLEMENTED(acct, (intptr_t filename)) | ||
| UNIMPLEMENTED(mincore, (intptr_t addr, size_t length, intptr_t vec)) | ||
| UNIMPLEMENTED(recvmmsg, (int sockfd, intptr_t msgvec, size_t vlen, int flags, ...)) | ||
| UNIMPLEMENTED(sendmmsg, (int sockfd, intptr_t msgvec, size_t vlen, int flags, ...)) | ||
| UNIMPLEMENTED(recvmmsg, (int sockfd, intptr_t msgvec, unsigned int vlen, unsigned int flags, ...)) | ||
| UNIMPLEMENTED(sendmmsg, (int sockfd, intptr_t msgvec, unsigned int vlen, unsigned int flags, ...)) | ||
| UNIMPLEMENTED(shutdown, (int sockfd, int how, int dummy, int dummy2, int dummy3, int dummy4)) | ||
| UNIMPLEMENTED(socketpair, (int domain, int type, int protocol, intptr_t fds, int dummy, int dummy2)) | ||
| UNIMPLEMENTED(wait4,(int pid, intptr_t wstatus, int options, int rusage)) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why change this?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did these syscalls work under wasm64 before if the type of arg 3 was not
p?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait.. I see
socklet_tis acually smaller than size_t.. that is good. One less pointer conversion.