X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=sys%2Fman%2F2%2Fbio;h=b62a5877dc7c4b3f02860a1eac1f470bfadcb7c0;hb=4c9cbe484d8bbade0a44ba1d26044077cae44fee;hp=1aae56005655d1e061caac07c427b93a4c81c175;hpb=035aacf6f5c23f0513e240046818ef203e8d87cb;p=plan9front.git diff --git a/sys/man/2/bio b/sys/man/2/bio index 1aae56005..b62a5877d 100644 --- a/sys/man/2/bio +++ b/sys/man/2/bio @@ -84,6 +84,9 @@ int Bbuffered(Biobufhdr *bp) .B void Blethal(Biobufhdr *bp, void (*errorf)(char *)) .PP +.B +void Biofn(Biobufhdr *bp, int (*iof)(Biobufhdr *, void *, long)) +.PP .SH DESCRIPTION These routines implement fast buffered I/O. I/O on different file descriptors is independent. @@ -150,12 +153,14 @@ returns the integer file descriptor of the associated open file. .PP .I Bterm flushes the buffer for -.IR bp +.I bp and returns .IR Bflush 's return value. If the buffer was allocated by -.IR Bopen , +.I Bopen +or +.IR Bfdopen , the buffer is .I freed and the file is closed. @@ -265,7 +270,7 @@ outputs the low order 8 bits of on .IR bp . If this causes a -.IR write +.I write to occur and there is an error, a negative value is returned. Otherwise, a zero is returned. @@ -286,7 +291,7 @@ on the output stream. is a buffered interface to .IR print (2). If this causes a -.IR write +.I write to occur and there is an error, a negative value .RB ( Beof ) @@ -307,7 +312,7 @@ of data starting at to .IR bp . If this causes a -.IR write +.I write to occur and there is an error, a negative value is returned. Otherwise, the number of bytes written is returned. @@ -336,10 +341,23 @@ to be called in case of an error happening on read/write. An argument of .B nil will have the program terminated in case of error. +.PP +If +.I Biofn +is called with a non-nil +.I iof +function, then that function is called for I/O in lieu of +.IR read (2) +and +.IR write . +A nil argument for +.I iof +restores normal behaviour. .SH SOURCE .B /sys/src/libbio .SH SEE ALSO .IR open (2), +.IR read (2), .IR print (2), .IR exits (2), .IR utf (6),