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:788–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

786}
787#elif defined(__APPLE__)
788static bool bootstrap_darwin_spawn_state_init(posix_spawn_file_actions_t *actions,
789 posix_spawnattr_t *attributes) {
790 if (posix_spawn_file_actions_init(actions) != 0) {
791 return false;
792 }
793 bool actions_ready =
794 posix_spawn_file_actions_addopen(actions, STDIN_FILENO, "/dev/null", O_RDWR, 0) == 0 &&
795 posix_spawn_file_actions_addopen(actions, STDOUT_FILENO, "/dev/null", O_RDWR, 0) == 0 &&
796 posix_spawn_file_actions_addopen(actions, STDERR_FILENO, "/dev/null", O_RDWR, 0) == 0;
797 if (!actions_ready) {
798 (void)posix_spawn_file_actions_destroy(actions);
799 return false;
800 }
801 if (posix_spawnattr_init(attributes) != 0) {
802 (void)posix_spawn_file_actions_destroy(actions);
803 return false;
804 }
805 sigset_t empty;
806 (void)sigemptyset(&empty);
807 short flags = POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSID | POSIX_SPAWN_CLOEXEC_DEFAULT;
808 if (posix_spawnattr_setsigmask(attributes, &empty) != 0 ||
809 posix_spawnattr_setflags(attributes, flags) != 0) {
810 (void)posix_spawnattr_destroy(attributes);
811 (void)posix_spawn_file_actions_destroy(actions);
812 return false;
813 }
814 return true;
815}
816
817typedef struct {
818 pid_t pid;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected