add framework to support archs without a native wait4 syscall

this commit should make no codegen change for existing archs, but is a
prerequisite for new archs including riscv32. the wait4 emulation
backend provides both cancellable and non-cancellable variants because
waitpid is required to be a cancellation point, but all of our other
uses are not, and most of them cannot be.

based on patch by Stefan O'Rear.
This commit is contained in:
Rich Felker committed 2024-02-22 18:50:34 -05:00
1 parent 7020e85fd7
commit 19563e1850
6 files changed
+71 -4

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ pid_t wait4(pid_t pid, int *status, int options, struct rusage *ru)
}
#endif
char *dest = ru ? (char *)&ru->ru_maxrss - 4*sizeof(long) : 0;
r = __syscall(SYS_wait4, pid, status, options, dest);
r = __sys_wait4(pid, status, options, dest);
if (r>0 && ru && sizeof(time_t) > sizeof(long)) {
long kru[4];
memcpy(kru, dest, 4*sizeof(long));