will internally buffer up to \fIsize\fR megabytes of data, and will
only read more data when the buffer is at least 75% empty.
.PP
+\fIsize\fR may also be suffixed with
+.BR m ", " k ", or " b
+to indicate that it is in megabytes (2^20), kilobytes (2^10) or bytes.
+.PP
It is intended for use in situations where many small
reads are undesirable for performance reasons, e.g. tape drives.
.SH OPTIONS
unsigned char *buf, *wp, *rp;
int used, seeneof, maxselfd;
-size_t buffersize;
+size_t buffersize= RWBUFFER_SIZE_MB_DEF*1024*1024;
fd_set readfds;
fd_set writefds;
void startup(const char *const *argv) {
const char *arg;
char *ep;
- unsigned long opt_buffersize=RWBUFFER_SIZE_MB_DEF;
+ int shift=-1;
assert(argv[0]);
if (!strcmp(arg,"--mlock")) {
opt_mlock= 1;
} else if (isdigit((unsigned char)arg[0])) {
- opt_buffersize= strtoul(arg,&ep,0);
- if (opt_buffersize > RWBUFFER_SIZE_MB_MAX)
+ buffersize= strtoul(arg,&ep,0);
+ if (ep[0] && ep[1]) usageerr("buffer size spec. invalid");
+ switch (ep[0]) {
+ case 0: case 'm': shift= 20; break;
+ case 'k': shift= 10; break;
+ case 'b': shift= 0; break;
+ default: usageerr("buffer size unit unknown");
+ }
+ if (buffersize > (RWBUFFER_SIZE_MB_MAX >> shift))
usageerr("buffer size too big");
+ buffersize <<= shift;
} else {
usageerr("invalid option");
}
}
- buffersize= opt_buffersize*1024*1024;
startupcore();
nonblock(0,1); nonblock(1,1);
}
data when the buffer is at least 75% full or when there is no more
input to fill the buffer.
.PP
+\fIsize\fR may also be suffixed with
+.BR m ", " k ", or " b
+to indicate that it is in megabytes (2^20), kilobytes (2^10) or bytes.
+.PP
It is intended for use in situations where many small writes are
undesirable for performance reasons, e.g. tape drives.
.SH OPTIONS
+chiark-utils (4.0.99.0.16) unstable; urgency=low
+
+ * Size for readbuffer/writebuffer may be in k or bytes.
+
+ -- Ian Jackson <ian@davenant.greenend.org.uk> Sat, 21 May 2005 14:47:18 +0100
+
chiark-utils (4.0.99.0.15) unstable; urgency=low
* /etc/chiark-backup/snap/lvm (backup/lvm in the source tree) now