* [9fans] userspace netlog style log file in fs?
@ 2005-10-03 17:48 Axel Belinfante
2005-10-03 18:02 ` Russ Cox
0 siblings, 1 reply; 2+ messages in thread
From: Axel Belinfante @ 2005-10-03 17:48 UTC (permalink / raw)
To: 9fans
I'm turning my 802.1x thingy into an fs, using 9p(2),
and I'm now looking into adding a netlog-style
log file such that you can just 'cat /net/8021x/log'
and it will hang there in read until stuff is
added to the log. multiple readers should see
the same stuff.
I guess this amounts to
- keeping a ring buffer of log messages (a la netlog)
- keeping a queue of 'pending' read's --
read is the only thing for which completion
may have to be delayed, right?
- pending reads should 'complete' when stuff
is logged (i.e. something to read appears)
- pending reads should be cleaned away
when the fid is clunked
- deal with flushes?
- deal with slow readers that read slower
than the log gets updated, i.e. at a certain
moment they may ask for data that already has
been overwritten
I found inspiration in /sys/src/9/ip/netlog.c and
/sys/src/cmd/ssh/sshnet.c
(and other places mentioned in 9p(2))
Are there other things I might want to look at?
Are there particular traps I might want to avoid,
things to think of?
Sorry for these a bit vague, 'open' questions -
I'm sure I'll succeed to figure things out myself,
but if people have been there already I'd rather
not reinvent the wheel.
Also, I could imagine that such logging stuff might
be useful for other programs, if it could be
integrated easily.
Axel.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9fans] userspace netlog style log file in fs?
2005-10-03 17:48 [9fans] userspace netlog style log file in fs? Axel Belinfante
@ 2005-10-03 18:02 ` Russ Cox
0 siblings, 0 replies; 2+ messages in thread
From: Russ Cox @ 2005-10-03 18:02 UTC (permalink / raw)
To: Fans of the OS Plan 9 from Bell Labs
> I guess this amounts to
> - keeping a ring buffer of log messages (a la netlog)
> - keeping a queue of 'pending' read's --
> read is the only thing for which completion
> may have to be delayed, right?
Yes.
> - pending reads should 'complete' when stuff
> is logged (i.e. something to read appears)
> - pending reads should be cleaned away
> when the fid is clunked
> - deal with flushes?
Yes! Otherwise you can't kill a process that is blocked
reading the log file.
> - deal with slow readers that read slower
> than the log gets updated, i.e. at a certain
> moment they may ask for data that already has
> been overwritten
Tough for them.
> I found inspiration in /sys/src/9/ip/netlog.c and
> /sys/src/cmd/ssh/sshnet.c
See also /sys/src/9/port/log.c. Sshnet is a good example
of getting the flushes right.
Russ
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-10-03 18:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-03 17:48 [9fans] userspace netlog style log file in fs? Axel Belinfante
2005-10-03 18:02 ` Russ Cox
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 NNTP newsgroup(s).