* [Xenomai-help] pthread_setschedparam() segfault using Xenomai 2.5.2
@ 2010-05-26 15:23 Stephen Bryant
2010-05-26 15:33 ` Gilles Chanteperdrix
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Bryant @ 2010-05-26 15:23 UTC (permalink / raw)
To: xenomai
[-- Attachment #1.1: Type: text/plain, Size: 754 bytes --]
Hi,
I am receiving a segfault when calling pthread_setschedparam(). Both the
thread and the scheduling parameters are initialised to appropraite values,
and I am using SCHED_FIFO. Attached is example code, similar to my
application (rather than minimalist), that reproduces the error when
compiled for Xenomai (with '--skin=posix --ldflags' and '--cflags'), while
running cleanly when compiled for standard linux.
Is this a problem with pthread_setschedparam(), or am I doing something
wrong? If you need any more information then let me know.
I am running:
Linux kernel 2.6.32.8
Adeos patch adeos-ipipe-2.6.32.7-x86-2.6-01.patch (it patched cleanly onto
2.6.32.8)
Xenomai 2.5.2
Processor: Core 2 Duo (kernel is compiled to use only 1 core)
Steve
[-- Attachment #1.2: Type: text/html, Size: 815 bytes --]
[-- Attachment #2: SchedParam.cpp --]
[-- Type: text/x-c++src, Size: 1649 bytes --]
#ifdef __XENO__
#include <posix/posix.h>
#include <sys/mman.h>
#else
#include <pthread.h>
#endif // __XENO__
#include <stdio.h>
#include <unistd.h>
typedef void* (*ENTRYPOINT)(void*);
struct ThreadArgs
{
public:
ENTRYPOINT pFcn;
void* pFcnArgs;
int Priority;
};
void *ThreadWrapper(void *pArgs);
void TestFcn();
int main()
{
#ifdef __XENO__
mlockall(MCL_CURRENT | MCL_FUTURE);
#endif //__XENO__
pthread_t* pThread = new pthread_t();;
struct ThreadArgs *pTArgs = new struct ThreadArgs;
pthread_attr_t ThreadCustomAttr;
pthread_attr_init(&ThreadCustomAttr);
#ifdef __XENO__
pthread_attr_setstacksize(&ThreadCustomAttr, PTHREAD_STACK_MIN + 10000);
#else
pthread_attr_setstacksize(&ThreadCustomAttr, 20000);
#endif // __XENO__
pthread_attr_setdetachstate(&ThreadCustomAttr, PTHREAD_CREATE_DETACHED);
pthread_attr_setinheritsched(&ThreadCustomAttr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setscope(&ThreadCustomAttr, PTHREAD_SCOPE_PROCESS);
pTArgs->pFcn = (ENTRYPOINT) TestFcn;
pTArgs->pFcnArgs = NULL;
pTArgs->Priority = 60;
pthread_create(pThread, &ThreadCustomAttr, ThreadWrapper, (void *) pTArgs);
if(pThread != NULL) { delete pThread; }
sleep(3);
return 0;
}
void *ThreadWrapper(void *pArgs)
{
void *pResult;
struct ThreadArgs *pTArgs = (struct ThreadArgs *) pArgs;
struct sched_param SchedParam;
SchedParam.sched_priority = pTArgs->Priority;
pthread_setschedparam(pthread_self(), SCHED_FIFO, &SchedParam);
pResult = (void *) pTArgs->pFcn(pTArgs->pFcnArgs);
delete pTArgs;
return pResult;
}
void TestFcn()
{
printf("Made it\n");
}
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Xenomai-help] pthread_setschedparam() segfault using Xenomai 2.5.2 2010-05-26 15:23 [Xenomai-help] pthread_setschedparam() segfault using Xenomai 2.5.2 Stephen Bryant @ 2010-05-26 15:33 ` Gilles Chanteperdrix 2010-05-26 15:35 ` Stephen Bryant [not found] ` <AANLkTik4hSCdh03zRoiqLGfaF3RftwzhuWz-Qbfo7BDv@domain.hid> 0 siblings, 2 replies; 5+ messages in thread From: Gilles Chanteperdrix @ 2010-05-26 15:33 UTC (permalink / raw) To: Stephen Bryant; +Cc: xenomai Stephen Bryant wrote: > (...) > Xenomai 2.5.2 Could you try Xenomai 2.5.3 ? -- Gilles. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] pthread_setschedparam() segfault using Xenomai 2.5.2 2010-05-26 15:33 ` Gilles Chanteperdrix @ 2010-05-26 15:35 ` Stephen Bryant [not found] ` <AANLkTik4hSCdh03zRoiqLGfaF3RftwzhuWz-Qbfo7BDv@domain.hid> 1 sibling, 0 replies; 5+ messages in thread From: Stephen Bryant @ 2010-05-26 15:35 UTC (permalink / raw) To: xenomai [-- Attachment #1: Type: text/plain, Size: 314 bytes --] Already compiling the kernel, but it may have to wait until tomorrow, Steve On 26 May 2010 16:33, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org > wrote: > Stephen Bryant wrote: > > (...) > > Xenomai 2.5.2 > > Could you try Xenomai 2.5.3 ? > > -- > Gilles. > [-- Attachment #2: Type: text/html, Size: 657 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <AANLkTik4hSCdh03zRoiqLGfaF3RftwzhuWz-Qbfo7BDv@domain.hid>]
[parent not found: <4BFD400F.1080307@domain.hid>]
* Re: [Xenomai-help] pthread_setschedparam() segfault using Xenomai 2.5.2 [not found] ` <4BFD400F.1080307@domain.hid> @ 2010-05-26 16:08 ` Stephen Bryant 2010-05-26 16:22 ` Gilles Chanteperdrix 0 siblings, 1 reply; 5+ messages in thread From: Stephen Bryant @ 2010-05-26 16:08 UTC (permalink / raw) To: xenomai-help [-- Attachment #1: Type: text/plain, Size: 663 bytes --] On 26 May 2010 16:36, Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org > wrote: > Stephen Bryant wrote: > > Already compiling the kernel, but the results may have to wait until > > tomorrow, > > If it is the bug I am thinking it is, then you do not need to recompile > the kernel, recompiling user-space support should be enough. > > > -- > Gilles. > Using Xenomai 2.5.3 has resolved the problem - and you were right that I did not need to recompile the kernel, just the user-space support. I'm guessing this is the 'posix wrappers: avoid undefined reference with uclibc' mentioned in the announcement? Steve [-- Attachment #2: Type: text/html, Size: 1037 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Xenomai-help] pthread_setschedparam() segfault using Xenomai 2.5.2 2010-05-26 16:08 ` Stephen Bryant @ 2010-05-26 16:22 ` Gilles Chanteperdrix 0 siblings, 0 replies; 5+ messages in thread From: Gilles Chanteperdrix @ 2010-05-26 16:22 UTC (permalink / raw) To: Stephen Bryant; +Cc: xenomai-help Stephen Bryant wrote: > On 26 May 2010 16:36, Gilles Chanteperdrix > <gilles.chanteperdrix@xenomai.org > <mailto:gilles.chanteperdrix@xenomai.org>> wrote: > > Stephen Bryant wrote: > > Already compiling the kernel, but the results may have to wait until > > tomorrow, > > If it is the bug I am thinking it is, then you do not need to recompile > the kernel, recompiling user-space support should be enough. > > > -- > Gilles. > > > Using Xenomai 2.5.3 has resolved the problem - and you were right that I > did not need to recompile the kernel, just the user-space support. I'm > guessing this is the 'posix wrappers: avoid undefined reference with > uclibc' mentioned in the announcement? It should be: http://git.xenomai.org/?p=xenomai-2.5.git;a=blobdiff;f=src/skins/common/bind.c;h=d511072c9a0d5b9ccac30b030e0e0266114174a4;hp=352c4e80de5b66442f86820a183d599234951b4e;hb=428aa42410efe575f7bb9729447e6dc49159ef5e;hpb=4dc4361cef9025d125a7a28e5ca02d82c6854345 -- Gilles. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-26 16:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26 15:23 [Xenomai-help] pthread_setschedparam() segfault using Xenomai 2.5.2 Stephen Bryant
2010-05-26 15:33 ` Gilles Chanteperdrix
2010-05-26 15:35 ` Stephen Bryant
[not found] ` <AANLkTik4hSCdh03zRoiqLGfaF3RftwzhuWz-Qbfo7BDv@domain.hid>
[not found] ` <4BFD400F.1080307@domain.hid>
2010-05-26 16:08 ` Stephen Bryant
2010-05-26 16:22 ` Gilles Chanteperdrix
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.