Subject: | Proc::ProcessTable not thread safe on linux |
While using the excellent Proc::ProcessTable on many os/arch
combinations, we ran into some Linux issues. Namely, crashes caused by
thread-safety issues and large on-stack allocations. So we decided to go
ahead and fix those and send them upstream.
When you look at the diff you'll see there are quite a few changes.
Almost all the allocations now are done using heap (glib's obstacks)
instead on the process/thread stack ... reducing the likelihood of
blocking the stack. In addition to making the Linux bits thread safe I
made sure all the strings & pointers to them were stored in the
read-only data section. This will reduce relocation on load and reduce
the size of the writable data section.
Please note I also got rid of the magic hertz calculation code. I
noticed that it looks looks like the code was original taken from
procps, which is GPL licensed. The readme specifies that
Proc::ProcessTable is licensed under the Perl license. Instead I choose
to rely on the sysconf(_SC_CLK_TCK) POSIX behavior (ideally glibc does
the right thing internal).
I hope the fixes are beneficial for the Linux portion of Proc::ProcessTable.
-- Milosz
Subject: | proc-process-table-linux-improvements.patch |
Message body is not shown because it is too large.