ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/getegid.htm

182 lines
4.5 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>getegid()--Get Effective Group ID</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- file cleaned -->
<!-- Unix2 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- This file has undergone html cleanup on 05/14/02 by JET -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!--End Header Records --><!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<a name="Top_Of_Page"></a>
<h2>getegid()--Get Effective Group ID</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;unistd.h&gt;
gid_t getegid(void);
</pre>
&nbsp;&nbsp;Service Program Name: QSYPAPI<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>getegid()</strong> function returns the effective group ID (GID)
of the calling thread. The effective GID is the group ID under which the thread
is currently running. The effective GID of a thread may change while the thread
is running.</p>
<br>
<h3>Parameters</h3>
<p>None.</p>
<br>
<h3>Authorities</h3>
<p>No authorization is required.</p>
<br>
<h3>Return Value</h3>
<dl compact>
<dt><em>&gt; 0</em></dt>
<dd><strong>getegid()</strong> was successful. The value returned represents
the effective <em>GID</em>.</dd>
<dt><em>&gt;= 0</em></dt>
<dd><strong>getegid()</strong> was successful. If there is no <em>GID</em>, the
user ID has no group profile associated with it and returns 0. Otherwise, if
there is a group profile, the API returns the <em>GID</em> of the group
profile.</dd>
<dt><em>-1</em></dt>
<dd><strong>getegid()</strong> was not successful. The <em>errno</em> global
variable is set to indicate the error.</dd>
</dl>
<br>
<h3>Error Conditions</h3>
<p>If <strong>getegid()</strong> is not successful, <em>errno</em> usually
indicates one of the following errors. Under some conditions, <em>errno</em>
could indicate an error other than those listed here.</p>
<table cellpadding="5">
<!-- cols="25 75" -->
<tr>
<th align="left" valign="bottom">Error condition</th>
<th align="left" valign="bottom">Additional information</th>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EAGAIN">EAGAIN</a>]</em></td>
<td align="left" valign="top">
<p>Internal object compressed. Try again.</p>
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EDAMAGE">EDAMAGE</a>]</em></td>
<td align="left" valign="top">
<p>The user profile associated with the thread <em>GID</em> or an internal
system object is damaged.</p>
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#ENOMEM">ENOMEM</a>]</em></td>
<td align="left" valign="top">
<p>The user profile associated with the thread <em>GID</em> has exceeded its
storage limit.</p>
</td>
</tr>
</table>
<br>
<h3>Related Information</h3>
<ul>
<li>The &lt;<strong>unistd.h</strong>&gt; file (see <a href="unix13.htm">Header
Files for UNIX-Type Functions</a>)</li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>The following example gets the effective GID.</p>
<pre>
#include &lt;unistd.h&gt;
main()
{
gid_t ef_gid;
if (-1 == (ef_gid = getegid(void)))
perror("getegid() error.");
else
printf("The effective GID is: %u\n", ef_gid);
}
</pre>
<p><strong>Output:</strong></p>
<pre>
The effective GID is: 75
</pre>
<hr>
API introduced: V3R1
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>