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

Source from the content-addressed store, hash-verified

1192}
1193#elif defined(__APPLE__)
1194static bool bootstrap_darwin_spawn_state_init(posix_spawn_file_actions_t *actions,
1195 posix_spawnattr_t *attributes) {
1196 if (posix_spawn_file_actions_init(actions) != 0) {
1197 return false;
1198 }
1199 bool actions_ready =
1200 posix_spawn_file_actions_addopen(actions, STDIN_FILENO, "/dev/null", O_RDWR, 0) == 0 &&
1201 posix_spawn_file_actions_addopen(actions, STDOUT_FILENO, "/dev/null", O_RDWR, 0) == 0 &&
1202 posix_spawn_file_actions_addopen(actions, STDERR_FILENO, "/dev/null", O_RDWR, 0) == 0;
1203 if (!actions_ready) {
1204 (void)posix_spawn_file_actions_destroy(actions);
1205 return false;
1206 }
1207 if (posix_spawnattr_init(attributes) != 0) {
1208 (void)posix_spawn_file_actions_destroy(actions);
1209 return false;
1210 }
1211 sigset_t empty;
1212 (void)sigemptyset(&empty);
1213 short flags = POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSID | POSIX_SPAWN_CLOEXEC_DEFAULT;
1214 if (posix_spawnattr_setsigmask(attributes, &empty) != 0 ||
1215 posix_spawnattr_setflags(attributes, flags) != 0) {
1216 (void)posix_spawnattr_destroy(attributes);
1217 (void)posix_spawn_file_actions_destroy(actions);
1218 return false;
1219 }
1220 return true;
1221}
1222
1223typedef struct {
1224 pid_t pid;

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected