qsysetegid()--Set Effective Group ID


  Syntax
 #include <qsysetid.h>    

 int qsysetegid(gid_t gid);  
  Service Program Name: QSYSETIDS

  Default Public Authority: *USE

  Threadsafe: Yes

If gid is equal to either the real, effective, saved group ID, or one of the groups in the supplemental group list, qsysetegid() sets the effective group ID to gid.

If gid is not equal to any of the current groups, but the thread has *USE authority to the user profile associated with the gid, qsysetegid() sets the effective group ID to gid.

Job scoped locks with a lock state of *SHRRD are held on the user profiles associated with the real user ID, effective user ID, saved user ID, real group ID, effective group ID, saved group ID, and all of the supplemental groups.


Parameters

gid
(Input) Group ID.

This field must contain one of the following values:

0
There is no effective group ID.
1 to 4294967294
The group ID value for the set operation.

Authorities and Locks

User profile associated with uid authority
*USE authority is required to the user profile associated with gid if gid is not equal to the real, effective, saved group IDs or one of the groups in the supplemental group list.
User profile associated with uid lock
*SHRRD

Return Value

0
qsysetegid() was successful.
-1
qsysetegid() was not successful. errno is set to indicate the error.

Error Conditions

If qsysetegid() is not successful, errno indicates one of the following errors.

Error condition Additional information
[EAGAIN]

User profile associated with the gid is locked. Try again.

[EINVAL]

The value of the gid argument is not valid. Following are possible reasons:

  • Out of range.
  • Not associated with a user profile.
[EDAMAGE]

The user profile associated with the gid or an internal system object is damaged.

[ENOTSUP]

Operation not supported. The current effective user profile specifies OWNER(*GRPPRF), but the group profile associated with this gid is not equal to the user profile's first group and the user's first group is not in the list of supplemental groups.

[EPERM]

Operation not permitted. Following are possible reasons:

  • The thread does not have *USE authority to the user profile associated with the gid and the gid to be set is not the same as the real, effective, saved group IDs or any of the supplemental groups.
  • gid cannot be set to 0 if there are supplemental groups.
[EUNKNOWN]

An unknown error has occurred. Check the joblog for error messages.



API introduced: V4R5

[ Back to top | UNIX-Type APIs | APIs by category ]