addproj Subroutine

Purpose

Adds an API-based project definition to the kernel project registry.

Library

The libaacct.a library.

Syntax

<sys/aacct.h>

addproj(struct project *)

Description

The addproj subroutine defines the application-based project definition to the kernel repository. An application can assign a project defined in this way using the proj_execve system call.

Projects that are added this way are marked as being specified by applications so that they do not overlap with system administrator-specified projects defined using the projctl command. The PROJFLAG_API flag is turned on in the structure project to indicate that the project definition was added by an application.

Projects added by a system administrator using the projctl command are flagged as being derived from the local or LDAP-based project repositories by the PROJFLAGS_LDAP or PROJFLAGS_PDF flag. If one of these flags is specified, the addproj subroutine fails with EPERM.

The getproj routine can be used to determine the origin of a loaded project.

The addproj validates the input project number to ensure that it is within the expected range of 0x00000001 - 0x00ffffff. It also validates that the project name is a POSIX compliant alphanumeric character string. If any invalid input is found errno will be set to EINVAL and the addproj subroutine returns -1.

Parameters

Item Description
project Points to a project structure that holds the definition of the project to be added.

Security

Only for privileged users. Privilege can be extended to nonroot users by granting the CAP_AACCT capability to a user.

Return Values

Item Description
0 Success
-1 Failure

Error Codes

Item Description
EINVAL Invalid Project Name / Number or the passed pointer is NULL
EEXIST Project Definition exists
EPERM Permission Denied, not a privileged user