···518518 };
519519 // Sleep for 1ms
520520 __linux_nanosleep(&tv, &tv);
521521+522522+ // TODO: we could implement this with yield_to() in LKM
521523 return KERN_SUCCESS;
522524}
523525
+13-14
src/kernel/emulation/linux/process/wait4.c
···33#include "../errno.h"
44#include "../signal/duct_signals.h"
55#include "../misc/ptrace.h"
66+#include "../mach/lkm.h"
77+#include "../../../../lkm/api.h"
68#include <sys/signal.h>
79#include <stddef.h>
810#include <linux-syscalls/linux.h>
···3941 signal = signum_linux_to_bsd(signal);
4042 *status = (*status & 0x7f) | (signal << 8);
41434242- switch (signal)
4444+ if (lkm_call(NR_get_tracer, (void*)(long) ret) == getpid())
4345 {
4444- case SIGCONT:
4545- case SIGSTOP:
4646- case SIGTSTP:
4747- case SIGTTIN:
4848- case SIGTTOU:
4949- // It is standard behavior that these signals stop (resume) the process
5050- break;
5151- default:
5252- // We are probably ptracing the target process.
5353- // Allow the execution to continue so that the ptraced process can translate
5454- // the signal into a Mach message.
5555- sys_ptrace(PT_CONTINUE, ret, NULL, signal);
5656- goto restart;
4646+ // We are ptracing the target process.
4747+ // Allow the execution to continue so that the ptraced process can translate
4848+ // the signal into a Mach message.
4949+ if (signal == SIGSTOP)
5050+ {
5151+ // TODO: notify target process it has been SIGSTOP'ed via sigqueue
5252+ }
5353+5454+ sys_ptrace(PT_CONTINUE, ret, NULL, signal);
5555+ goto restart;
5756 }
5857 }
5958