From: Philippe Gerum <rpm@xenomai.org>
To: xenoka09@domain.hid
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] debug posix skin - pthread_cond_wait return EPERM
Date: Fri, 21 Jan 2011 15:12:58 +0100 [thread overview]
Message-ID: <1295619178.1828.53.camel@domain.hid> (raw)
In-Reply-To: <alpine.DEB.1.10.1101211400260.3495@domain.hid>
On Fri, 2011-01-21 at 14:09 +0100, Kolja Waschk wrote:
> >>> program, since you should be using #include <pthread.h>, instead of
> >>> #include <posix/pthread.h>, and more importantly, this program is
> >>
> >> Yes. That's an artefact of another problem which seems more toolchain-related
> >> in my case. Already noted in our issue tracking system. However, I tried to
> >
> > As reminder, the correct way to compile a xenomai posix skin program is
> > described here:
> > http://www.xenomai.org/index.php/Porting_POSIX_applications_to_Xenomai#Compilation_flags.
>
>
> It is impossible for me to use -I$(PREFIX)/include/posix so that I could simply
> #include <pthread.h> when using bfin-linux-uclibc-g++(!). The result whenever I
> just try to do something like #include <stdio.h> would be the following. It
> does work when using gcc instead of g++ (but that's obviously no option for C++
> code)
>
>
> a.c: #include <stdio.h>
>
> bfin-linux-uclibc-g++ -D_GNU_SOURCE -D_REENTRANT -D__XENO__ \
> -I$PREFIX/usr/include -I$PREFIX/usr/include/posix -c a.c
>
>
> In file included from /opt/uClinux/blackfin-linux-dist/staging/usr/include/nucleus/thread.h:25,
> from /opt/uClinux/blackfin-linux-dist/staging/usr/include/posix/pthread.h:136,
> from /opt/uClinux-2010R1-RC5_tools-RC4/bfin-linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/include/bits/uClibc_mutex.h:15,
> from /opt/uClinux-2010R1-RC5_tools-RC4/bfin-linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/include/bits/uClibc_stdio.h:107,
> from /opt/uClinux-2010R1-RC5_tools-RC4/bfin-linux-uclibc/bin/../bfin-linux-uclibc/runtime/usr/include/stdio.h:72,
> from a.c:1:
> /opt/uClinux/blackfin-linux-dist/staging/usr/include/nucleus/types.h: In function ‘void xnobject_copy_name(char*, const char*)’:
> /opt/uClinux/blackfin-linux-dist/staging/usr/include/nucleus/types.h:113: error: ‘snprintf’ was not declared in this scope
>
diff --git a/include/nucleus/types.h b/include/nucleus/types.h
index f49131c..28726df 100644
--- a/include/nucleus/types.h
+++ b/include/nucleus/types.h
@@ -29,6 +29,7 @@
#endif /* !CONFIG_PREEMPT_RT */
#else /* !__KERNEL__ */
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <errno.h>
#ifndef BITS_PER_LONG
@@ -107,16 +108,14 @@ typedef atomic_flags_t xnflags_t;
#define XNOBJECT_NAME_LEN 32
-static inline void xnobject_copy_name(char *dst, const char *src)
-{
- if (src)
- snprintf(dst, XNOBJECT_NAME_LEN, "%s", src);
- else
- *dst = '\0';
-}
+#define xnobject_copy_name(dst, src) \
+ do { \
+ strncpy((dst), (src) ?: "", XNOBJECT_NAME_LEN-1) \
+ [XNOBJECT_NAME_LEN-1] = '\0'; \
+ } while (0)
-#define xnobject_create_name(dst, n, obj) \
- snprintf(dst, n, "%p", obj)
+#define xnobject_create_name(dst, n, obj) \
+ snprintf(dst, n, "%p", obj)
#define minval(a,b) ((a) < (b) ? (a) : (b))
#define maxval(a,b) ((a) > (b) ? (a) : (b))
>
>
>
>
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
--
Philippe.
next prev parent reply other threads:[~2011-01-21 14:12 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-20 8:03 [Xenomai-help] debug posix skin - pthread_cond_wait return EPERM Pierre.QUELIN
2011-01-20 8:28 ` Kolja Waschk
2011-01-20 14:55 ` Gilles Chanteperdrix
2011-01-20 16:44 ` Kolja Waschk
2011-01-20 16:56 ` Gilles Chanteperdrix
2011-01-20 17:16 ` Kolja Waschk
2011-01-20 17:30 ` Gilles Chanteperdrix
2011-01-20 18:57 ` Waschk,Kolja
2011-01-20 19:09 ` Gilles Chanteperdrix
2011-01-20 19:22 ` Waschk,Kolja
2011-01-21 13:09 ` Kolja Waschk
2011-01-21 14:12 ` Philippe Gerum [this message]
2011-01-21 11:25 ` Kolja Waschk
2011-01-24 12:31 ` Gilles Chanteperdrix
2011-01-25 8:53 ` Kolja Waschk
2011-01-25 8:51 ` Gilles Chanteperdrix
2011-01-25 8:55 ` Gilles Chanteperdrix
2011-01-25 9:06 ` Kolja Waschk
2011-01-20 18:36 ` Gilles Chanteperdrix
2011-01-20 19:13 ` Gilles Chanteperdrix
2011-01-21 12:03 ` Kolja Waschk
2011-01-21 14:00 ` Philippe Gerum
2011-01-21 14:16 ` Kolja Waschk
2011-01-22 15:07 ` Gilles Chanteperdrix
2011-01-22 15:20 ` Gilles Chanteperdrix
2011-01-20 17:33 ` [Xenomai-help] gpio Cagnulein
2011-01-20 17:55 ` Gilles Chanteperdrix
-- strict thread matches above, loose matches on Subject: below --
2011-01-21 8:43 [Xenomai-help] debug posix skin - pthread_cond_wait return EPERM Pierre.QUELIN
2011-01-22 14:39 ` Gilles Chanteperdrix
2011-01-24 14:57 Pierre.QUELIN
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=1295619178.1828.53.camel@domain.hid \
--to=rpm@xenomai.org \
--cc=xenoka09@domain.hid \
--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.