[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#753641: ITP: liblinux-pid-perl -- wrapper around the getpid() and getppid() C functions



Hi!

On Fri, 2014-07-04 at 12:21:15 +0200, gregor herrmann wrote:
> On Fri, 04 Jul 2014 10:09:12 +0200, Guillem Jover wrote:
> > With glibc and NPTL this module does not seem to make much sense, as
> > each different thread will have the same PID. If it was exposing the
> > Linux gettid() syscall then it would be the modern equivalent, but
> > that depends on the assumptions from the call sites and the expected
> > threading model, I suppose.
> > 
> > I guess this is just a dependency from something else? Why not patch
> > it to use the native perl functions instead?
> 
> Right, as noted in the third paragraph of the description, mod_perl
> wants it:
> https://bugs.debian.org/684290
> https://lists.debian.org/debian-perl/2014/07/msg00002.html ff.

> gregor, not opposed to a mod_perl patch as an alternative

Ok, so how about this non-tested patch? The test suite might need
patching too, but as I guess it was either not failing or being
ignored currently, I didn't touch it.

Thanks,
Guillem
Description: Fallback to use native perl getppid() if Linux::Pid is not present
Author: Guillem Jover <guillem@debian.org>
Origin: vendor
Bug-Debian: http://bugs.debian.org/684290
Forwarded: no
Last-Update: 2014-07-04


--- libapache2-mod-perl2-2.0.8+httpd24-r1449661.orig/Apache-SizeLimit/lib/Apache/SizeLimit/Core.pm
+++ libapache2-mod-perl2-2.0.8+httpd24-r1449661/Apache-SizeLimit/lib/Apache/SizeLimit/Core.pm
@@ -139,10 +139,12 @@ BEGIN {
         *_platform_getppid = \&_perl_getppid;
     }
     elsif ($Config{'osname'} eq 'linux') {
-        _load('Linux::Pid');
-
-        *_platform_getppid = \&_linux_getppid;
-
+        if (eval { require Linux::Pid }) {
+            *_platform_getppid = \&_linux_getppid;
+        }
+        else {
+            *_platform_getppid = \&_perl_getppid;
+        }
         if (eval { require Linux::Smaps && Linux::Smaps->new($$) }) {
             $USE_SMAPS = 1;
             *_platform_check_size = \&_linux_smaps_size_check;

Reply to: