* [Xenomai-core] [PATCH] fix pthread_create regression
@ 2007-07-08 20:17 Jan Kiszka
0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2007-07-08 20:17 UTC (permalink / raw)
To: Philippe Gerum; +Cc: Gilles Chanteperdrix, xenomai-core
[-- Attachment #1.1: Type: text/plain, Size: 298 bytes --]
My rt-caps patch included an ugly regression for the posix skin:
pthread_create fails if the caller passes SCHED_FIFO + a priority > 0 in
the thread attribute. It's observable via switchtest for instance. This
patch should fix it.
Note that 2.3.x urgently needs this patch as well!
Jan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: fix-pthread_create-param-overwrite.patch --]
[-- Type: text/x-patch; name="fix-pthread_create-param-overwrite.patch", Size: 1296 bytes --]
Index: src/skins/posix/thread.c
===================================================================
--- src/skins/posix/thread.c (Revision 2756)
+++ src/skins/posix/thread.c (Arbeitskopie)
@@ -139,7 +139,7 @@ int __wrap_pthread_create(pthread_t *tid
if (!attr) {
policy = SCHED_OTHER;
- param.sched_priority = 0;
+ iargs.prio = 0;
} else {
pthread_attr_getinheritsched(attr, &inherit);
if (inherit == PTHREAD_EXPLICIT_SCHED) {
@@ -149,12 +149,15 @@ int __wrap_pthread_create(pthread_t *tid
/* inherit == PTHREAD_INHERIT_SCHED */
__wrap_pthread_getschedparam(pthread_self(),
&policy, ¶m);
+ iargs.prio = param.sched_priority;
/* Work around linuxthreads shortcoming: it doesn't believe
that it could have RT power as non-root and fails the
thread creation overeagerly. */
memcpy(&iattr, attr, sizeof(pthread_attr_t));
+ param.sched_priority = 0;
pthread_attr_setschedpolicy(&iattr, SCHED_OTHER);
+ pthread_attr_setschedparam(&iattr, ¶m);
attr = &iattr;
}
@@ -164,7 +167,6 @@ int __wrap_pthread_create(pthread_t *tid
iargs.start = start;
iargs.arg = arg;
iargs.policy = policy;
- iargs.prio = param.sched_priority;
iargs.ret = EAGAIN;
__real_sem_init(&iargs.sync, 0, 0);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-08 20:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-08 20:17 [Xenomai-core] [PATCH] fix pthread_create regression Jan Kiszka
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.