git: 3097c0500581 - stable/13 - ksched: correct return code for invalid priority

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Mon, 24 Oct 2022 15:54:16 UTC
The branch stable/13 has been updated by mhorne:

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

commit 3097c0500581151732e5d7a20bdd4e3997cab2d5
Author:     Ali Abdallah <ali.abdallah@suse.com>
AuthorDate: 2022-10-17 18:11:48 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-10-24 15:53:11 +0000

    ksched: correct return code for invalid priority
    
    By convention, EINVAL is returned when validating arguments, not EPERM.
    This matches the documented behaviour of sched_setscheduler(3), and that
    of SCHED_OTHER.
    
    PR:             227735
    MFC after:      1 week
    Reviewed by:    kib, markj
    Differential Revision:  https://reviews.freebsd.org/D37021
    
    (cherry picked from commit ba4782022ac840bd20f4e10cb95ca27d2742333a)
---
 sys/kern/ksched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/ksched.c b/sys/kern/ksched.c
index bf03a46315c2..1d5cfb26cacd 100644
--- a/sys/kern/ksched.c
+++ b/sys/kern/ksched.c
@@ -186,7 +186,7 @@ ksched_setscheduler(struct ksched *ksched, struct thread *td, int policy,
 			    RTP_PRIO_REALTIME;
 			rtp_to_pri(&rtp, td);
 		} else {
-			e = EPERM;
+			e = EINVAL;
 		}
 		break;
 	case SCHED_OTHER: