]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libc/sys/getloginclass.2
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libc / sys / getloginclass.2
1 .\"-
2 .\" Copyright (c) 2011 Edward Tomasz Napierala
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .Dd March 6, 2011
29 .Dt GETLOGINCLASS 2
30 .Os
31 .Sh NAME
32 .Nm getloginclass ,
33 .Nm setloginclass
34 .Nd get/set login class
35 .Sh LIBRARY
36 .Lb libc
37 .Sh SYNOPSIS
38 .In unistd.h
39 .Ft int
40 .Fn getloginclass "char *name" "size_t len"
41 .Ft int
42 .Fn setloginclass "const char *name"
43 .Sh DESCRIPTION
44 The
45 .Fn getloginclass
46 routine returns the login class name associated with the calling process,
47 as previously set by
48 .Fn setloginclass .
49 The caller must provide the buffer
50 .Fa name
51 with length
52 .Fa len
53 bytes to hold the result.
54 The buffer should be at least
55 .Dv MAXLOGNAME
56 bytes in length.
57 .Pp
58 The
59 .Fn setloginclass
60 system call sets the login class of the calling process to
61 .Fa name .
62 This system call is restricted to the super-user, and is normally used
63 only when a new session is being created on behalf of the named user
64 (for example, at login time, or when a remote shell is invoked).
65 Processes inherit login class from their parents.
66 .Sh RETURN VALUES
67 .Rv -std
68 .Sh ERRORS
69 The following errors may be returned by these calls:
70 .Bl -tag -width Er
71 .It Bq Er EFAULT
72 The
73 .Fa name
74 argument gave an invalid address.
75 .It Bq Er EINVAL
76 The
77 .Fa name
78 argument pointed to a string that was too long.
79 Login class names are limited to
80 .Dv MAXLOGNAME
81 (from
82 .In sys/param.h )
83 characters, currently 17 including null.
84 .It Bq Er EPERM
85 The caller tried to set the login class and was not the super-user.
86 .It Bq Er ENAMETOOLONG
87 The size of the buffer is smaller than the result to be returned.
88 .El
89 .Sh SEE ALSO
90 .Xr setusercontext 3
91 .Sh HISTORY
92 The
93 .Fn getloginclass
94 and
95 .Fn setloginclass
96 system calls first appeared in
97 .Fx 9.0 .