All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: "Alessio Margan @ IIT" <alessio.margan@iit.it>
Cc: xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] segfault using rt_printf service
Date: Fri, 14 Sep 2012 20:41:35 +0200	[thread overview]
Message-ID: <50537A5F.5030301@xenomai.org> (raw)
In-Reply-To: <5053404B.9000006@iit.it>

On 09/14/2012 04:33 PM, Alessio Margan @ IIT wrote:

> Hi all,
> 
> I'm switching from xenomai 2.5.6 to 2.6.1 using 
> adeos-ipipe-2.6.38.8-x86-2.11-01.patch
> In this test I have 2 threads :
> - rx_udp receive udp packets from dsp boards at 1kHz
> - boards_test send udp packets at 1kHz
> 
> I got segfault in printer_loop thread, the point is that if I change env 
> var RT_PRINT_PERIOD to about 10 or 1000 (default is 100 ms) I do not 
> have segfault.
> 
> Any suggestion ?


Could you try the following patch?

diff --git a/src/skins/common/rt_print.c b/src/skins/common/rt_print.c
index a9fce78..376330b 100644
--- a/src/skins/common/rt_print.c
+++ b/src/skins/common/rt_print.c
@@ -163,9 +163,9 @@ static int vprint_to_buffer(FILE *stream, int priority, unsigned int mode,
 	if (mode == RT_PRINT_MODE_FORMAT) {
 		if (stream != RT_PRINT_SYSLOG_STREAM) {
 			/* We do not need the terminating \0 */
-			res = vsnprintf(head->data, len + 1, format, args);
+			res = vsnprintf(head->data, len, format, args);
 
-			if (res < len + 1) {
+			if (res < len) {
 				/* Text was written completely, res contains its
 				   length */
 				len = res;


-- 
                                                                Gilles.


  parent reply	other threads:[~2012-09-14 18:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 14:33 [Xenomai] segfault using rt_printf service Alessio Margan @ IIT
2012-09-14 15:11 ` Gilles Chanteperdrix
2012-09-14 15:41   ` Alessio Margan @ IIT
2012-09-14 16:54     ` Gilles Chanteperdrix
2012-09-14 18:41 ` Gilles Chanteperdrix [this message]
2012-09-18 20:22   ` Gilles Chanteperdrix
2012-09-19  8:21     ` Alessio Margan @ IIT

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=50537A5F.5030301@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=alessio.margan@iit.it \
    --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.