📄 endgrent.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>endgrent</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="endgrent"></a> <a name="tag_03_117"></a><!-- endgrent --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_117_01"></a>NAME</h4><blockquote>endgrent, getgrent, setgrent - group database entry functions</blockquote><h4><a name="tag_03_117_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/grp.h.html">grp.h</a>><br><br> void endgrent(void);<br> struct group *getgrent(void);<br> void setgrent(void); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_117_03"></a>DESCRIPTION</h4><blockquote><p>The <i>getgrent</i>() function shall return a pointer to a structure containing the broken-out fields of an entry in the groupdatabase. When first called, <i>getgrent</i>() shall return a pointer to a <b>group</b> structure containing the first entry in thegroup database. Thereafter, it shall return a pointer to a <b>group</b> structure containing the next group structure in the groupdatabase, so successive calls may be used to search the entire database.</p><p>An implementation that provides extended security controls may impose further implementation-defined restrictions on accessingthe group database. In particular, the system may deny the existence of some or all of the group database entries associated withgroups other than those groups associated with the caller and may omit users other than the caller from the list of members ofgroups in database entries that are returned.</p><p>The <i>setgrent</i>() function shall rewind the group database to allow repeated searches.</p><p>The <i>endgrent</i>() function may be called to close the group database when processing is complete.</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_117_04"></a>RETURN VALUE</h4><blockquote><p>When first called, <i>getgrent</i>() shall return a pointer to the first group structure in the group database. Upon subsequentcalls it shall return the next group structure in the group database. The <i>getgrent</i>() function shall return a null pointer onend-of-file or an error and <i>errno</i> may be set to indicate the error.</p><p>The return value may point to a static area which is overwritten by a subsequent call to <a href="../functions/getgrgid.html"><i>getgrgid</i>()</a>, <a href="../functions/getgrnam.html"><i>getgrnam</i>()</a>, or<i>getgrent</i>().</p></blockquote><h4><a name="tag_03_117_05"></a>ERRORS</h4><blockquote><p>The <i>getgrent</i>() function may fail if:</p><dl compact><dt>[EINTR]</dt><dd>A signal was caught during the operation.</dd><dt>[EIO]</dt><dd>An I/O error has occurred.</dd><dt>[EMFILE]</dt><dd>{OPEN_MAX} file descriptors are currently open in the calling process.</dd><dt>[ENFILE]</dt><dd>The maximum allowable number of files is currently open in the system.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_117_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_117_07"></a>APPLICATION USAGE</h4><blockquote><p>These functions are provided due to their historical usage. Applications should avoid dependencies on fields in the groupdatabase, whether the database is a single file, or where in the file system name space the database resides. Applications shoulduse <a href="../functions/getgrnam.html"><i>getgrnam</i>()</a> and <a href="../functions/getgrgid.html"><i>getgrgid</i>()</a>whenever possible because it avoids these dependencies.</p></blockquote><h4><a name="tag_03_117_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_117_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_117_10"></a>SEE ALSO</h4><blockquote><p><a href="getgrgid.html"><i>getgrgid</i>()</a> , <a href="getgrnam.html"><i>getgrnam</i>()</a> , <a href="getlogin.html"><i>getlogin</i>()</a> , <a href="getpwent.html"><i>getpwent</i>()</a> , the Base Definitions volume ofIEEE Std 1003.1-2001, <a href="../basedefs/grp.h.html"><i><grp.h></i></a></p></blockquote><h4><a name="tag_03_117_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4, Version 2.</p></blockquote><h4><a name="tag_03_117_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 RETURN VALUE section.</p><p>A note indicating that these functions need not be reentrant is added to the DESCRIPTION.</p></blockquote><h4><a name="tag_03_117_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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -