186 lines
4.6 KiB
HTML
186 lines
4.6 KiB
HTML
|
<!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>getgid()--Get Real 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 -->
|
||
|
<!-- 011022 JTROUS Changes from API Review 1, V5R2 -->
|
||
|
<!-- 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>getgid()--Get Real Group ID</h2>
|
||
|
|
||
|
<div class="box" style="width: 70%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
|
||
|
|
||
|
<pre>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
gid_t getgid(void);
|
||
|
</pre>
|
||
|
|
||
|
Service Program Name: QSYPAPI<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Default Public Authority: *USE<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Threadsafe: Yes<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
</div>
|
||
|
|
||
|
<p>The <strong>getgid()</strong> function returns the real group ID (GID) of
|
||
|
the calling thread. The real GID is the group ID under which the thread was
|
||
|
created.</p>
|
||
|
<p><strong>Note:</strong>: When a user profile swap is done with the QWTSETP
|
||
|
API prior to running the getgid() function, the GID for the current profile is
|
||
|
returned.</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>> 0</em></dt>
|
||
|
|
||
|
<dd><strong>getgid()</strong> was successful. The value returned represents the
|
||
|
<em>GID</em>.</dd>
|
||
|
|
||
|
<dt><em>>= 0</em></dt>
|
||
|
|
||
|
<dd><strong>getgid()</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>getgid()</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>getgid()</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 <<strong>unistd.h</strong>> 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 real GID.</p>
|
||
|
|
||
|
<pre>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
main()
|
||
|
{
|
||
|
gid_t gid;
|
||
|
|
||
|
if (-1 == (gid = getgid(void)))
|
||
|
perror("getgid() error.");
|
||
|
else
|
||
|
printf("The real GID is: %u\n", gid);
|
||
|
|
||
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p><strong>Output:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
The real GID is: 75
|
||
|
</pre>
|
||
|
|
||
|
<hr>
|
||
|
API introduced: V3R1 <br>
|
||
|
<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>
|
||
|
|