All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@domain.hid>
To: Andrew Tannenbaum <trb@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] rtcanrecv output line-buffering
Date: Mon, 27 Jun 2011 09:48:35 +0200	[thread overview]
Message-ID: <4E0835D3.6010403@domain.hid> (raw)
In-Reply-To: <4DFA1F3C.7090209@domain.hid>

On 06/16/2011 05:20 PM, Andrew Tannenbaum wrote:
> I was trying to use the Xenomai RT-Socket-CAN rtcanrecv in a Tcl/Tk
> script GUI wrapper.
> 
> rtcanrecv uses printf to stdout, and it line-buffers when attached to a
> tty, but it uses larger buffers (so it is unusable) when run from a
> script with no tty.
> 
> Tcl does stdio with pipes rather than ptys (that is, Tcl thinks it has
> no tty for stdio).  I think both bash and perl use ptys (and so don't
> have this problem).  I haven't done a more thorough survey, but that's
> not the point.
> 
> I think it would be nice to modify rtcanrecv so it can write stdout in
> line-buffered mode.  If you think this is a good idea, please either set
> line buffering with
> 
>     setvbuf(stdout, NULL, _IOLBF, 0);
> 
> at the top of src/utils/can/rtcanrecv.c:rt_task() or
> 
>     fflush(stdout);
> 
> after the printf("\n") at the bottom of rt_task(), or you could add a
> command line getopt option for line-buffering that would do one of the
> above.

I would prefer the latter, patches are welcome. Be aware that using
printf will switch to secondary mode which should be avoided if
real-time is required.

Wolfgang.


  reply	other threads:[~2011-06-27  7:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4DF934BD.50505@domain.hid>
2011-06-16 15:20 ` [Xenomai-help] rtcanrecv output line-buffering Andrew Tannenbaum
2011-06-27  7:48   ` Wolfgang Grandegger [this message]
     [not found]   ` <261CC64699FF40F2937C31EEF248B8E5@domain.hid>
2011-06-27 17:39     ` Andrew Tannenbaum
2011-06-28 20:31       ` Gilles Chanteperdrix

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=4E0835D3.6010403@domain.hid \
    --to=wg@domain.hid \
    --cc=trb@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.