date and time created 89/07/02 15:22:51 by mckusick
[unix-history] / usr / src / lib / libc / sys / getlogin.2
CommitLineData
1cde5d8e
KF
1.\" Copyright (c) 1989 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms are permitted
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15.\"
16.\" @(#)getlogin.2 1.1 (Berkeley) %G%
17.\"
18.TH GETLOGNAME 2 ""
19.UC 5
20.SH NAME
21getlogname, setlogname \- get/set login name of process owner
22.SH SYNOPSIS
23.nf
24.ft B
25getlogname(name, namelen)
26char *name;
27int namelen;
28.PP
29.ft B
30setlogname(name, namelen)
31char *name;
32int namelen;
33.fi
34.SH DESCRIPTION
35.I Getlogname
36returns the login name of the owner of the current process, as
37previously set by
38.IR setlogname .
39The parameter
40.I namelen
41specifies the size of the
42.I name
43array. The returned name is null-terminated unless insufficient
44space is provided.
45The preferred method for retrieving this information is through the
46.IR getlogin (3)
47library routine.
48.PP
49.I Setlogname
50sets the login name of the process owner to be
51.IR name ,
52which has length
53.IR namelen .
54This call is restricted to the super-user and
55is normally used only at login time, or when a remote shell
56is invoked.
57.SH "RETURN VALUE
58If the call succeeds, a value of 0 is returned. If the call
59fails, then a value of \-1 is returned and an error code is
60placed in the global location \fIerrno\fP.
61.SH "ERRORS
62The following errors may be returned by these calls:
63.TP 15
64[EFAULT]
65The \fIname\fP or \fInamelen\fP parameter gave an
66invalid address.
67.TP 15
68[EPERM]
69The caller tried to set the hostname and was not the super-user.
70.SH SEE ALSO
71getlogin(3)
72.SH BUGS
73Host names are limited to MAXLOGNAME (from
74.IR <sys/user.h> )
75characters, currently 12.