Print this page
11622 clean up rarer mandoc lint warnings
*** 47,57 ****
.\"
.TH GETLOGIN 3C "Mar 15, 2014"
.SH NAME
getlogin, getlogin_r \- get login name
.SH SYNOPSIS
- .LP
.nf
#include <unistd.h>
\fBchar *\fR\fBgetlogin\fR(\fBvoid\fR);
.fi
--- 47,56 ----
*** 60,79 ****
.nf
\fBchar *\fR\fBgetlogin_r\fR(\fBchar *\fR\fIname\fR, \fBint\fR \fInamelen\fR);
.fi
.SS "Standard conforming"
- .LP
.nf
cc [ \fIflag \fR... ] \fIfile\fR... \fB-D_POSIX_PTHREAD_SEMANTICS\fR [ \fIlibrary \fR... ]
\fBint\fR \fBgetlogin_r\fR(\fBchar *\fR\fIname\fR, \fBsize_t\fR \fInamesize\fR);
.fi
.SH DESCRIPTION
- .sp
- .LP
The \fBgetlogin()\fR function returns a pointer to the login name as found in
\fB/var/adm/utmpx\fR. It can be used in conjunction with \fBgetpwnam\fR(3C) to
locate the correct password file entry when the same user \fBID\fR is shared by
several login names.
.sp
--- 59,75 ----
*** 104,114 ****
terminal, it returns a null pointer. The correct procedure for determining the
login name is to call \fBcuserid\fR(3C), or to call \fBgetlogin()\fR and if it
fails to call \fBgetpwuid\fR(3C).
.sp
.LP
-
The \fBgetlogin_r()\fR function has the same functionality as \fBgetlogin()\fR
except that the caller must supply a buffer \fIname\fR with length \fInamelen\fR
to store the result. The \fIname\fR buffer should be at least
\fBLOGIN_NAME_MAX\fR bytes in size (defined in <\fBlimits.h\fR>). The POSIX
version (see \fBstandards\fR(5)) of \fBgetlogin_r()\fR takes a \fInamesize\fR
--- 100,109 ----
*** 116,137 ****
the size of \fBLOGIN_NAME_MAX\fR and the name, including the null
terminator, does not fit inside the buffer, than an error will be generated.
Otherwise, the buffer \fIname\fR will be updated with the login name.
.SH RETURN VALUES
- .sp
- .LP
Upon successful completion, \fBgetlogin()\fR returns a pointer to the login
name or a null pointer if the user's login name cannot be found. Otherwise it
returns a null pointer and sets \fBerrno\fR to indicate the error.
.sp
.LP
The standard-conforming \fBgetlogin_r()\fR returns \fB0\fR if successful, or
the error number upon failure.
.SH ERRORS
- .sp
- .LP
The \fBgetlogin_r()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBERANGE\fR\fR
--- 111,128 ----
*** 191,202 ****
.RS 10n
The size of the buffer is smaller than the result to be returned.
.RE
.SH USAGE
- .sp
- .LP
The return value of \fBgetlogin()\fR points to thread-specific data whose
content is overwritten on each call by the same thread.
.sp
.LP
Three names associated with the current process can be determined:
--- 182,191 ----
*** 203,213 ****
\fBgetpwuid(\fR\fBgeteuid()\fR\fB)\fR returns the name associated with the
effective user ID of the process; \fBgetlogin()\fR returns the name associated
with the current login activity; and \fBgetpwuid(\fR\fBgetuid()\fR\fB)\fR
returns the name associated with the real user ID of the process.
.SH FILES
- .sp
.ne 2
.na
\fB\fB/var/adm/utmpx\fR\fR
.ad
.RS 18n
--- 192,201 ----
*** 231,242 ****
.RS 18n
A 64-bit compatibility library to return long login names.
.RE
.SH ATTRIBUTES
- .sp
- .LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
--- 219,228 ----
*** 249,266 ****
_
MT-Level See below.
.TE
.SH SEE ALSO
- .sp
- .LP
\fBgeteuid\fR(2), \fBgetuid\fR(2), \fBcuserid\fR(3C), \fBgetgrnam\fR(3C),
\fBgetpwnam\fR(3C), \fBgetpwuid\fR(3C), \fButmpx\fR(4), \fBattributes\fR(5),
\fBstandards\fR(5)
.SH NOTES
- .sp
- .LP
When compiling multithreaded programs, see \fBIntro\fR(3).
.sp
.LP
The \fBgetlogin()\fR function is safe to use in multithreaded applications, but
is discouraged. The \fBgetlogin_r()\fR function should be used instead.
--- 235,248 ----