[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

initgroups Subroutine

Purpose

Initializes supplementary group ID.

Library

Standard C Library (libc.a)

Syntax

int initgroups (UserBaseGID)
char *User;
int BaseGID;

Description

Attention: The initgroups subroutine uses the getgrent and getpwent family of subroutines. If the program that invokes the initgroups subroutine uses any of these subroutines, calling the initgroups subroutine overwrites the static storage areas used by these subroutines.

The initgroups subroutine reads the defined group membership of the specified User parameter and sets the supplementary group ID of the current process to that value. The BaseGID parameter is always included in the supplementary group ID. The supplementary group is normally the principal user's group. If the user is in more than NGROUPS_MAX groups, set in the limits.h file, only NGROUPS_MAX groups are set, including the BaseGID group.

Parameters

User Identifies a user.
BaseGID Specifies an additional group to include in the group set.

Return Values

0 Indicates that the subroutine was success.
-1 Indicates that the subroutine failed. The errno global variable is set to indicate the error.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The getgid subroutine, getgrent, getgrgid, getgrnam, putgrent, setgrent, or endgrent subroutine, getgroups subroutine, setgroups subroutine.

The groups command, setgroups command.

List of Security and Auditing Subroutines, Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]