http://www.python.org/dev/buildbot/all/builders/x86%20FreeBSD%206.4%203.x/builds/1734/steps/test/logs/stdio
"""
======================================================================
ERROR: test_get_and_set_scheduler_and_param (test.test_posix.PosixTester)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/test_posix.py", line 878, in test_get_and_set_scheduler_and_param
posix.sched_setparam(0, param)
OSError: [Errno 22] Invalid argument
----------------------------------------------------------------------
"""
The reason is quite simple:
http://freebsd.active-venture.com/FreeBSD-srctree/newsrc/posix4/ksched.c.html
"""
/*
* XXX About priorities
*
* POSIX 1003.1b requires that numerically higher priorities be of
* higher priority. It also permits sched_setparam to be
* implementation defined for SCHED_OTHER. I don't like
* the notion of inverted priorites for normal processes when
* you can use "setpriority" for that.
*
* I'm rejecting sched_setparam for SCHED_OTHER with EINVAL.
*/
[...]
int ksched_setparam(register_t *ret, struct ksched *ksched,
struct proc *p, const struct sched_param *param)
{
register_t policy;
int e;
e = getscheduler(&policy, ksched, p);
if (e == 0)
{
if (policy == SCHED_OTHER)
e = EINVAL;
else
e = ksched_setscheduler(ret, ksched, p, policy, param);
}
return e;
}
"""
And indeed, sched_setparam is implementation-defined if the process' scheduling policy is SCHED_OTHER, see http://pubs.opengroup.org/onlinepubs/007908799/xsh/sched_setparam.html
"""
If the current scheduling policy for the process specified by pid is not SCHED_FIFO or SCHED_RR, including SCHED_OTHER, the result is implementation-dependent.
"""
It seems that FreeBSD made the choice of returning EINVAL, but it changed in recent versions (the test passes on FreeBSD 8).
I'm not sure about the best solution though:
1) don't perform this test if the scheduling policy is not SCHED_RR or SCHED_FIFO
2) skip this test on FreeBSD versions that return EINVAL (maybe adding a new requires_freebsd_version to test.support)
|