portable setting of proctitle

This commit is contained in:
Oliver Gorwits
2014-08-07 18:50:08 +01:00
parent 941308698d
commit d5675c1bb3
8 changed files with 44 additions and 14 deletions

View File

@@ -6,7 +6,6 @@ use warnings;
use FindBin;
FindBin::again();
use Path::Class 'dir';
use Sys::Proctitle 'setproctitle';
BEGIN {
# stuff useful locations into @INC
@@ -24,6 +23,7 @@ warning sprintf "App::Netdisco %s backend", ($App::Netdisco::VERSION || 'HEAD');
# local job queue management
use App::Netdisco::Daemon::LocalQueue ':all';
use App::Netdisco::Util::Daemon;
# needed to quench AF_INET6 symbol errors
use NetAddr::IP::Lite ':lower';
@@ -38,7 +38,7 @@ my $tmp_dir = ($ENV{NETDISCO_TEMP} || dir($home, 'tmp'));
mkdir $tmp_dir if ! -d $tmp_dir;
setpgrp(0,0); # only portable variety of setpgrp
setproctitle 'netdisco-daemon: master';
prctl 'netdisco-daemon: master';
my $mce = MCE->new(
spawn_delay => 0.15,
@@ -95,7 +95,7 @@ sub worker_factory {
return sub {
my $self = shift;
my $wid = $self->wid;
setproctitle sprintf 'netdisco-daemon: worker #%s %s: init', $wid, lc($role);
prctl sprintf 'netdisco-daemon: worker #%s %s: init', $wid, lc($role);
info "applying role $role to worker $wid";
# $self->sendto('stderr', ">>> worker $wid starting with role $role\n");