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