Main index | Section 3 | 日本語 | Options |
#include <sys/types.h>
#include <login_cap.h>
The setclasscontext() function sets various class context values (resource limits, umask and process priorities) based on values for a specific named class.
The setusercontext() function sets class context values based on a given login_cap_t object and a specific passwd record (if login_cap_t is NULL), the current session's login, and the current process user and group ownership. Each of these actions is selectable via bit-flags passed in the flags parameter, which is comprised of one or more of the following:
LOGIN_SETLOGIN | Set the login associated with the current session to the user specified in the passwd structure using setlogin(2). The pwd parameter must not be NULL if this option is used. |
LOGIN_SETUSER | Set ownership of the current process to the uid specified in the uid parameter using setuid(2). |
LOGIN_SETGROUP | Set group ownership of the current process to the group id specified in the passwd structure using setgid(2), and calls initgroups(3) to set up the group access list for the current process. The pwd parameter must not be NULL if this option is used. |
LOGIN_SETRESOURCES |
Set resource limits for the current process based on values
specified in the system login class database.
Class capability tags used, with and without -cur (soft limit)
or -max (hard limit) suffixes and the corresponding resource
setting:
cputime RLIMIT_CPU filesize RLIMIT_FSIZE datasize RLIMIT_DATA stacksize RLIMIT_STACK coredumpsize RLIMIT_CORE memoryuse RLIMIT_RSS memorylocked RLIMIT_MEMLOCK maxproc RLIMIT_NPROC openfiles RLIMIT_NOFILE sbsize RLIMIT_SBSIZE vmemoryuse RLIMIT_VMEM pseudoterminals RLIMIT_NPTS swapuse RLIMIT_SWAP kqueues RLIMIT_KQUEUES umtxp RLIMIT_UMTXP |
LOGIN_SETPRIORITY |
Set the scheduling priority for the current process based on the
value specified in the system login class database.
Class capability tags used:
priority |
LOGIN_SETUMASK |
Set the umask for the current process to a value in the user or
system login class database.
Class capability tags used:
umask |
LOGIN_SETPATH |
Set the "path" and "manpath" environment variables based on values
in the user or system login class database.
Class capability tags used with the corresponding environment
variables set:
path PATH manpath MANPATH |
LOGIN_SETENV |
Set various environment variables based on values in the user or
system login class database.
Class capability tags used with the corresponding environment
variables set:
lang LANG charset MM_CHARSET timezone TZ term TERM Additional environment variables may be set using the list type capability "setenv=var1 val1,var2 val2..,varN valN". |
LOGIN_SETMAC | Set the MAC label for the current process to the label specified in system login class database. |
LOGIN_SETCPUMASK | Create a new cpuset(2) and set the cpu affinity to the specified mask. The string may contain a comma separated list of numbers and/or number ranges as handled by the cpuset(1) utility or the case-insensitive string ‘default’. If the string is ‘default’ no action will be taken. |
LOGIN_SETLOGINCLASS | |
Set the login class of the current process using setloginclass(2). | |
LOGIN_SETALL | Enables all of the above settings. |
Note that when setting environment variables and a valid passwd pointer is provided in the pwd parameter, the characters ‘amp;~’ and ‘amp;$’ are substituted for the user's home directory and login name respectively.
The setclasscpumask(), setclassresources() and setclassenvironment() functions are subsets of the setcontext functions above, but may be useful in isolation.
LOGIN_CLASS (3) | May 10, 2020 |
Main index | Section 3 | 日本語 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | Some people, when confronted with a problem, think “I know, I'll use regular expressions.” Now they have two problems. | ” |
— Jamie Zawinski |