17c478bd9Sstevel@tonic-gate# 2c227543fSJohn Sonnenschein# Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. 37c478bd9Sstevel@tonic-gate# 4c227543fSJohn Sonnenschein 57c478bd9Sstevel@tonic-gate# 67c478bd9Sstevel@tonic-gate# Sun::Solaris::Project documentation. 77c478bd9Sstevel@tonic-gate# 87c478bd9Sstevel@tonic-gate 97c478bd9Sstevel@tonic-gate=head1 NAME 107c478bd9Sstevel@tonic-gate 117c478bd9Sstevel@tonic-gateSun::Solaris::Project - Perl interface to Projects 127c478bd9Sstevel@tonic-gate 137c478bd9Sstevel@tonic-gate=head1 SYNOPSIS 147c478bd9Sstevel@tonic-gate 157c478bd9Sstevel@tonic-gate use Sun::Solaris::Project qw(:ALL); 167c478bd9Sstevel@tonic-gate my $projid = getprojid(); 177c478bd9Sstevel@tonic-gate 187c478bd9Sstevel@tonic-gateThis module provides wrappers for the Project-related system calls and the 197c478bd9Sstevel@tonic-gateC<libproject(3LIB)> library. Also provided are constants from the various 207c478bd9Sstevel@tonic-gateProject-related headers. 217c478bd9Sstevel@tonic-gate 227c478bd9Sstevel@tonic-gate=head2 Constants 237c478bd9Sstevel@tonic-gate 247c478bd9Sstevel@tonic-gateC<MAXPROJID>, C< PROJNAME_MAX>, C<PROJF_PATH>, C<PROJECT_BUFSZ>, 257c478bd9Sstevel@tonic-gateC<SETPROJ_ERR_TASK>, and C<SETPROJ_ERR_POOL>. 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate=head2 Functions 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gateB<C<getprojid()>> 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gateThis function returns the numeric project ID of the calling process or C<undef> 327c478bd9Sstevel@tonic-gateif the underlying C<getprojid(2)> system call is unsuccessful. 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gateB<C<setproject($project, $user, $flags)>> 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gateIf C<$user> is a member of the project specified by C<$project>, 377c478bd9Sstevel@tonic-gateC<setproject()> creates a new task and associates the appropriate resource 387c478bd9Sstevel@tonic-gatecontrols with the process, task, and project. This function returns 0 on 397c478bd9Sstevel@tonic-gatesuccess. If the the underlying task creation fails, C<SETPROJ_ERR_TASK> is 407c478bd9Sstevel@tonic-gatereturned. If pool assignment fails, C<SETPROJ_ERR_POOL> is returned. If any 417c478bd9Sstevel@tonic-gateresource attribute assignments fail, an integer value corresponding to the 427c478bd9Sstevel@tonic-gateoffset of the failed attribute assignment in the project database is returned. 437c478bd9Sstevel@tonic-gateSee C<setproject(3PROJECT)>. 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gateB<C<activeprojects()>> 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gateThis function returns a list of the currently active projects on the system. 487c478bd9Sstevel@tonic-gateEach value in the list is the numeric ID of a currently active project. 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gateB<C<getprojent()>> 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gateThis function returns the next entry from the project database. When called in 537c478bd9Sstevel@tonic-gatea scalar context, C<getprojent()> returns only the name of the project. When 547c478bd9Sstevel@tonic-gatecalled in a list context, C<getprojent()> returns a 6-element list consisting 557c478bd9Sstevel@tonic-gateof: 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate ($name, $projid, $comment, \@users, \@groups, $attr) 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gateC<\@users> and C<\@groups> are returned as arrays containing the appropriate 607c478bd9Sstevel@tonic-gateuser or project lists. On end-of-file C<undef> is returned. 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gateB<C<setprojent()>> 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gateThis function rewinds the project database to the beginning of the file. 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gateB<C<endprojent()>> 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gateThis function closes the project database. 697c478bd9Sstevel@tonic-gate 707c478bd9Sstevel@tonic-gateB<C<getprojbyname($name)>> 717c478bd9Sstevel@tonic-gate 727c478bd9Sstevel@tonic-gateThis function searches the project database for an entry with the specified 737c478bd9Sstevel@tonic-gatename. It returns a 6-element list as returned by C<getprojent()> if the entry 747c478bd9Sstevel@tonic-gateis found and C<undef> if it cannot be found. 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gateB<C<getprojbyid($id)>> 777c478bd9Sstevel@tonic-gate 787c478bd9Sstevel@tonic-gateThis function searches the project database for an entry with the specified 797c478bd9Sstevel@tonic-gateID. It returns a 6-element list as returned by C<getprojent()> if the entry is 807c478bd9Sstevel@tonic-gatefound or C<undef> if it cannot be found. 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gateB<C<getdefaultproj($user)>> 837c478bd9Sstevel@tonic-gate 847c478bd9Sstevel@tonic-gateThis function returns the default project entry for the specified user in the 857c478bd9Sstevel@tonic-gatesame format as C<getprojent()>. It returns C<undef> if the user cannot be 867c478bd9Sstevel@tonic-gatefound. See C<getdefaultproj(3PROJECT)> for information about the lookup 877c478bd9Sstevel@tonic-gateprocess. 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gateB<C<fgetprojent($filehandle)>> 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gateThis function returns the next project entry from C<$filehandle>, a Perl file 92*bbf21555SRichard Lowehandle that must refer to a previously opened file in C<project(5)> format. 937c478bd9Sstevel@tonic-gateReturn values are the same as for C<getprojent()>. 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gateB<C<inproj($user, $project)>> 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gateThis function checks whether the specified user is able to use the project. 987c478bd9Sstevel@tonic-gateThis function returns C<true> if the user can use the project and C<false> 997c478bd9Sstevel@tonic-gateotherwise. See C<inproj(3PROJECT)>. 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gateB<C<getprojidbyname($project)>> 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gateThis function searches the project database for the specified project. It 1047c478bd9Sstevel@tonic-gatereturns the project ID if the project is found and C<undef> if it is not found. 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate=head2 Class methods 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gateNone. 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate=head2 Object methods 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gateNone. 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate=head2 Exports 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gateBy default nothing is exported from this module. The following tags can be 1177c478bd9Sstevel@tonic-gateused to selectively import constants and functions defined in this module: 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate :SYSCALLS getprojid() 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate :LIBCALLS setproject(), activeprojects(), getprojent(), setprojent(), 1227c478bd9Sstevel@tonic-gate endprojent(), getprojbyname(), getprojbyid(), getdefaultproj(), 1237c478bd9Sstevel@tonic-gate fgetprojent(), inproj(), and getprojidbyname() 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate :CONSTANTS MAXPROJID, PROJNAME_MAX, PROJF_PATH, PROJECT_BUFSZ, 1267c478bd9Sstevel@tonic-gate SETPROJ_ERR_TASK, and SETPROJ_ERR_POOL 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate :ALL :SYSCALLS, :LIBCALLS, and :CONSTANTS 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate=head1 ATTRIBUTES 1317c478bd9Sstevel@tonic-gate 132*bbf21555SRichard LoweSee C<attributes(7)> for descriptions of the following attributes: 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate ___________________________________________________________ 1357c478bd9Sstevel@tonic-gate | ATTRIBUTE TYPE | ATTRIBUTE VALUE | 1367c478bd9Sstevel@tonic-gate |_____________________________|_____________________________| 1377c478bd9Sstevel@tonic-gate | Availability | CPAN (http://www.cpan.org) | 1387c478bd9Sstevel@tonic-gate |_____________________________|_____________________________| 1397c478bd9Sstevel@tonic-gate | Interface Stability | Evolving | 1407c478bd9Sstevel@tonic-gate |_____________________________|_____________________________| 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate=head1 SEE ALSO 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gateC<getprojid(2)>, C<getdefaultproj(3PROJECT)>, C<inproj(3PROJECT)>, 145*bbf21555SRichard LoweC<libproject(3LIB)>, C<setproject(3PROJECT)>, C<project(5)>, C<attributes(7)> 146