public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12052] New: posix_spawn() nonconformance (POSIX_SPAWN_SETSCHEDPARAM)
@ 2010-09-24 19:25 mtk dot manpages at gmail dot com
0 siblings, 0 replies; only message in thread
From: mtk dot manpages at gmail dot com @ 2010-09-24 19:25 UTC (permalink / raw)
To: glibc-bugs
The POSIX.1-2001 specification of posix_spawn() says the following:
If the POSIX_SPAWN_SETSCHEDPARAM flag is set in the
spawn-flags attribute of the object referenced by attrp,
but POSIX_SPAWN_SETSCHEDULER is not set, the new process
image shall initially have the scheduling policy of the
calling process with the scheduling parameters specified
in the spawn-schedparam attribute of the object refer-
enced by attrp.
If the POSIX_SPAWN_SETSCHEDULER flag is set in the spawn-
flags attribute of the object referenced by attrp
(regardless of the setting of the POSIX_SPAWN_SETSCHED-
PARAM flag), the new process image shall initially have
the scheduling policy specified in the spawn-schedpolicy
attribute of the object referenced by attrp and the
scheduling parameters specified in the spawn-schedparam
attribute of the same object.
However, the glibc source code (sysdeps/posix/spawni.c) is not
consistent with the above specification:
===
#ifdef _POSIX_PRIORITY_SCHEDULING
/* Set the scheduling algorithm and parameters. */
if ((flags & (POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER))
== POSIX_SPAWN_SETSCHEDPARAM)
{
if (__sched_setparam (0, &attrp->__sp) == -1)
_exit (SPAWN_ERROR);
}
else if ((flags & POSIX_SPAWN_SETSCHEDULER) != 0)
{
if (__sched_setscheduler (0, attrp->__policy,
(flags & POSIX_SPAWN_SETSCHEDPARAM) != 0
? &attrp->__sp : NULL) == -1)
_exit (SPAWN_ERROR);
}
#endif
===
There are two problems here:
* &attrp->__sp is used only if POSIX_SPAWN_SETSCHEDPARAM
was *also* specified. However, POSIX is explicit that
POSIX_SPAWN_SETSCHEDPARAM is ignored when
POSIX_SPAWN_SETSCHEDULER is specified.
* If POSIX_SPAWN_SETSCHEDPARAM is not specified, then
the last argument of sched_setscheduler() is NULL.
This yields an EINVAL error from sched_setscheduler()
and a consequent _exit (SPAWN_ERROR) in the child.
The final if statement should simply be:
if (__sched_setscheduler (0, attrp->__policy, &attrp->__sp) == -1)
--
Summary: posix_spawn() nonconformance (POSIX_SPAWN_SETSCHEDPARAM)
Product: glibc
Version: 2.12
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper dot fsp at gmail dot com
ReportedBy: mtk dot manpages at gmail dot com
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=12052
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-09-24 19:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-24 19:25 [Bug libc/12052] New: posix_spawn() nonconformance (POSIX_SPAWN_SETSCHEDPARAM) mtk dot manpages at gmail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).