⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getutxline.html

📁 IEEE 1003.1-2003, Single Unix Specification v3
💻 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-2003 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, 2003 Edition<br>Copyright &copy; 2001-2003 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 &lt;<a href="../basedefs/utmpx.h.html">utmpx.h</a>&gt;<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 alreadyopen, 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 witha matching <i>ut_type</i> value. If the <i>ut_type</i> value is INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS, then itshall 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 ofthe <b>utmpx</b> structure pointed to by <i>id</i>. If the end of the database is reached without a match, <i>getutxid</i>() shallfail.</p><p>The <i>getutxline</i>() function shall search forward from the current point in the database until it finds an entry of the typeLOGIN_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 formultiple occurrences, the application shall zero out the static data after each success, or <i>getutxline</i>() may return apointer 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 thestatic structure returned by <i>getutxent</i>(), <i>getutxid</i>(), or <i>getutxline</i>(), if the application has modified thisstructure 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 entryshall 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 useraccounting database. In particular, the system may deny the existence of some or all of the user accounting database entriesassociated 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 useraccounting 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 searchfor 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 bereturned.</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 theentry 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&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/utmpx.h.html"><i>&lt;utmpx.h&gt;</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 &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; 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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -