9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Help on /srv, named pipes
@ 2006-09-22 14:30 Sascha Retzki
  2006-09-22 15:32 ` Russ Cox
  2006-09-22 16:40 ` Skip Tavakkolian
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Retzki @ 2006-09-22 14:30 UTC (permalink / raw)
  To: 9fans


Hi,

I am playing arround with irc7, a multichannel irc-client. There is irc, which uses /srv (a named pipe to ircsrv) for outgoing things (commands to be send to the irc-server), but a file in /tmp to recieve data from the irc-server. (One (may) use irc to just read/write to one target/victim (irc channel or person), so I just open two-three win(1)s in acme and start ircs' for each channel I want to be in).

I don't like the incoming data to be in /tmp, for example it behaves like a logfile, it spams my harddisk, etc. Most importantly, I did not get why there is a named pipe waiting for clients in /srv, but a file in /tmp is used.

So I changed irc7/irc.c to read/write all traffic via /srv/glendairc and made ircsrv.c write to /srv/glendairc instead of /tmp/whatnot. Piece of cake.


Reading pipe(3):
If there are multiple writers, each write is guaranteed to
be available in a contiguous piece at the other end of the
pipe.  If there are multiple readers, each read will return
data from only one write.

I read 'from only one write' as 'multiple "clients" may open and use /srv/glendairc, they all will get all data (ordered)' - however that is not the case. Depending on which one of the clients is currently reading (or so it seems), it is the only recipient. I have got a question at this point: Did I misget that concept? Is that intentioned behaviour (why?)?
(In case it matters, libbio is used to recieve the data from /tmp^W/srv/glendairc )



I put the current source-code at sources:
9fs sources
/n/sources/contrib/sascharetzki/src/irc7.2-srv-only.tgz 


In case I do get all the concepts right, and I just did not write correct code, I will go and read my code again. Examples (greping for /srv in /sys/src/cmd/*.c isn't that much fun after all ;-/ )?


Thanks for your time,


Sascha



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

* Re: [9fans] Help on /srv, named pipes
  2006-09-22 14:30 [9fans] Help on /srv, named pipes Sascha Retzki
@ 2006-09-22 15:32 ` Russ Cox
  2006-09-22 16:40 ` Skip Tavakkolian
  1 sibling, 0 replies; 3+ messages in thread
From: Russ Cox @ 2006-09-22 15:32 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> If there are multiple writers, each write is guaranteed to
> be available in a contiguous piece at the other end of the
> pipe.  If there are multiple readers, each read will return
> data from only one write.

This says that if reading from a pipe preserves the
message sizes written to the pipe, and that each read
gets an entire message (when possible) but not
a message and a half.

Pipes do not deliver writes to all readers.
(Nor do network connections, nor Unix pipes.)
If you want to do that you need an arbitrarily
large buffer to accomodate slow readers.
Something like... a file in /tmp.

Russ


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

* Re: [9fans] Help on /srv, named pipes
  2006-09-22 14:30 [9fans] Help on /srv, named pipes Sascha Retzki
  2006-09-22 15:32 ` Russ Cox
@ 2006-09-22 16:40 ` Skip Tavakkolian
  1 sibling, 0 replies; 3+ messages in thread
From: Skip Tavakkolian @ 2006-09-22 16:40 UTC (permalink / raw)
  To: 9fans

> So I changed irc7/irc.c to read/write all traffic via /srv/glendairc and made ircsrv.c write to /srv/glendairc instead of /tmp/whatnot. Piece of cake.

except only one pending read of /srv/glendairc
will succeed.  have you thought about putting an
fs in front of it?  each client gets its own copy of
what comes from the network.

(user1) <-> fs/0/data \
(user2) <-> fs/1/data  } <=chan(irc)=> proc(ircsrv/mux)
(user3) <-> fs/2/data /

i think there's an example in nemo's intro book.



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

end of thread, other threads:[~2006-09-22 16:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-22 14:30 [9fans] Help on /srv, named pipes Sascha Retzki
2006-09-22 15:32 ` Russ Cox
2006-09-22 16:40 ` Skip Tavakkolian

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).