Sys::Prctl - Give access to prctl system call from Perl
This is simple module that wraps the prctl system call. Currently only the PR_SET_NAME and PR_GET_NAME are implemented.
This can be use to change the process name as reported by "ps -A" and be killable will killall.
use Sys::Prctl(prctl_name); # # Use with functions # # Process name is now "My long process name" my $oldname = prctl_name(); prctl_name("My long process name"); # # Use as an object # my $process = new Sys::Prctl(); # Process name is now "Short name" my $oldname = $process->name(); $process->name('Short name'); # # Real world use # # instead of "perl helloworld.pl" $0 = "helloworld" prctl_name("helloworld"); print "Hello World\n"; sleep 100; # Process can now be killed with "killall helloworld"
Creates a new Sys::Prctl object.
Set or get the process name.
$string can only be 15 chars long on Linux.
Returns undef on error.
Direct wrapper for prctl call
Currently only 32bit Linux has been tested. So test reports and patches are wellcome.
Troels Liebe Bentsen <tlb@rapanden.dk>
Copyright(C) 2005-2007 Troels Liebe Bentsen
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Sys::Prctl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::Prctl
CPAN shell
perl -MCPAN -e shell install Sys::Prctl
For more information on module installation, please visit the detailed CPAN module installation guide.