libc_r: Check attr.sched_inherit for PTHREAD_INHERIT_SCHED, not attr.flags.
libc_r: Add inheritsched check in pthread_attr_setinheritsched().

Per POSIX, "the supported values of inheritsched shall be:

PTHREAD_INHERIT_SCHED
[...]

PTHREAD_EXPLICIT_SCHED
[...]"

And, "the pthread_attr_setinheritsched() function may fail if:

[EINVAL]
The value of inheritsched is not valid."
libthread_xu: Fix wrong return value in pthread_attr_setinheritsched().

If it fails because of an invalid inheritsched, EINVAL must be returned.
pthread_attr.3: Adjust pthread_attr_setinheritsched() return value.
kernel/sched_setscheduler: Fix return value.

sched_setscheduler() shall return EINVAL "if one or more of the
parameters contained in param is outside the valid range for the
specified scheduling policy."
libthread_xu: Properly inherit the creating thread's sched_priority.

When a new thread is created with the inheritsched attribute set to
PTHREAD_INHERIT_SCHED, then it must inherit the sched_priority
scheduling parameter from the creating thread, because POSIX sez:

"The following thread scheduling attributes defined by POSIX.1-2008
are affected by the inheritsched attribute: [...], scheduling parameters
(schedparam), [...]"

Also:

"For SCHED_FIFO and SCHED_RR, the only required member of the sched_param
structure is the priority sched_priority. For SCHED_OTHER, the affected
scheduling parameters are implementation-defined."

For SCHED_OTHER, it will currently inherit the creating thread's
sched_priority too. We'll see if that poses a problem.