rmprojdb Subroutine

Purpose

Removes the specified project definition from the specified project database.

Library

The libaacct.a library.

Syntax

<sys/aacct.h>

rmprojdb(void *handle, struct project *project, int flag)

Description

The rmprojdb subroutine removes the project definition stored in the struct project variable from the project named by the handle parameter. The project database must be initialized before calling this subroutine. The projdballoc and projdbfinit subroutines are provided for this purpose. If the supplied project definition does not exist in the named project database, the rmprojdb subroutine returns -1 and sets errno to ENOENT.

The rmprojdb subroutine takes a pointer to a project structure as an input argument. This pointer to the project structure holds the name or number of a project that needs to be removed. The flag parameter is set to indicate whether a name or number is supplied as input as follows:
  • PROJ_NAME — Indicates that the supplied project definition only has the project name.
  • PROJ_NUM — Indicates that the supplied project definition only has the project number.

There is an internal state (that is, the current project) associated with the project database. When the project database is initialized, the current project is the first project in the database. The rmprojdb subroutine removes the named project and repositions the internal current project to the first project definition.

Parameters

Item Description
handle Pointer to project database handle.
project Pointer to a project structure that holds the definition of the project to be added.
flag Integer flag to indicated whether the name or number of the project is supplied.

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
ENOENT Project definition does not exist
EPERM Permission denied. The user is not a privileged user.
EINVAL Passed pointer is NULL or the flag parameter holds an invalid value.