Skip to content

Commit

Permalink
setclasspriority(): New possible value 'inherit'
Browse files Browse the repository at this point in the history
It indicates to the login.conf machinery (setusercontext() /
setclasscontext()) to leave priority alone, effectively inheriting it
from the parent process.

PR:                     271749
Reviewed by:            emaste, yuripv
Approved by:            emaste (mentor)
MFC after:              3 days
Relnotes:               yes
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40690
  • Loading branch information
OlCe2 committed Jan 29, 2024
1 parent 7b94ec5 commit d162d7e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/libutil/login_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,15 @@ static void
setclasspriority(login_cap_t * const lc, struct passwd const * const pwd)
{
const rlim_t def_val = LOGIN_DEFPRI, err_val = INT64_MIN;
rlim_t p = login_getcapnum(lc, "priority", def_val, err_val);
rlim_t p;
int rc;

/* If value is "inherit", nothing to change. */
if (login_getcapenum(lc, "priority", inherit_enum) == 0)
return;

p = login_getcapnum(lc, "priority", def_val, err_val);

if (p == err_val) {
/* Invariant: 'lc' != NULL. */
syslog(LOG_WARNING,
Expand Down

0 comments on commit d162d7e

Please sign in to comment.