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

📄 setreuid.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>setreuid</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="setreuid"></a> <a name="tag_03_664"></a><!-- setreuid --> <!--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_664_01"></a>NAME</h4><blockquote>setreuid - set real and effective user IDs</blockquote><h4><a name="tag_03_664_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/unistd.h.html">unistd.h</a>&gt;<br><br> int setreuid(uid_t</tt> <i>ruid</i><tt>, uid_t</tt> <i>euid</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div><tt><br></tt></blockquote><h4><a name="tag_03_664_03"></a>DESCRIPTION</h4><blockquote><p>The <i>setreuid</i>() function shall set the real and effective user IDs of the current process to the values specified by the<i>ruid</i> and <i>euid</i> arguments. If <i>ruid</i> or <i>euid</i> is -1, the corresponding effective or real user ID of thecurrent process shall be left unchanged.</p><p>A process with appropriate privileges can set either ID to any value. An unprivileged process can only set the effective user IDif the <i>euid</i> argument is equal to either the real, effective, or saved user ID of the process.</p><p>It is unspecified whether a process without appropriate privileges is permitted to change the real user ID to match the currentreal, effective, or saved set-user-ID of the process.</p></blockquote><h4><a name="tag_03_664_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and <i>errno</i> set to indicate the error.</p></blockquote><h4><a name="tag_03_664_05"></a>ERRORS</h4><blockquote><p>The <i>setreuid</i>() function shall fail if:</p><dl compact><dt>[EINVAL]</dt><dd>The value of the <i>ruid</i> or <i>euid</i> argument is invalid or out-of-range.</dd><dt>[EPERM]</dt><dd>The current process does not have appropriate privileges, and either an attempt was made to change the effective user ID to avalue other than the real user ID or the saved set-user-ID or an attempt was made to change the real user ID to a value notpermitted by the implementation.</dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_664_06"></a>EXAMPLES</h4><blockquote><h5><a name="tag_03_664_06_01"></a>Setting the Effective User ID to the Real User ID</h5><p>The following example sets the effective user ID of the calling process to the real user ID, so that files created later will beowned by the current user.</p><pre><tt>#include &lt;unistd.h&gt;#include &lt;sys/types.h&gt;...setreuid(getuid(), getuid());...</tt></pre></blockquote><h4><a name="tag_03_664_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_664_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_664_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_664_10"></a>SEE ALSO</h4><blockquote><p><a href="getegid.html"><i>getegid</i>()</a> , <a href="geteuid.html"><i>geteuid</i>()</a> , <a href="getgid.html"><i>getgid</i>()</a> , <a href="getuid.html"><i>getuid</i>()</a> , <a href="setegid.html"><i>setegid</i>()</a> , <ahref="seteuid.html"><i>seteuid</i>()</a> , <a href="setgid.html"><i>setgid</i>()</a> , <a href="setregid.html"><i>setregid</i>()</a> , <a href="setuid.html"><i>setuid</i>()</a> , the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/unistd.h.html"><i>&lt;unistd.h&gt;</i></a></p></blockquote><h4><a name="tag_03_664_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4, Version 2.</p></blockquote><h4><a name="tag_03_664_12"></a>Issue 5</h4><blockquote><p>Moved from X/OPEN UNIX extension to BASE.</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 + -