public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] remote syslog support in Redboot?
@ 2007-05-09 22:50 Jon Ringle
  2007-05-10 14:13 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Ringle @ 2007-05-09 22:50 UTC (permalink / raw)
  To: ecos-discuss

Has anyone implemented the ability to have diag_printf() messages be sent to a remote syslog server in Redboot/ecos?
 
Jon
 

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] remote syslog support in Redboot?
  2007-05-09 22:50 [ECOS] remote syslog support in Redboot? Jon Ringle
@ 2007-05-10 14:13 ` Andrew Lunn
  2007-05-10 14:53   ` Jon Ringle
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2007-05-10 14:13 UTC (permalink / raw)
  To: Jon Ringle; +Cc: ecos-discuss

On Wed, May 09, 2007 at 03:12:29PM -0400, Jon Ringle wrote:
> Has anyone implemented the ability to have diag_printf() messages be
> sent to a remote syslog server in Redboot/ecos?

You will have to be careful when doing this. diag_printf() uses a very
simple polled IO, blocking serial device driver. The idea is that it
should always work, in any context. So you can do a diag_printf() in
an ISR or a DSR, not just a thread. It is also guaranteed the output
will be out the serial port before diag_printf() returns. 

If you somehow modify diag_printf to send over a network stack it is
unlikely you can keep these properties. I would suggest you look at
adding a standard syslog interface, eg:

       #include <syslog.h>

       void openlog(const char *ident, int option, int facility);
       void syslog(int priority, const char *format, ...);
       void closelog(void);

       #define _BSD_SOURCE
       #include <stdarg.h>

       void vsyslog(int priority, const char *format, va_list ap);

and don't modify diag_printf().

    Andrew



-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [ECOS] remote syslog support in Redboot?
  2007-05-10 14:13 ` Andrew Lunn
@ 2007-05-10 14:53   ` Jon Ringle
  2007-05-10 16:02     ` Gary Thomas
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Ringle @ 2007-05-10 14:53 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss

On Thursday, May 10, 2007 7:56 AM, Andrew Lunn wrote:
> On Wed, May 09, 2007 at 03:12:29PM -0400, Jon Ringle wrote:
> > Has anyone implemented the ability to have diag_printf() messages be
> > sent to a remote syslog server in Redboot/ecos?
> 
> You will have to be careful when doing this. diag_printf() uses a very
> simple polled IO, blocking serial device driver. The idea is that it
> should always work, in any context. So you can do a diag_printf() in
> an ISR or a DSR, not just a thread. It is also guaranteed the output
> will be out the serial port before diag_printf() returns.

How is this guaranteed if I connect to Redboot on tcp port 9000?

Jon


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] remote syslog support in Redboot?
  2007-05-10 14:53   ` Jon Ringle
@ 2007-05-10 16:02     ` Gary Thomas
  2007-05-10 21:40       ` [ECOS] " Grant Edwards
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Thomas @ 2007-05-10 16:02 UTC (permalink / raw)
  To: Jon Ringle; +Cc: Andrew Lunn, ecos-discuss

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jon Ringle wrote:
> On Thursday, May 10, 2007 7:56 AM, Andrew Lunn wrote:
>> On Wed, May 09, 2007 at 03:12:29PM -0400, Jon Ringle wrote:
>>> Has anyone implemented the ability to have diag_printf() messages be
>>> sent to a remote syslog server in Redboot/ecos?
>> You will have to be careful when doing this. diag_printf() uses a very
>> simple polled IO, blocking serial device driver. The idea is that it
>> should always work, in any context. So you can do a diag_printf() in
>> an ISR or a DSR, not just a thread. It is also guaranteed the output
>> will be out the serial port before diag_printf() returns.
> 
> How is this guaranteed if I connect to Redboot on tcp port 9000?

RedBoot uses a polled TCP connection, thus when you make a
call to diag_printf() that channels through RedBoot, it _will_
complete at the receiver before continuing.  Interrupts are
off during this time, so it's safe even in ISR/DSR context.

Note: there can be issues if you try to send such messages from
within the network stack/drivers and these are routed
directly to the serial console, not over the network.

- --
- ------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
- ------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFGQzHmmaKbSsQGV8ARAi/bAKCl+mxgKW8WWJMtlAcTJRtUEjAm9gCfcdVS
6rewRB3A4yidtlhn+XxGPiY=
=mn0u
-----END PGP SIGNATURE-----

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [ECOS]  Re: remote syslog support in Redboot?
  2007-05-10 16:02     ` Gary Thomas
@ 2007-05-10 21:40       ` Grant Edwards
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Edwards @ 2007-05-10 21:40 UTC (permalink / raw)
  To: ecos-discuss

On 2007-05-10, Gary Thomas <gary@mlbassoc.com> wrote:

>>>> Has anyone implemented the ability to have diag_printf()
>>>> messages be sent to a remote syslog server in Redboot/ecos?
>>>
>>> You will have to be careful when doing this. diag_printf()
>>> uses a very simple polled IO, blocking serial device driver.
>>> The idea is that it should always work, in any context. So you
>>> can do a diag_printf() in an ISR or a DSR, not just a thread.
>>> It is also guaranteed the output will be out the serial port
>>> before diag_printf() returns.
>> 
>> How is this guaranteed if I connect to Redboot on tcp port
>> 9000?
>
> RedBoot uses a polled TCP connection, thus when you make a
> call to diag_printf() that channels through RedBoot, it _will_
> complete at the receiver before continuing.

I've wondered about that.  

The comment for __tcp_write_block() says that it blocks until
sent.  What it appears to do by calling __tcp_drain() (and what
is implied by your statement above) is that it blocks until the
data is _ACKed_ not until the data is _sent_.

-- 
Grant Edwards                   grante             Yow! My BIOLOGICAL ALARM
                                  at               CLOCK just went off ... It
                               visi.com            has noiseless DOZE FUNCTION
                                                   and full kitchen!!


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-10 16:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-09 22:50 [ECOS] remote syslog support in Redboot? Jon Ringle
2007-05-10 14:13 ` Andrew Lunn
2007-05-10 14:53   ` Jon Ringle
2007-05-10 16:02     ` Gary Thomas
2007-05-10 21:40       ` [ECOS] " Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).