Carrot
view release on metacpan or search on metacpan
lib/Carrot/Individuality/Singular/Process/Id.pm view on Meta::CPAN
# ?
{
return($PROGRAM_NAME);
}
sub is_running
# /type method
# /effect ""
# //parameters
# //returns
# ::Personality::Abstract::Boolean
{
kill(0, ${$_[THIS]});
}
sub send_signal
# /type method
# /effect ""
# //parameters
# signal
# //returns
# ?
{
kill($_[SPX_SIGNAL], ${$_[THIS]});
}
sub id_changed
# /type method
# /effect ""
# //parameters
# //returns
# ::Personality::Abstract::Boolean
{
my ($this) = @ARGUMENTS;
return(IS_FALSE) if (defined($$this) and ($$this == $PROCESS_PID));
$$this = $PROCESS_PID;
return(IS_TRUE);
}
sub gone_or_kill
# /type method
# /effect ""
# //parameters
# timeout ::Personality::Abstract::Seconds
# //returns
# ?
{ # FIXME: convert this to POSIX-style
# FIXME: the return value is weird
my ($this, $timeout) = @ARGUMENTS;
while ($timeout > 0)
{
return(IS_TRUE) unless (kill(0, $$this));
sleep(1);
$timeout -= 1;
}
return(kill(9, $$this));
}
sub set_ugid
# /type method
# /effect ""
# //parameters
# uid
# gid
# //returns
{
my ($this, $uid, $gid) = @ARGUMENTS;
if (defined($uid) and ($REAL_USER_ID != $EFFECTIVE_USER_ID))
{
my $former = $REAL_USER_ID;
$REAL_USER_ID = $uid;
if ($OS_ERROR > 0)
{
$perl_setxid_failed->raise_exception(
{+HKY_DEX_BACKTRACK => $uid,
'x' => 'u',
'xid' => $uid,
'former_xid' => $former,
'os_error' => $OS_ERROR},
ERROR_CATEGORY_SETUP);
}
}
if (defined($gid) and ($REAL_GROUP_ID != $EFFECTIVE_GROUP_ID))
{
my $former = $REAL_GROUP_ID;
$REAL_GROUP_ID = $gid;
if ($OS_ERROR > 0)
{
$perl_setxid_failed->raise_exception(
{+HKY_DEX_BACKTRACK => $gid,
'x' => 'g',
'xid' => $gid,
'former_xid' => $former,
'os_error' => $OS_ERROR},
ERROR_CATEGORY_SETUP);
}
}
return;
}
sub set_eugid
# /type method
# /effect ""
# //parameters
# uid
# gid
# //returns
{
my ($this, $uid, $gid) = @ARGUMENTS;
if (defined($uid) and ($EFFECTIVE_USER_ID != $uid))
{
my $former = $EFFECTIVE_USER_ID;
$EFFECTIVE_USER_ID = $uid;
if ($OS_ERROR > 0)
{
$perl_setxid_failed->raise_exception(
{+HKY_DEX_BACKTRACK => $uid,
'x' => 'u',
'xid' => $uid,
'former_xid' => $former,
'os_error' => $OS_ERROR},
ERROR_CATEGORY_SETUP);
}
}
if (defined($gid) and ($EFFECTIVE_GROUP_ID != $gid))
{
my $former = $EFFECTIVE_GROUP_ID;
$EFFECTIVE_GROUP_ID = $gid;
if ($OS_ERROR > 0)
{
$perl_setxid_failed->raise_exception(
{+HKY_DEX_BACKTRACK => $gid,
'x' => 'g',
'xid' => $gid,
'former_xid' => $former,
'os_error' => $OS_ERROR},
ERROR_CATEGORY_SETUP);
}
}
return;
}
# =--------------------------------------------------------------------------= #
return(PERL_FILE_LOADED);
}
# //revision_control
# version 1.1.87
# branch main
# maturity alpha
# /license MPL-2.0 (Mozilla Public License v2.0)
# /copyright "(C) 2009-2014 Winfried Trümper <win@carrot-programming.org>"
( run in 2.397 seconds using v1.01-cache-2.11-cpan-97f6503c9c8 )