178 lines
4.2 KiB
HTML
178 lines
4.2 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>geteuid()--Get Effective User 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>geteuid()--Get Effective User ID</h2>
|
||
|
|
||
|
<div class="box" style="width: 60%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
|
||
|
|
||
|
<pre>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
uid_t geteuid(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>geteuid()</strong> function returns the effective user ID (UID)
|
||
|
of the calling thread. The effective UID is the user ID under which the thread
|
||
|
is currently running. The effective UID 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>0 or > 0</em></dt>
|
||
|
|
||
|
<dd><strong>geteuid()</strong> was successful. The value returned represents
|
||
|
the effective UID.</dd>
|
||
|
|
||
|
<dt><em>-1</em></dt>
|
||
|
|
||
|
<dd><strong>geteuid()</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>geteuid()</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 UID 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 UID 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 effective UID.</p>
|
||
|
|
||
|
<pre>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
main()
|
||
|
{
|
||
|
uid_t ef_uid;
|
||
|
|
||
|
if (-1 == (ef_uid = geteuid(void)))
|
||
|
perror("geteuid() error.");
|
||
|
else
|
||
|
printf("The effective UID is: %u\n", ef_uid);
|
||
|
|
||
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p><strong>Output:</strong></p>
|
||
|
|
||
|
<pre>
|
||
|
The effective UID is: 1957
|
||
|
</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>
|
||
|
|