Problem with posix skin and Xenomai 2.1.0
Hi,
I am experiencing problems with xenomai 2.1.0 and pthread_mutex_init. The second initialization in the following program returns with a value of 16 (EBUSY). What is wrong with the code (or with xenomai)?
Thanks in advance,
Jens
---------------------------------------
#include <pthread.h>
#include <stdio.h>
int main( int argc, char *argv[] )
{
pthread_mutex_t m1;
pthread_mutex_t m2;
int ret;
if ( (ret = pthread_mutex_init( &m1, NULL ) ) )
{
printf("First init failed, ret=%i\n", ret );
return ret;
}
/* sleep(1); */
if ( ( ret = pthread_mutex_init( &m2, NULL ) ) )
{
printf("Second init failed, ret=%i\n", ret );
return ret;
}
printf("Done\n");
return 0;
}--------------------------------------
I am using xenomai 2.1.0 and kernel 2.6.15.7 compiled with gcc 3.3.5 (SuSE 9.3).
The program does work
- when using xenomai 2.1-rc2
- when compiling without xenomai
- when sleep(1) is inserted between the calls to pthread_mutex_init
The program does not work
- when using kernel 2.6.14.6
- with mutex initialization after pthread_setschedparam( pthread_self(), SCHED_FIFO, ... );
- with mutex initialization in a newly created, SCHED_FIFO enabled thread
- when using pthread_mutexattr_t structures for initialization
- on different processors: Athlon 64 2800+ (build system) and VIA Samuel 2 533Mhz (target system)
Here is some more information, which might be helpful:
root: cat /proc/cmdline
auto BOOT_IMAGE=xenomai rw root=100 init=/linuxrc ramdisk_size=8196 noapic noacpi noapm
root: grep /configure /usr/src/xenomai-build/config.log
$ ../xenomai-2.1.0/configure --enable-x86-tsc --enable-debug
root: zcat /proc/config.gz|grep XENO |grep -v "not set" CONFIG_XENOMAI=yCONFIG_XENO_OPT_NUCLEUS=y CONFIG_XENO_OPT_PERVASIVE=y CONFIG_XENO_OPT_PIPE=y CONFIG_XENO_OPT_PIPE_NRDEV=32 CONFIG_XENO_OPT_REGISTRY=y CONFIG_XENO_OPT_REGISTRY_NRSLOTS=512 CONFIG_XENO_OPT_SYS_HEAPSZ=128 CONFIG_XENO_OPT_STATS=y CONFIG_XENO_OPT_DEBUG=y CONFIG_XENO_OPT_TIMING_PERIODIC=y CONFIG_XENO_OPT_TIMING_PERIOD=0 CONFIG_XENO_OPT_TIMING_TIMERLAT=0 CONFIG_XENO_OPT_TIMING_SCHEDLAT=0 CONFIG_XENO_OPT_TIMER_LIST=y CONFIG_XENO_HW_FPU=y CONFIG_XENO_HW_SMI_DETECT=y CONFIG_XENO_SKIN_NATIVE=y CONFIG_XENO_OPT_NATIVE_PIPE=y CONFIG_XENO_OPT_NATIVE_PIPE_BUFSZ=4096 CONFIG_XENO_OPT_NATIVE_SEM=y CONFIG_XENO_OPT_NATIVE_EVENT=y CONFIG_XENO_OPT_NATIVE_MUTEX=y CONFIG_XENO_OPT_NATIVE_COND=y CONFIG_XENO_OPT_NATIVE_QUEUE=y CONFIG_XENO_OPT_NATIVE_HEAP=y CONFIG_XENO_OPT_NATIVE_ALARM=y CONFIG_XENO_OPT_NATIVE_MPS=y CONFIG_XENO_SKIN_POSIX=y CONFIG_XENO_SKIN_RTDM=y
Compilation:
gcc -g $(shell xeno-config --posix-cflags) mutextst.c $(shell xeno-config --posix-ldflags) -o mutextstxeno gcc -g mutextst.c -lpthread -o mutextst
Quoted 3 lines · Jens Niehaus
Hi,
I am experiencing problems with xenomai 2.1.0 and
pthread_mutex_init. The second initialization in the following program returns with a value of 16 (EBUSY). What is wrong with the code (or with xenomai)?
There was a bug in syscall.c, which should be fixed by revision 870 in the trunk and by revision 871 in 2.1 branch.
Thanks for reporting.
Signature · 1 line
Gilles Chanteperdrix.
Quoted 7 lines · On Mon, 3 Apr 2006 14:23:42 +0200 Gilles Chanteperdrix…
Quoted 3 lines
Hi,
I am experiencing problems with xenomai 2.1.0 and
pthread_mutex_init.There was a bug in
syscall.c, which should be fixed by revision 870 in the trunk and by revision 871 in 2.1 branch.
Thank you for the quick response. Unfortunately the bug still occurs with revision 871 (branch).
If you cannot reproduce the bug on your system any more I'd like to help fixing this one. So tell me if you need some more output, configurations or printf/printk-stuff from within xenomai code.
Jens
Quoted 4 lines
Quoted 1 line
I am experiencing problems with xenomai 2.1.0 and
pthread_mutex_init. The second initialization in the following program returns with a value of 16 (EBUSY). What is wrong with the code (or with xenomai)?There was a bug in
syscall.c, which should be fixed by revision 870 in the trunk and by revision 871 in 2.1 branch.
Correctly applied this really solves the problem, thanks.