1Pid(3) User Contributed Perl Documentation Pid(3)
2
3
4
6 Linux::Pid - Get the native PID and the PPID on Linux
7
9 use Linux::Pid;
10 print Linux::Pid::getpid(), "\t", Linux::Pid::getppid(), "\n";
11
12 use Linux::Pid qw(getpid getppid);
13 print getpid(), "\t", getppid(), "\n";
14
16 Why should one use a module to get the PID and the PPID of a process
17 where there are the $$ variable and the "getppid()" builtin ? (Not
18 mentioning the equivalent "POSIX::getpid()" and "POSIX::getppid()"
19 functions.)
20
21 In fact, this is useful on Linux, with multithreaded programs. Linux' C
22 library, using the linux thread model, returns different values of the
23 PID and the PPID from different threads. (Other thread models such as
24 NPTL don't have the same behaviour). This module forces perl to call
25 the underlying C functions "getpid()" and "getppid()".
26
28 Copyright (c) 2002-2007 Rafael Garcia-Suarez. All rights reserved. This
29 program is free software; you can redistribute it and/or modify it
30 under the same terms as Perl itself.
31
32
33
34perl v5.34.0 2022-01-21 Pid(3)