307 lines
7.9 KiB
HTML
307 lines
7.9 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>QlgGetpwuid()--Get User Information for User ID (using NLS-enabled path
|
|
name)</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: -->
|
|
<!-- Created for V5R1-->
|
|
<!-- file cleaned -->
|
|
<!-- Change History: -->
|
|
<!-- 011022 JTROUS Changes from API Review 1, V5R2 -->
|
|
<!-- This file has undergone html cleanup June 2002 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>QlgGetpwuid()--Get User Information for User ID (using NLS-enabled path
|
|
name)</h2>
|
|
|
|
<div class="box" style="width: 60%;">
|
|
<br>
|
|
Syntax<br>
|
|
|
|
|
|
<pre>
|
|
#include <pwd.h>
|
|
|
|
struct qplg_passwd *QlgGetpwuid(uid_t <em>uid</em>);
|
|
</pre>
|
|
|
|
Service Program Name: QSYPAPI<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Default Public Authority: *USE<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
Threadsafe: No<br>
|
|
<!-- iddvc RMBR -->
|
|
<br>
|
|
</div>
|
|
|
|
<p>The <strong>QlgGetpwuid()</strong> function returns a pointer to an object
|
|
of type <samp>struct qplg_passwd</samp> containing an entry from the user
|
|
database with a matching user ID (<em>UID</em>).</p>
|
|
|
|
<br>
|
|
<h3>Parameters</h3>
|
|
|
|
<dl>
|
|
<dt><strong><em>UID</em></strong></dt>
|
|
|
|
<dd>(Input) User ID.</dd>
|
|
</dl>
|
|
|
|
<p>The <samp>struct qplg_passwd</samp>, which is defined in the <strong>
|
|
pwd.h</strong> header file, has the following elements:</p>
|
|
|
|
<table border width="100%">
|
|
<tr>
|
|
<td align="left" valign="top" width="25%">char *</td>
|
|
<td align="left" valign="top" width="20%">pw_name</td>
|
|
<td align="left" valign="top" width="55%">User name</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">uid_t</td>
|
|
<td align="left" valign="top">pw_uid</td>
|
|
<td align="left" valign="top">User ID</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">uid_t</td>
|
|
<td align="left" valign="top">pw_gid</td>
|
|
<td align="left" valign="top">Group ID</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">Qlg_Path_Name_T*</td>
|
|
<td align="left" valign="top">pw_dir</td>
|
|
<td align="left" valign="top">Initial working directory</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">char *</td>
|
|
<td align="left" valign="top">pw_shell</td>
|
|
<td align="left" valign="top">Initial user program</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>See <a href="getpwuid.htm">getpwuid()--Get User Information for User ID</a>
|
|
for more on the parameter.</p>
|
|
|
|
<br>
|
|
<h3>Authorities</h3>
|
|
|
|
<p>*READ authority is required to the user profile associated with the <em>
|
|
UID</em>.</p>
|
|
|
|
<p><strong>Note:</strong> Adopted authority is not used.</p>
|
|
|
|
<br>
|
|
<h3>Return Value</h3>
|
|
|
|
<dl>
|
|
<dt><em>value</em></dt>
|
|
|
|
<dd><strong>QlgGetpwuid()</strong> was successful. The return value points to
|
|
static data that is overwritten on each call to this function. This static
|
|
storage area is also used by the <strong>QlgGetpwnam()</strong> function.<br>
|
|
<br>
|
|
</dd>
|
|
|
|
<dt><em>NULL pointer</em></dt>
|
|
|
|
<dd><strong>QlgGetpwuid()</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>QlgGetpwuid()</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>The user profile associated with the <em>uid</em> is currently locked by
|
|
another process.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<em>[<a href="unix14.htm#EC2">EC2</a>]</em></td>
|
|
|
|
<td align="left" valign="top">
|
|
<p>Detected pointer that is not valid.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<em>[<a href="unix14.htm#EINVAL">EINVAL</a>]</em></td>
|
|
|
|
<td align="left" valign="top">
|
|
<p>Value is not valid. Check the job log for messages.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<em>[<a href="unix14.htm#ENOENT">ENOENT</a>]</em></td>
|
|
|
|
<td align="left" valign="top">
|
|
<p>The user profile associated with <em>UID</em> was not found.</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 <em>UID</em> has exceeded its storage
|
|
limit or is unable to allocate memory.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<em>[<a href="unix14.htm#ENOSPC">ENOSPC</a>]</em></td>
|
|
|
|
<td align="left" valign="top">
|
|
<p>Machine storage limit exceeded.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<em>[<a href="unix14.htm#EPERM">EPERM</a>]</em></td>
|
|
|
|
<td align="left" valign="top">
|
|
<p>The calling job does not have *READ authority to the user profile
|
|
associated with the <em>UID</em>.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td align="left" valign="top">
|
|
<em>[<a href="unix14.htm#EUNKNOWN">EUNKNOWN</a>]</em></td>
|
|
|
|
<td align="left" valign="top">
|
|
<p>Unknown system state. Check the job log for a CPF9872 message. If there is
|
|
no message, verify that the home directory field in the user profile can be
|
|
displayed.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br>
|
|
<h3>Usage Notes</h3>
|
|
|
|
<p>Th path name is returned in the default IFS UNICODE CCSID</p>
|
|
|
|
<br>
|
|
<h3>Related Information</h3>
|
|
|
|
<ul>
|
|
<li>The <<strong>pwd.h</strong>> file (see <a href="unix13.htm">Header
|
|
Files for UNIX-Type Functions</a>)<br>
|
|
</li>
|
|
|
|
<li><a href="getpwuid.htm">getpwuid()</a>--Get User Information for User ID<br>
|
|
</li>
|
|
|
|
<li><a href="gtpwuidr.htm">getpwuid_r()</a>--Get User Information for User
|
|
ID<br>
|
|
</li>
|
|
|
|
<li><a href="gtpwuidru.htm">QlgGetpwuid_r()</a>--Get User Information for User
|
|
ID (using NLS-enabled path name)</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 user database information for the uid of 22.
|
|
The user name is MYUSER. The gid is 1012. The initial working directory is
|
|
/home/MYUSER. The initial user program is *LIBL/QCMD.</p>
|
|
|
|
<pre>
|
|
#include <pwd.h>
|
|
|
|
main()
|
|
{
|
|
struct qplg_passwd *pd;
|
|
|
|
if (NULL == (pd = QlgGetpwuid(22)))
|
|
perror("QlgGetpwuid() error.");
|
|
else
|
|
{
|
|
printf("The user name is: %s\n", pd->pw_name);
|
|
printf("The user id is: %u\n", pd->pw_uid);
|
|
printf("The group id is: %u\n", pd->pw_gid);
|
|
printf("The initial working directory length is: %d\n",
|
|
pd->pw_dir->Path_Length);
|
|
printf("The initial working directory CCSID is : %d\n",
|
|
pd->pw_dir->CCSID);
|
|
printf("The initial user program is: %s\n", pd->pw_shell);
|
|
}
|
|
|
|
}
|
|
</pre>
|
|
|
|
<p><strong>Output:</strong></p>
|
|
|
|
<pre>
|
|
The user name is: MYUSER
|
|
The user id is: 22
|
|
The group id is: 1012
|
|
The intial working directory length is: 24
|
|
The intial working directory CCSID is : 13488
|
|
The initial user program is: *LIBL/QCMD
|
|
</pre>
|
|
|
|
<br>
|
|
<hr>
|
|
API introduced: V5R1
|
|
|
|
<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>
|