Update rbtrace.c

Added definitions for PLATFORM (PLATFORM_FREEBSD, PLATFORM_LINUX) on lines 44-50.

Added setpgid(0,0); command for FreeBSD which should also be fine using Linux (except CentOS I am not sure) on lines 967 to 972. In this case I left the old command setpgrp(); for linux just in case. But in theory using 'setpgid(0,0);' should work on all platforms according to all documentation I've run into.

Anyway all the documentation for FreeBSD and Linux & other say:

 The call setpgrp() is equivalent to setpgid(0,0).

Please do check and Test. :-)
parent 5c69d77e
......@@ -40,6 +40,16 @@
#define RSTRING_LEN(str) RSTRING(str)->len
#ifdef __FreeBSD__
#ifdef __linux__
static uint64_t
......@@ -953,7 +963,14 @@ rbtrace__process_event(msgpack_object cmd)
if (outer == 0) {
rb_eval_string_protect("$0 = \"[DEBUG] #{Process.ppid}\"", 0);
// The call setpgrp() is equivalent to setpgid(0,0).
pid_t inner = fork();
if (inner == 0) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment