MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / bootstrap_darwin_spawn_state_init

Function bootstrap_darwin_spawn_state_init

src/daemon/bootstrap.c:819–846  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

817}
818#elif defined(__APPLE__)
819static bool bootstrap_darwin_spawn_state_init(posix_spawn_file_actions_t *actions,
820 posix_spawnattr_t *attributes) {
821 if (posix_spawn_file_actions_init(actions) != 0) {
822 return false;
823 }
824 bool actions_ready =
825 posix_spawn_file_actions_addopen(actions, STDIN_FILENO, "/dev/null", O_RDWR, 0) == 0 &&
826 posix_spawn_file_actions_addopen(actions, STDOUT_FILENO, "/dev/null", O_RDWR, 0) == 0 &&
827 posix_spawn_file_actions_addopen(actions, STDERR_FILENO, "/dev/null", O_RDWR, 0) == 0;
828 if (!actions_ready) {
829 (void)posix_spawn_file_actions_destroy(actions);
830 return false;
831 }
832 if (posix_spawnattr_init(attributes) != 0) {
833 (void)posix_spawn_file_actions_destroy(actions);
834 return false;
835 }
836 sigset_t empty;
837 (void)sigemptyset(&empty);
838 short flags = POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSID | POSIX_SPAWN_CLOEXEC_DEFAULT;
839 if (posix_spawnattr_setsigmask(attributes, &empty) != 0 ||
840 posix_spawnattr_setflags(attributes, flags) != 0) {
841 (void)posix_spawnattr_destroy(attributes);
842 (void)posix_spawn_file_actions_destroy(actions);
843 return false;
844 }
845 return true;
846}
847
848typedef struct {
849 pid_t pid;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected