feat: add jobctlfg and jobtarget

This commit is contained in:
dualfroz committed 2026-09-08 23:28:34 +02:00
1 parent 7f4eb8bfa4
commit a8819f99c6
3 files changed
+167

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#include "ulib.h"
/*
* Only ever spawned by killtest.c. Attaches as the READ end of a shared
* pipe (userPipeCreate/userPipeAttach) that no writer will ever attach to,
* so the userRead call below can only ever return by being killed --
* proving threadKill (sched.c) genuinely recovers a process that would
* otherwise be stuck forever now that sysRead can really block (see
* pipe.h/vfs.h's shared-pipe machinery, added the same wave as this).
*/
int main(void)
{
print("killvictim: start, pid=");
printDec(userGetpid());
print("\n");
long handle = userPipeCreate();
if (handle < 0) {
print("killvictim: FAIL pipe create\n");
return 1;
}
long fd = userPipeAttach(handle, 0);
if (fd < 0) {
print("killvictim: FAIL attach\n");
return 1;
}
print("killvictim: blocking on read forever\n");
char buffer[4];
userRead((int)fd, buffer, sizeof(buffer));
/* Only reached if userRead somehow returned on its own -- killtest.c
never writes to this pipe, so that would itself be a bug. */
print("killvictim: FAIL read returned without being killed\n");
return 1;
}