From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200510031748.j93HmA806250@zamenhof.cs.utwente.nl> To: 9fans@cse.psu.edu From: Axel Belinfante MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6244.1128361689.1@zamenhof.cs.utwente.nl.cs.utwente.nl> Date: Mon, 3 Oct 2005 19:48:09 +0200 Subject: [9fans] userspace netlog style log file in fs? Topicbox-Message-UUID: 939787a6-ead0-11e9-9d60-3106f5b1d025 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.