uClibc compile failure
PATCH 1/1 uClibc compile failure
Hi,
I have bumped on a compilation failure of Xenomai 2.4.6 with uClibc. The mmap64/ftruncate64 functions may not be available, at all. So here's an attached patch against 2.4.6, FWIW.
BTW, people stuck with a fascist pthread that lets only superuser use SCHED_FIFO will need the following patch. Same discussion[1] applies.
[1] https://mail.gna.org/public/xenomai-help/2007-05/msg00330.html
skins/native/task.c 8 Dec 2008 10:37:55 -0000 renamed from skins/native/task.c 9 Jun 2008 09:38:14 -0000 1.5 +7 -1
@@ -139,7 +139,13 @@ pthread_attr_setinheritsched(&thattr, PTHREAD_EXPLICIT_SCHED); memset(¶m, 0, sizeof(param)); - if (prio > 0) { + /* There's a limitation in libpthread + * that returns EPERM upon SCHED_FIFO + * for non priviledged users. + * So workaround this for now. + * FIXME (in uClibc/pthread). + */ + if (prio > 0 && geteuid() == 0) { pthread_attr_setschedpolicy(&thattr, SCHED_FIFO); param.sched_priority = prio; } else
Signature · 1 line
Stephane
configure.in +1 -1
@@ -733,7 +733,7 @@ save_LIBS="$LIBS" LIBS="$LIBS -lrt" -AC_CHECK_FUNCS([shm_open shm_unlink]) +AC_CHECK_FUNCS([shm_open shm_unlink mmap64 ftruncate64]) LIBS="$save_LIBS" dnl
skins/posix/shm.c +8 -0
@@ -160,8 +160,10 @@if (!err)return 0 ; +#ifdef HAVE_FTRUNCATE64 if (err ==EBADF || err ==ENOSYS )return __real_ftruncate64 (fildes, length); +#endif errno = err;return -1 ;
@@ -185,8 +187,10 @@ ((unsigned long long ) off <LONG_MAX ? (long) off : -1L), &map); +#ifdef HAVE_MMAP64 if (err ==EBADF || err ==ENOSYS )return __real_mmap64 (addr, len, prot, flags, fildes, off); +#endif if (err) goto error;
@@ -196,8 +200,12 @@if (err) goto err_mmap_epilogue; +#ifdef HAVE_MMAP64 /* map the whole heap. */ uaddr =__real_mmap64 (NULL , map.mapsize, prot, flags, fildes,0 ); +#else + uaddr =MAP_FAILED ; +#endif if (uaddr ==MAP_FAILED ) { err_mmap_epilogue: