Created
January 28, 2018 05:49
-
-
Save jvns/16c1ea69352a81658d6d8e9c5a289f2a to your computer and use it in GitHub Desktop.
This file contains 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
#include <mach/mach_init.h> | |
#include <mach/port.h> | |
#include <sys/wait.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
int main() { | |
for (;;) { | |
pid_t pid = fork(); | |
if (pid == 0) execv("/usr/bin/true", NULL); | |
mach_port_name_t task = MACH_PORT_NULL; | |
task_for_pid(mach_task_self(), pid, &task); | |
printf("Ran task_for_pid\n"); | |
int wait_status; | |
wait(&wait_status); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment