static int run_exec_pgroup(Ruby runtime, ExecArg eargp, ExecArg sargp, String[] errmsg) { /* * If FD_CLOEXEC is available, rb_fork waits the child's execve. * So setpgid is done in the child when rb_fork is returned in the parent. * No race condition, even without setpgid from the parent. * (Is there an environment which has setpgid but no FD_CLOEXEC?) */ int ret = 0; long pgroup; pgroup = eargp.pgroup_pgid; if (pgroup == -1) { // inherit parent's process group (default behavior) return ret; } eargp.attributes.add(SpawnAttribute.pgroup(pgroup)); eargp.attributes.add(SpawnAttribute.flags((short)SpawnAttribute.SETPGROUP)); return ret; }
private Pointer nativeSpawnAttributes(Collection<? extends SpawnAttribute> spawnAttributes) { Pointer nativeSpawnAttributes = allocatePosixSpawnattr(); ((UnixLibC) libc()).posix_spawnattr_init(nativeSpawnAttributes); for (SpawnAttribute action : spawnAttributes) { action.set(this, nativeSpawnAttributes); } return nativeSpawnAttributes; }
private Pointer nativeSpawnAttributes(Collection<? extends SpawnAttribute> spawnAttributes) { Pointer nativeSpawnAttributes = Memory.allocateDirect(getRuntime(), 128); ((UnixLibC) libc()).posix_spawnattr_init(nativeSpawnAttributes); for (SpawnAttribute action : spawnAttributes) { action.set(this, nativeSpawnAttributes); } return nativeSpawnAttributes; }
static int run_exec_pgroup(Ruby runtime, ExecArg eargp, ExecArg sargp, String[] errmsg) { /* * If FD_CLOEXEC is available, rb_fork waits the child's execve. * So setpgid is done in the child when rb_fork is returned in the parent. * No race condition, even without setpgid from the parent. * (Is there an environment which has setpgid but no FD_CLOEXEC?) */ int ret = 0; long pgroup; pgroup = eargp.pgroup_pgid; if (pgroup == -1) { // inherit parent's process group (default behavior) return ret; } eargp.attributes.add(SpawnAttribute.pgroup(pgroup)); eargp.attributes.add(SpawnAttribute.flags((short)SpawnAttribute.SETPGROUP)); return ret; }
private Pointer nativeSpawnAttributes(Collection<? extends SpawnAttribute> spawnAttributes) { Pointer nativeSpawnAttributes = Memory.allocateDirect(getRuntime(), 128); ((UnixLibC) libc()).posix_spawnattr_init(nativeSpawnAttributes); for (SpawnAttribute action : spawnAttributes) { action.set(this, nativeSpawnAttributes); } return nativeSpawnAttributes; }