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
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, &param);
+		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, &param);
 		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: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to