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

📄 getlogin_r.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>getlogin</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_005_599">&nbsp;</a>NAME</h4><blockquote>getlogin, getlogin_r - get login name</blockquote><h4><a name = "tag_000_005_600">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;<a href="unistd.h.html">unistd.h</a>&gt;char *getlogin(void);int getlogin_r(char *<i>name</i>, size_t <i>namesize</i>);</code></pre></blockquote><h4><a name = "tag_000_005_601">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>getlogin()</i>function returns a pointer toa string giving a user name associated with the calling process,which is the login name associated with the calling process.If<i>getlogin()</i>returns a non-null pointer, then that pointerpoints to the name that theuser logged in under, even if there are several login names with thesame user ID.<p>The<i>getlogin()</i>interface need not be reentrant.<p>The<i>getlogin_r()</i>function puts the name associated by the login activitywith the control terminal of the current processin the character array pointed to by<i>name</i>.The array is<i>namesize</i>characters longand should have space for the name and the terminating null character.The maximum size of the login name is {LOGIN_NAME_MAX}.<p>If<i>getlogin_r()</i>is successful,<i>name</i>points to the name the user used at login,even if there are several login names with the same user ID.</blockquote><h4><a name = "tag_000_005_602">&nbsp;</a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>getlogin()</i>returns a pointer to the login name or a null pointer if the user's login namecannot be found.  Otherwise it returns a null pointerand sets<i>errno</i>to indicate the error.<p>The return value may point to static datawhose content is overwritten by each call.<p>If successful, the<i>getlogin_r()</i>function returns zero.Otherwise, an error number is returned to indicate the error.</blockquote><h4><a name = "tag_000_005_603">&nbsp;</a>ERRORS</h4><blockquote>The<i>getlogin()</i>function may fail if:<dl compact><dt>[EMFILE]<dd>{OPEN_MAX} file descriptors are currently open in the calling process.<dt>[ENFILE]<dd>The maximum allowable number of files is currently open in thesystem.<dt>[ENXIO]<dd>The calling process has no controlling terminal.</dl><p>The <i>getlogin_r()</i>function may fail if:<dl compact><dt>[ERANGE]<dd>The value of<i>namesize</i>is smaller than the length of the stringto be returned including the terminating null character.</dl></blockquote><h4><a name = "tag_000_005_604">&nbsp;</a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_605">&nbsp;</a>APPLICATION USAGE</h4><blockquote>Three names associated with the current process can be determined:<i>getpwuid</i>(<i>geteuid</i>())returns the name associated with the effective user ID of the process;<i>getlogin()</i>returns the name associated with the current login activity; and<i>getpwuid</i>(.Fn<i>getuid</i>)returns the name associated with the real user ID of the process.</blockquote><h4><a name = "tag_000_005_606">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_607">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="getpwnam.html">getpwnam()</a></i>,<i><a href="getpwuid.html">getpwuid()</a></i>,<i><a href="geteuid.html">geteuid()</a></i>,<i><a href="getuid.html">getuid()</a></i>,<i><a href="limits.h.html">&lt;limits.h&gt;</a></i>,<i><a href="unistd.h.html">&lt;unistd.h&gt;</a></i>.</blockquote><h4>DERIVATION</h4><blockquote><i>getlogin()</i> derived from System V Release 2.0.<P><i>getlogin_r()</i> derived from the POSIX Threads Extension (1003.1c-1995).</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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