Date: Fri, 20 Apr 2018 14:08:55 +0200 From: Ali Abdallah <aliovx@gmail.com> To: freebsd-hackers@freebsd.org Subject: sched_setscheduler returns EPERM instead of EINVAL when sched_priority is out of range Message-ID: <CAO3OKx8PvnE03UwSKmiovi6xt4MRhRYX5ydX=AgY0ORKErz0dg@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hello, I got quite confused when I was getting EPERM from the sched_setscheduler system call on FreeBSD 11.1, thinking at the beginning that I had a permission problem (program uses setuid, and it is launched by normal user). After, I realized that my sched_param.sched_priority value was simply out of range. According to the documentation, [EINVAL] should be returned if the value of the policy argument is invalid, or one or more parameters contained in param is outside the valid range! In ksched.c line 180, the ksched_setscheduler functions returns EPERM when (param->sched_priority >= P1B_PRIO_MIN && param->sched_priority <= P1B_PRIO_MAX), on other Unices, I get EINVAL as expected. Is there is a reason for why FreeBSS handles this differently? Cheers, Ali
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAO3OKx8PvnE03UwSKmiovi6xt4MRhRYX5ydX=AgY0ORKErz0dg>