Linux::Pid(3pm)

Linux::Pid3pm

Get the native pid and the ppid on linux

Usage

    use Linux::Pid;
    print Linux::Pid::getpid(), "\t", Linux::Pid::getppid(), "\n";
    use Linux::Pid qw(getpid getppid);
    print getpid(), "\t", getppid(), "\n";

Overview

Why should one use a module to get the PID and the PPID of a process where there are the $$ variable and the getppid() builtin ? (Not mentioning the equivalent POSIX::getpid() and POSIX::getppid() functions.)

In fact, this is useful on Linux, with multithreaded programs. Linux' C library, using the linux thread model, returns different values of the PID and the PPID from different threads. (Other thread models such as NPTL don't have the same behaviour). This module forces perl to call the underlying C functions getpid() and getppid().

Releases

7 releases since Debian 8 (Jessie); the text changed 6 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13
  7. Arch

Author

Copyright (c) 2002-2007 Rafael Garcia-Suarez. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

From perl-linux-pid 0.04-21 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.