276 lines
9.6 KiB
HTML
276 lines
9.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>endutxent</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3"> <a name="endutxent"></a> <a name="tag_03_123"></a><!-- endutxent -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_123_01"></a>NAME</h4>
|
|
|
|
<blockquote>endutxent, getutxent, getutxid, getutxline, pututxline, setutxent - user accounting database functions</blockquote>
|
|
|
|
<h4><a name="tag_03_123_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> #include <<a href="../basedefs/utmpx.h.html">utmpx.h</a>><br>
|
|
<br>
|
|
void endutxent(void);<br>
|
|
struct utmpx *getutxent(void);<br>
|
|
struct utmpx *getutxid(const struct utmpx *</tt><i>id</i><tt>);<br>
|
|
struct utmpx *getutxline(const struct utmpx *</tt><i>line</i><tt>);<br>
|
|
struct utmpx *pututxline(const struct utmpx *</tt><i>utmpx</i><tt>);<br>
|
|
void setutxent(void); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
|
|
<tt><br>
|
|
</tt></blockquote>
|
|
|
|
<h4><a name="tag_03_123_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>These functions shall provide access to the user accounting database.</p>
|
|
|
|
<p>The <i>getutxent</i>() function shall read the next entry from the user accounting database. If the database is not already
|
|
open, it shall open it. If it reaches the end of the database, it shall fail.</p>
|
|
|
|
<p>The <i>getutxid</i>() function shall search forward from the current point in the database. If the <i>ut_type</i> value of the
|
|
<b>utmpx</b> structure pointed to by <i>id</i> is BOOT_TIME, OLD_TIME, or NEW_TIME, then it shall stop when it finds an entry with
|
|
a matching <i>ut_type</i> value. If the <i>ut_type</i> value is INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS, then it
|
|
shall stop when it finds an entry whose type is one of these four and whose <i>ut_id</i> member matches the <i>ut_id</i> member of
|
|
the <b>utmpx</b> structure pointed to by <i>id</i>. If the end of the database is reached without a match, <i>getutxid</i>() shall
|
|
fail.</p>
|
|
|
|
<p>The <i>getutxline</i>() function shall search forward from the current point in the database until it finds an entry of the type
|
|
LOGIN_PROCESS or USER_PROCESS which also has a <i>ut_line</i> value matching that in the <b>utmpx</b> structure pointed to by
|
|
<i>line</i>. If the end of the database is reached without a match, <i>getutxline</i>() shall fail.</p>
|
|
|
|
<p>The <i>getutxid</i>() or <i>getutxline</i>() function may cache data. For this reason, to use <i>getutxline</i>() to search for
|
|
multiple occurrences, the application shall zero out the static data after each success, or <i>getutxline</i>() may return a
|
|
pointer to the same <b>utmpx</b> structure.</p>
|
|
|
|
<p>There is one exception to the rule about clearing the structure before further reads are done. The implicit read done by
|
|
<i>pututxline</i>() (if it finds that it is not already at the correct place in the user accounting database) shall not modify the
|
|
static structure returned by <i>getutxent</i>(), <i>getutxid</i>(), or <i>getutxline</i>(), if the application has modified this
|
|
structure and passed the pointer back to <i>pututxline</i>().</p>
|
|
|
|
<p>For all entries that match a request, the <i>ut_type</i> member indicates the type of the entry. Other members of the entry
|
|
shall contain meaningful data based on the value of the <i>ut_type</i> member as follows:</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>ut_type Member</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Other Members with Meaningful Data</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">EMPTY</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">No others</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">BOOT_TIME</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>ut_tv</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">OLD_TIME</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>ut_tv</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">NEW_TIME</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>ut_tv</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">USER_PROCESS</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>ut_id</i>, <i>ut_user</i> (login name of the user), <i>ut_line</i>, <i>ut_pid</i>, <i>ut_tv</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">INIT_PROCESS</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>ut_id</i>, <i>ut_pid</i>, <i>ut_tv</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">LOGIN_PROCESS</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>ut_id</i>, <i>ut_user</i> (implementation-defined name of the login process), <i>ut_pid</i>, <i>ut_tv</i></p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent">DEAD_PROCESS</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>ut_id</i>, <i>ut_pid</i>, <i>ut_tv</i></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>An implementation that provides extended security controls may impose implementation-defined restrictions on accessing the user
|
|
accounting database. In particular, the system may deny the existence of some or all of the user accounting database entries
|
|
associated with users other than the caller.</p>
|
|
|
|
<p>If the process has appropriate privileges, the <i>pututxline</i>() function shall write out the structure into the user
|
|
accounting database. It shall use <i>getutxid</i>() to search for a record that satisfies the request. If this search succeeds,
|
|
then the entry shall be replaced. Otherwise, a new entry shall be made at the end of the user accounting database.</p>
|
|
|
|
<p>The <i>endutxent</i>() function shall close the user accounting database.</p>
|
|
|
|
<p>The <i>setutxent</i>() function shall reset the input to the beginning of the database. This should be done before each search
|
|
for a new entry if it is desired that the entire database be examined.</p>
|
|
|
|
<p>These functions need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Upon successful completion, <i>getutxent</i>(), <i>getutxid</i>(), and <i>getutxline</i>() shall return a pointer to a
|
|
<b>utmpx</b> structure containing a copy of the requested entry in the user accounting database. Otherwise, a null pointer shall be
|
|
returned.</p>
|
|
|
|
<p>The return value may point to a static area which is overwritten by a subsequent call to <i>getutxid</i>() or
|
|
<i>getutxline</i>().</p>
|
|
|
|
<p>Upon successful completion, <i>pututxline</i>() shall return a pointer to a <b>utmpx</b> structure containing a copy of the
|
|
entry added to the user accounting database. Otherwise, a null pointer shall be returned.</p>
|
|
|
|
<p>The <i>endutxent</i>() and <i>setutxent</i>() functions shall not return a value.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>No errors are defined for the <i>endutxent</i>(), <i>getutxent</i>(), <i>getutxid</i>(), <i>getutxline</i>(), and
|
|
<i>setutxent</i>() functions.</p>
|
|
|
|
<p>The <i>pututxline</i>() function may fail if:</p>
|
|
|
|
<dl compact>
|
|
<dt>[EPERM]</dt>
|
|
|
|
<dd>The process does not have appropriate privileges.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_123_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>The sizes of the arrays in the structure can be found using the <i>sizeof</i> operator.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p>The Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/utmpx.h.html"><i><utmpx.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 4, Version 2.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_12"></a>Issue 5</h4>
|
|
|
|
<blockquote>
|
|
<p>Moved from X/OPEN UNIX extension to BASE.</p>
|
|
|
|
<p>Normative text previously in the APPLICATION USAGE section is moved to the DESCRIPTION.</p>
|
|
|
|
<p>A note indicating that these functions need not be reentrant is added to the DESCRIPTION.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_123_13"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>In the DESCRIPTION, the note about reentrancy is expanded to cover thread-safety.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|