Commit | Line | Data |
---|---|---|
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 | |
21 | getlogname, setlogname \- get/set login name of process owner | |
22 | .SH SYNOPSIS | |
23 | .nf | |
24 | .ft B | |
25 | getlogname(name, namelen) | |
26 | char *name; | |
27 | int namelen; | |
28 | .PP | |
29 | .ft B | |
30 | setlogname(name, namelen) | |
31 | char *name; | |
32 | int namelen; | |
33 | .fi | |
34 | .SH DESCRIPTION | |
35 | .I Getlogname | |
36 | returns the login name of the owner of the current process, as | |
37 | previously set by | |
38 | .IR setlogname . | |
39 | The parameter | |
40 | .I namelen | |
41 | specifies the size of the | |
42 | .I name | |
43 | array. The returned name is null-terminated unless insufficient | |
44 | space is provided. | |
45 | The preferred method for retrieving this information is through the | |
46 | .IR getlogin (3) | |
47 | library routine. | |
48 | .PP | |
49 | .I Setlogname | |
50 | sets the login name of the process owner to be | |
51 | .IR name , | |
52 | which has length | |
53 | .IR namelen . | |
54 | This call is restricted to the super-user and | |
55 | is normally used only at login time, or when a remote shell | |
56 | is invoked. | |
57 | .SH "RETURN VALUE | |
58 | If the call succeeds, a value of 0 is returned. If the call | |
59 | fails, then a value of \-1 is returned and an error code is | |
60 | placed in the global location \fIerrno\fP. | |
61 | .SH "ERRORS | |
62 | The following errors may be returned by these calls: | |
63 | .TP 15 | |
64 | [EFAULT] | |
65 | The \fIname\fP or \fInamelen\fP parameter gave an | |
66 | invalid address. | |
67 | .TP 15 | |
68 | [EPERM] | |
69 | The caller tried to set the hostname and was not the super-user. | |
70 | .SH SEE ALSO | |
71 | getlogin(3) | |
72 | .SH BUGS | |
73 | Host names are limited to MAXLOGNAME (from | |
74 | .IR <sys/user.h> ) | |
75 | characters, currently 12. |