Skip to content

Instantly share code, notes, and snippets.

Created Jan 28, 2018
What would you like to do?
#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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment