All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>,
	xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH] fix pthread_create regression
Date: Sun, 08 Jul 2007 22:17:12 +0200	[thread overview]
Message-ID: <46914648.4000801@domain.hid> (raw)


[-- 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, &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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

                 reply	other threads:[~2007-07-08 20:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46914648.4000801@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=gilles.chanteperdrix@xenomai.org \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.