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 July 12, 2016 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 44The 45.Fn getloginclass 46routine returns the login class name associated with the calling process, 47as previously set by 48.Fn setloginclass . 49The caller must provide the buffer 50.Fa name 51with length 52.Fa len 53bytes to hold the result. 54The buffer should be at least 55.Dv MAXLOGNAME 56bytes in length. 57.Pp 58The 59.Fn setloginclass 60system call sets the login class of the calling process to 61.Fa name . 62This system call is restricted to the super-user, and is normally used 63only 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). 65Processes inherit login class from their parents. 66.Sh RETURN VALUES 67.Rv -std 68.Sh ERRORS 69The following errors may be returned by these calls: 70.Bl -tag -width Er 71.It Bq Er EFAULT 72The 73.Fa name 74argument gave an invalid address. 75.It Bq Er EINVAL 76The 77.Fa name 78argument pointed to a string that was too long. 79Login class names are limited to 80.Dv MAXLOGNAME 81(from 82.In sys/param.h ) 83characters, currently 33 including null. 84.It Bq Er EPERM 85The caller tried to set the login class and was not the super-user. 86.It Bq Er ENAMETOOLONG 87The size of the buffer is smaller than the result to be returned. 88.El 89.Sh SEE ALSO 90.Xr ps 1 , 91.Xr setusercontext 3 , 92.Xr login.conf 5 , 93.Xr rctl 8 94.Sh HISTORY 95The 96.Fn getloginclass 97and 98.Fn setloginclass 99system calls first appeared in 100.Fx 9.0 . 101