getproj Subroutine

Purpose

Retrieves the project definition from the kernel project registry for the requested project name.

Library

The libaacct.a library.

Syntax

<sys/aacct.h>

getproj(struct project *, int flag)

Description

The getproj subroutine functions similar to the getprojs subroutine with the exception that the getproj subroutine retrieves the definition only for the project name or number, which is passed as its argument. The flag parameter indicates what is passed. The flag parameter has the following values:
  • PROJ_NAME — Indicates that the supplied project definition only has the project name. The getproj subroutine queries the kernel to obtain a match for the supplied project name and returns the matching entry.
  • PROJ_NUM — Indicates that the supplied project definition only has the project number. The getproj subroutine queries the kernel to obtain a match for the supplied project number and returns the matching entry.

Generally, the projects are loaded from the system project definition file or LDAP, or from both. When more than one of these project repositories are used, project name and project ID collisions are possible. These projects are differentiated by the kernel using an origin flag. This origin flag designates the project repository from where the project definition is obtained. If the caller wants to retrieve the project definition that belongs to a specific project repository, the specific origin value should be passed in the flags field of the project structure. Valid project origins values that can be passed are defined in the sys/aacct.h file. If the projects are currently loaded from the project repository represented by the origin value, getproj returns the specified project if it exists. If the origin value is not passed, the first project reference found in the kernel registry is returned. Regardless of whether the origin is passed or not, getproj always returns the project origin flags in the output project structure.

Parameters

Item Description
project Pointer holding the project whose information is required.
flag An integer flag that indicates whether the match needs to be performed on the supplied project name or number.

Security

There are no restrictions. Any user can call this function.

Return Values

Item Description
0 Success
-1 Failure

Error Codes

Item Description
EINVAL Invalid argument. The flag parameter is not valid or the passed pointer is NULL.
ENOENT Project not found.