From nobody Wed Nov 11 09:58:13 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jPf921lQ4z6yxbp for ; Wed, 11 Nov 2026 09:58:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jPf916MYvz4l1K for ; Wed, 11 Nov 2026 09:58:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794391093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UGtuss/BtUFQCxBg8GGSBAoSUdCMtIQPTUezBkS1U2U=; b=NwhF5qqjso7bKSARoTfvntAPIKOFthEqsmzpEuxzyXaY5t4GSpM3uoSxdUS0EHuQFdlRGV tb9pc7nDx7SfSYIqxymdiXdx9IkfPLnhyzuJgQzgft1J5Hn+5HojbwGANCTf4xBTwor8mp H9oM9k0SjeVXeqN/AL3OInMb83haE0pG6BZBDa4449ZFfq8av3jUHczNXnP7H7sMCWe0Bg ySFb/sqrzMUb6IJMVhHS0siNXwDYkl4N5uL1/thudeOkXI9jT1EXiMBWSYNh/9E86FMgmu SjNtaEPCYo4TUJdB1eamj9g1+wcmBUMzp7oijBvGnLDDjv+0uI3wTAdsuYIUBw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794391093; b=ciJpbO9Hw4a5o/FKPkIRERMFRSd6IwelwMRxG7wCio9A5kkDP/zisIlCyfnlqKujDL9TjF K0j4k12lN/fdeC7QWVlpW/3HeMsuOfrhs/bjG6/8Zksg4KL0wbWmBuNv9TwcCfat8sCHpV SN6JcG7tgm+4w7RsayMmv8Kzna07itLzQSGEZGtQBfqenG4McOdGcZw/4+wHMBTXp8ymHe z84S+0o//P6dzQyZeEaouPVYRVtmAFyo4nDXBldzXyXOEIYSZlnCJELHGyyMAcy9vuG/Yx NhJP6Ek31ZxeLdE8MrC4b2QgaH9cem3TQskpNxFidM9U7K9sOO8gX4qB0P2pjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794391093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UGtuss/BtUFQCxBg8GGSBAoSUdCMtIQPTUezBkS1U2U=; b=oWdkAt5dt1lhvLPQ2a6q0FjV6HdkCEuVzP0kbn7o5MBVQm58nR5tyZVAcCYxrX9DTsvJmb 9gGyF7XoRisdYCqvgUepGb4HDLsz8Uyey9xh1jkiJONigRyVWND2+5JdORGKYyp8vxIAS1 8Xsbaxhwb2pOY9fNM7VYS6uROtbB+A0qdOG5f6Hphw94GNv4i3tuFbAUu5AAg/HJ8iSv2I kF7e71xr0nJV9MyHaUp4pZex8kHl/0pzgm+ebwGlBC5nwo0x1ucm9ssjnUjDOeH9Xs4NZr cRa5P12sw0o5rnw99Ncvkv93evML/eHduwRHZHAf4SzZ/w9VulcEa42krIX00Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jPf9161yLz18Y6 for ; Wed, 11 Nov 2026 09:58:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 11b92 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 11 Nov 2026 09:58:13 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brooks Davis Subject: git: e5100cd50a05 - main - sched_*(2): add user_ implementations List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: brooks X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5100cd50a051dce571444ab4b8a821580f3dda4 Auto-Submitted: auto-generated Date: Wed, 11 Nov 2026 09:58:13 +0000 Message-Id: <6af43c35.11b92.3a86d4b@gitrepo.freebsd.org> The branch main has been updated by brooks: URL: https://cgit.FreeBSD.org/src/commit/?id=e5100cd50a051dce571444ab4b8a821580f3dda4 commit e5100cd50a051dce571444ab4b8a821580f3dda4 Author: Brooks Davis AuthorDate: 2026-11-11 09:40:40 +0000 Commit: Brooks Davis CommitDate: 2026-11-11 09:40:40 +0000 sched_*(2): add user_ implementations Effort: CHERI upstreaming Sponsored by: Innovate UK Pull Request: https://github.com/freebsd/freebsd-src/pull/2284 --- sys/kern/p1003_1b.c | 52 ++++++++++++++++++++++++++++++++++++++------------- sys/sys/syscallsubr.h | 8 ++++++++ 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/sys/kern/p1003_1b.c b/sys/kern/p1003_1b.c index 6259f7092487..96730f22596c 100644 --- a/sys/kern/p1003_1b.c +++ b/sys/kern/p1003_1b.c @@ -108,22 +108,29 @@ sched_attach(void) int sys_sched_setparam(struct thread *td, struct sched_setparam_args *uap) +{ + return (user_sched_setparam(td, uap->pid, uap->param)); +} + +int +user_sched_setparam(struct thread *td, pid_t pid, + const struct sched_param *param) { struct thread *targettd; struct proc *targetp; int e; struct sched_param sched_param; - e = copyin(uap->param, &sched_param, sizeof(sched_param)); + e = copyin(param, &sched_param, sizeof(sched_param)); if (e) return (e); - if (uap->pid == 0) { + if (pid == 0) { targetp = td->td_proc; targettd = td; PROC_LOCK(targetp); } else { - targetp = pfind(uap->pid); + targetp = pfind(pid); if (targetp == NULL) return (ESRCH); targettd = FIRST_THREAD_IN_PROC(targetp); @@ -153,18 +160,24 @@ kern_sched_setparam(struct thread *td, struct thread *targettd, int sys_sched_getparam(struct thread *td, struct sched_getparam_args *uap) +{ + return (user_sched_getparam(td, uap->pid, uap->param)); +} + +int +user_sched_getparam(struct thread *td, pid_t pid, struct sched_param *param) { int e; struct sched_param sched_param; struct thread *targettd; struct proc *targetp; - if (uap->pid == 0) { + if (pid == 0) { targetp = td->td_proc; targettd = td; PROC_LOCK(targetp); } else { - targetp = pfind(uap->pid); + targetp = pfind(pid); if (targetp == NULL) { return (ESRCH); } @@ -174,7 +187,7 @@ sys_sched_getparam(struct thread *td, struct sched_getparam_args *uap) e = kern_sched_getparam(td, targettd, &sched_param); PROC_UNLOCK(targetp); if (e == 0) - e = copyout(&sched_param, uap->param, sizeof(sched_param)); + e = copyout(&sched_param, param, sizeof(sched_param)); return (e); } @@ -196,29 +209,35 @@ kern_sched_getparam(struct thread *td, struct thread *targettd, int sys_sched_setscheduler(struct thread *td, struct sched_setscheduler_args *uap) +{ + return (user_sched_setscheduler(td, uap->pid, uap->policy, uap->param)); +} + +int +user_sched_setscheduler(struct thread *td, pid_t pid, int policy, + const struct sched_param *param) { int e; struct sched_param sched_param; struct thread *targettd; struct proc *targetp; - e = copyin(uap->param, &sched_param, sizeof(sched_param)); + e = copyin(param, &sched_param, sizeof(sched_param)); if (e) return (e); - if (uap->pid == 0) { + if (pid == 0) { targetp = td->td_proc; targettd = td; PROC_LOCK(targetp); } else { - targetp = pfind(uap->pid); + targetp = pfind(pid); if (targetp == NULL) return (ESRCH); targettd = FIRST_THREAD_IN_PROC(targetp); } - e = kern_sched_setscheduler(td, targettd, uap->policy, - &sched_param); + e = kern_sched_setscheduler(td, targettd, policy, &sched_param); PROC_UNLOCK(targetp); return (e); } @@ -320,13 +339,20 @@ sys_sched_get_priority_min(struct thread *td, int sys_sched_rr_get_interval(struct thread *td, struct sched_rr_get_interval_args *uap) +{ + return (user_sched_rr_get_interval(td, uap->pid, uap->interval)); +} + +int +user_sched_rr_get_interval(struct thread *td, pid_t pid, + struct timespec *interval) { struct timespec timespec; int error; - error = kern_sched_rr_get_interval(td, uap->pid, ×pec); + error = kern_sched_rr_get_interval(td, pid, ×pec); if (error == 0) - error = copyout(×pec, uap->interval, sizeof(timespec)); + error = copyout(×pec, interval, sizeof(timespec)); return (error); } diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 4b9000c6d39a..ea9667f0cf3d 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -549,6 +549,14 @@ int user_jail_get(struct thread *td, struct iovec *iovp, int user_jail_set(struct thread *td, struct iovec *iovp, unsigned int iovcnt, int flags, copyinuio_t *copyinuio_f); int user_kldload(struct thread *td, const char *file); +int user_sched_getparam(struct thread *td, pid_t pid, + struct sched_param *param); +int user_sched_rr_get_interval(struct thread *td, pid_t pid, + struct timespec *interval); +int user_sched_setparam(struct thread *td, pid_t pid, + const struct sched_param *param); +int user_sched_setscheduler(struct thread *td, pid_t pid, int policy, + const struct sched_param *param); int user_setgroups(struct thread *td, int gidsetsize, const gid_t *gidset); int user_settimeofday(struct thread *td, const struct timeval *tv, const struct timezone *tz);