MAN page from OpenSuSE perl-Linux-Pid-0.04-5.1.x86_64.rpm
Section: User Contributed Perl Documentation (3)
Linux::Pid - Get the native PID and the PPID on Linux
use Linux::Pid; print Linux::Pid::getpid(), "\t", Linux::Pid::getppid(), "\n"; use Linux::Pid qw(getpid getppid); print getpid(), "\t", getppid(), "\n";
Why should one use a module to get the PID
and the PPID
of a processwhere there are the $$
variable and the "getppid()"
builtin ? (Notmentioning the equivalent "POSIX::getpid()"
In fact, this is useful on Linux, with multithreaded programs. Linux' Clibrary, using the linux thread model, returns different values of thePID and the PPID from different threads. (Other thread models such asNPTL don't have the same behaviour). This module forces perl to call theunderlying C functions "getpid()" and "getppid()".
Copyright (c) 2002-2007 Rafael Garcia-Suarez. All rights reserved. Thisprogram is free software; you can redistribute it and/or modify it underthe same terms as Perl itself.
This document was created byman2html,using the manual pages.