Sun-Solaris-Project
view release on metacpan or search on metacpan
$linelen += length($id) + 1;
# Validate comment.
push(@err, [3, gettext("Invalid character \"%s\" in comment"), $1])
if ($comment =~ /([\n:])/);
$linelen += length($comment) + 1;
# Validate users.
foreach my $u (@$user) {
push(@err, [6, gettext("User \"%s\" does not exist"), $u])
if (! (($u =~ /^\d+$/ && defined(getpwuid($u))) ||
($u =~ /^\*$/) || ($u =~ /^\!\*$/) ||
($u =~ /^\!(\S+)$/ && defined(getpwnam($1))) ||
defined(getpwnam($u))));
$linelen += length($u) + 1;
}
$linelen += 1 if (! @$user);
# Validate groups.
foreach my $g (@$group) {
push(@err, [6, gettext("Group \"%s\" does not exist"), $g])
http://docs.sun.com/db/doc/816-7125
An example of how this module might be used is to put the Apache httpd under
resource management control, so that the total resources used by Apache can be
limited using Solaris resource management. Assuming mod_perl is installed for
Apache, and a project with the appropriate limits has been established
(see documentation references above), the following code in the Apache Perl
startup file will place Apache under RM control:
use Sun::Solaris::Project qw(:ALL);
my $user = getpwuid(Apache->server->uid());
setproject(getdefaultproj($user), $user, 0) == 0 || die($!);
Installation
------------
1. Uncompress and untar the archive
2. cd to the module directory
3. perl Makefile.PL; make install
If you are using gcc and wish to build this module against the perl shipped as
t/Project.t view on Meta::CPAN
$pass ? pass() : fail();
# Test getprojidbyname
$pass = 1;
while (($k, $v) = each(%pf_byname)) {
$pass = 0 if (getprojidbyname($k) != $v->[1]);
}
$pass ? pass() : fail();
# Test getdefaultproj
$s = '/usr/xpg4/bin/id -p ' . getpwuid($>);
($s) = `$s` =~ /projid=\d+\(([^)]+)\)/;
defined($s) && $s eq getdefaultproj(getpwuid($>)) ? pass() : fail();
# Test inproj
$pass = 1;
if (! open($fh, "<" . "/etc/passwd")) {
fatal($!);
}
close($fh);
# Cleanup
unlink("/tmp/project.$$");
( run in 0.288 second using v1.01-cache-2.11-cpan-8d75d55dd25 )