10Sstevel@tonic-gate# 2*12388SJohn.Sonnenschein@Sun.COM# Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. 30Sstevel@tonic-gate# 4*12388SJohn.Sonnenschein@Sun.COM 50Sstevel@tonic-gate# 60Sstevel@tonic-gate# Sun::Solaris::Project documentation. 70Sstevel@tonic-gate# 80Sstevel@tonic-gate 90Sstevel@tonic-gate=head1 NAME 100Sstevel@tonic-gate 110Sstevel@tonic-gateSun::Solaris::Project - Perl interface to Projects 120Sstevel@tonic-gate 130Sstevel@tonic-gate=head1 SYNOPSIS 140Sstevel@tonic-gate 150Sstevel@tonic-gate use Sun::Solaris::Project qw(:ALL); 160Sstevel@tonic-gate my $projid = getprojid(); 170Sstevel@tonic-gate 180Sstevel@tonic-gateThis module provides wrappers for the Project-related system calls and the 190Sstevel@tonic-gateC<libproject(3LIB)> library. Also provided are constants from the various 200Sstevel@tonic-gateProject-related headers. 210Sstevel@tonic-gate 220Sstevel@tonic-gate=head2 Constants 230Sstevel@tonic-gate 240Sstevel@tonic-gateC<MAXPROJID>, C< PROJNAME_MAX>, C<PROJF_PATH>, C<PROJECT_BUFSZ>, 250Sstevel@tonic-gateC<SETPROJ_ERR_TASK>, and C<SETPROJ_ERR_POOL>. 260Sstevel@tonic-gate 270Sstevel@tonic-gate=head2 Functions 280Sstevel@tonic-gate 290Sstevel@tonic-gateB<C<getprojid()>> 300Sstevel@tonic-gate 310Sstevel@tonic-gateThis function returns the numeric project ID of the calling process or C<undef> 320Sstevel@tonic-gateif the underlying C<getprojid(2)> system call is unsuccessful. 330Sstevel@tonic-gate 340Sstevel@tonic-gateB<C<setproject($project, $user, $flags)>> 350Sstevel@tonic-gate 360Sstevel@tonic-gateIf C<$user> is a member of the project specified by C<$project>, 370Sstevel@tonic-gateC<setproject()> creates a new task and associates the appropriate resource 380Sstevel@tonic-gatecontrols with the process, task, and project. This function returns 0 on 390Sstevel@tonic-gatesuccess. If the the underlying task creation fails, C<SETPROJ_ERR_TASK> is 400Sstevel@tonic-gatereturned. If pool assignment fails, C<SETPROJ_ERR_POOL> is returned. If any 410Sstevel@tonic-gateresource attribute assignments fail, an integer value corresponding to the 420Sstevel@tonic-gateoffset of the failed attribute assignment in the project database is returned. 430Sstevel@tonic-gateSee C<setproject(3PROJECT)>. 440Sstevel@tonic-gate 450Sstevel@tonic-gateB<C<activeprojects()>> 460Sstevel@tonic-gate 470Sstevel@tonic-gateThis function returns a list of the currently active projects on the system. 480Sstevel@tonic-gateEach value in the list is the numeric ID of a currently active project. 490Sstevel@tonic-gate 500Sstevel@tonic-gateB<C<getprojent()>> 510Sstevel@tonic-gate 520Sstevel@tonic-gateThis function returns the next entry from the project database. When called in 530Sstevel@tonic-gatea scalar context, C<getprojent()> returns only the name of the project. When 540Sstevel@tonic-gatecalled in a list context, C<getprojent()> returns a 6-element list consisting 550Sstevel@tonic-gateof: 560Sstevel@tonic-gate 570Sstevel@tonic-gate ($name, $projid, $comment, \@users, \@groups, $attr) 580Sstevel@tonic-gate 590Sstevel@tonic-gateC<\@users> and C<\@groups> are returned as arrays containing the appropriate 600Sstevel@tonic-gateuser or project lists. On end-of-file C<undef> is returned. 610Sstevel@tonic-gate 620Sstevel@tonic-gateB<C<setprojent()>> 630Sstevel@tonic-gate 640Sstevel@tonic-gateThis function rewinds the project database to the beginning of the file. 650Sstevel@tonic-gate 660Sstevel@tonic-gateB<C<endprojent()>> 670Sstevel@tonic-gate 680Sstevel@tonic-gateThis function closes the project database. 690Sstevel@tonic-gate 700Sstevel@tonic-gateB<C<getprojbyname($name)>> 710Sstevel@tonic-gate 720Sstevel@tonic-gateThis function searches the project database for an entry with the specified 730Sstevel@tonic-gatename. It returns a 6-element list as returned by C<getprojent()> if the entry 740Sstevel@tonic-gateis found and C<undef> if it cannot be found. 750Sstevel@tonic-gate 760Sstevel@tonic-gateB<C<getprojbyid($id)>> 770Sstevel@tonic-gate 780Sstevel@tonic-gateThis function searches the project database for an entry with the specified 790Sstevel@tonic-gateID. It returns a 6-element list as returned by C<getprojent()> if the entry is 800Sstevel@tonic-gatefound or C<undef> if it cannot be found. 810Sstevel@tonic-gate 820Sstevel@tonic-gateB<C<getdefaultproj($user)>> 830Sstevel@tonic-gate 840Sstevel@tonic-gateThis function returns the default project entry for the specified user in the 850Sstevel@tonic-gatesame format as C<getprojent()>. It returns C<undef> if the user cannot be 860Sstevel@tonic-gatefound. See C<getdefaultproj(3PROJECT)> for information about the lookup 870Sstevel@tonic-gateprocess. 880Sstevel@tonic-gate 890Sstevel@tonic-gateB<C<fgetprojent($filehandle)>> 900Sstevel@tonic-gate 910Sstevel@tonic-gateThis function returns the next project entry from C<$filehandle>, a Perl file 920Sstevel@tonic-gatehandle that must refer to a previously opened file in C<project(4)> format. 930Sstevel@tonic-gateReturn values are the same as for C<getprojent()>. 940Sstevel@tonic-gate 950Sstevel@tonic-gateB<C<inproj($user, $project)>> 960Sstevel@tonic-gate 970Sstevel@tonic-gateThis function checks whether the specified user is able to use the project. 980Sstevel@tonic-gateThis function returns C<true> if the user can use the project and C<false> 990Sstevel@tonic-gateotherwise. See C<inproj(3PROJECT)>. 1000Sstevel@tonic-gate 1010Sstevel@tonic-gateB<C<getprojidbyname($project)>> 1020Sstevel@tonic-gate 1030Sstevel@tonic-gateThis function searches the project database for the specified project. It 1040Sstevel@tonic-gatereturns the project ID if the project is found and C<undef> if it is not found. 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate=head2 Class methods 1070Sstevel@tonic-gate 1080Sstevel@tonic-gateNone. 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate=head2 Object methods 1110Sstevel@tonic-gate 1120Sstevel@tonic-gateNone. 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate=head2 Exports 1150Sstevel@tonic-gate 1160Sstevel@tonic-gateBy default nothing is exported from this module. The following tags can be 1170Sstevel@tonic-gateused to selectively import constants and functions defined in this module: 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate :SYSCALLS getprojid() 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate :LIBCALLS setproject(), activeprojects(), getprojent(), setprojent(), 1220Sstevel@tonic-gate endprojent(), getprojbyname(), getprojbyid(), getdefaultproj(), 1230Sstevel@tonic-gate fgetprojent(), inproj(), and getprojidbyname() 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate :CONSTANTS MAXPROJID, PROJNAME_MAX, PROJF_PATH, PROJECT_BUFSZ, 1260Sstevel@tonic-gate SETPROJ_ERR_TASK, and SETPROJ_ERR_POOL 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate :ALL :SYSCALLS, :LIBCALLS, and :CONSTANTS 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate=head1 ATTRIBUTES 1310Sstevel@tonic-gate 1320Sstevel@tonic-gateSee C<attributes(5)> for descriptions of the following attributes: 1330Sstevel@tonic-gate 1340Sstevel@tonic-gate ___________________________________________________________ 1350Sstevel@tonic-gate | ATTRIBUTE TYPE | ATTRIBUTE VALUE | 1360Sstevel@tonic-gate |_____________________________|_____________________________| 1370Sstevel@tonic-gate | Availability | CPAN (http://www.cpan.org) | 1380Sstevel@tonic-gate |_____________________________|_____________________________| 1390Sstevel@tonic-gate | Interface Stability | Evolving | 1400Sstevel@tonic-gate |_____________________________|_____________________________| 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate=head1 SEE ALSO 1430Sstevel@tonic-gate 1440Sstevel@tonic-gateC<getprojid(2)>, C<getdefaultproj(3PROJECT)>, C<inproj(3PROJECT)>, 1450Sstevel@tonic-gateC<libproject(3LIB)>, C<setproject(3PROJECT)>, C<project(4)>, C<attributes(5)> 146