MCPcopy Create free account
hub / github.com/ioi/isolate / box_proxy

Function box_proxy

isolate.c:964–999  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

962}
963
964static int
965box_proxy(void *arg)
966{
967 char **args = arg;
968
969 write_errors_to_fd = error_pipes[1];
970 close(error_pipes[0]);
971 close(status_pipes[0]);
972 meta_close();
973 lock_close();
974 reset_signals();
975
976 pid_t inside_pid = fork();
977 if (inside_pid < 0)
978 die("Cannot run process, fork failed: %m");
979 else if (!inside_pid)
980 {
981 close(status_pipes[1]);
982 box_inside(args);
983 _exit(42); // We should never get here
984 }
985
986 setup_orig_credentials();
987 if (write(status_pipes[1], &inside_pid, sizeof(inside_pid)) != sizeof(inside_pid))
988 die("Proxy write to pipe failed: %m");
989
990 int stat;
991 pid_t p = waitpid(inside_pid, &stat, 0);
992 if (p < 0)
993 die("Proxy waitpid() failed: %m");
994
995 if (write(status_pipes[1], &stat, sizeof(stat)) != sizeof(stat))
996 die("Proxy write to pipe failed: %m");
997
998 _exit(0);
999}
1000
1001static void
1002box_init(void)

Callers

nothing calls this directly

Calls 5

meta_closeFunction · 0.85
lock_closeFunction · 0.85
reset_signalsFunction · 0.85
box_insideFunction · 0.85
setup_orig_credentialsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…