Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Feb 2024 21:31:19 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: a8c273b3c97f - stable/14 - setclasspriority(): New possible value 'inherit'
Message-ID:  <202402012131.411LVJg3080909@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=a8c273b3c97fa3d0eaf566136d3784257f137d6e

commit a8c273b3c97fa3d0eaf566136d3784257f137d6e
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2023-06-21 08:53:37 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2024-02-01 21:29:55 +0000

    setclasspriority(): New possible value 'inherit'
    
    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
    
    (cherry picked from commit d162d7e2ad327ceada4102c5d6779f9ecd809502)
    
    Approved by:            markj (mentor)
---
 lib/libutil/login_class.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
index 9d8dc652d678..f545e3661520 100644
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -463,9 +463,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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402012131.411LVJg3080909>