summaryrefslogtreecommitdiff
path: root/man/2/bufio-chanfill
blob: f5908dd308d15113cf3d98b399f1dbebfab9048c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
.TH BUFIO-CHANFILL 2
.SH NAME
bufio: chanfill \- buffered I/O interface to named channel
.SH SYNOPSIS
.EX
include "bufio.m";
chanfill := load ChanFill ChanFill->PATH;

init:   fn(data: array of byte, fid: int,
            wc: Sys->Rwrite, r: ref Sys->FileIO,
            b: Bufio): ref Bufio->Iobuf;
fill:   fn(b: ref Bufio->Iobuf): int;
.EE
.SH DESCRIPTION
.B ChanFill
is an implementation of
.B BufioFill
(see
.IR bufio (2))
that refills an
.B Iobuf
as data is written to a file created by
.IR sys-file2chan (2),
which is allowed only one writer.
.B Init
returns an
.B Iobuf
allocated from the
.B Bufio
instance
.IR b ,
that when read will return data written to the file by another process.
.IR Data ,
.IR fid
and
.IR wc
are the values in the tuple presented by
.B Sys->file2chan
on the first write.
.I Data
becomes the initial data for the
.BR Iobuf ;
.B init
replies to the writer on
.IR wc .
The other values are saved for use by
.BR fill :
on later calls to
by
.B Bufio
to refill the buffer,
.B fill
waits for a new write request on
.IB fio .write
and either fills the buffer or signals end-of-file appropriately.
.SH SEE ALSO
.IR bufio (2)