File: buffer.man

package info (click to toggle)
buffer 1.19-12
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 500 kB
  • sloc: ansic: 8,475; makefile: 124; sh: 35
file content (171 lines) | stat: -rw-r--r-- 5,836 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
.\"    Buffer.  Very fast reblocking filter speedy writing of tapes.
.\"    Copyright (C) 1990,1991  Lee McLoughlin
.\"
.\"    This program is free software; you can redistribute it and/or modify
.\"    it under the terms of the GNU General Public License as published by
.\"    the Free Software Foundation; either version 1, or (at your option)
.\"    any later version.
.\"
.\"    This program is distributed in the hope that it will be useful,
.\"    but WITHOUT ANY WARRANTY; without even the implied warranty of
.\"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\"    GNU General Public License for more details.
.\"
.\"    You should have received a copy of the GNU General Public License
.\"    along with this program; if not, write to the Free Software
.\"    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
.\"
.\"    Lee McLoughlin.
.\"    Dept of Computing, Imperial College,
.\"    180 Queens Gate, London, SW7 2BZ, UK.
.\"
.\"    Email: L.McLoughlin@doc.ic.ac.uk
.TH BUFFER 1 "14 May 1990"
.SH NAME
buffer \- very fast reblocking program
.SH SYNTAX
.B buffer
[\fB\-S size\fP] [\fB\-b blocks\fP] [\fB\-s size\fP] [\fB\-z size\fP] [\fB\-m size\fP]
[\fB\-p percentage\fP] [\fB\-u microseconds\fP] [\fB-B\fR] [\fB-t\fR]
[\fB-Z\fR] [\fB-i filename\fR] [\fB-o filename\fR] [\fB-d\fR]
.SH OPTIONS
.TP 5
.B \-i filename
Use the given file as the input file.  The default is stdin.
.TP
.B \-o filename
Use the given file as the output file.  The default is stdout.
.TP
.B \-S size
After every chunk of this size has been written, print out how much has
been written so far. Also prints the total throughput.
By default this is not set.
.TP
.B \-s size
Size in bytes of each block.  The default blocksize is 10k to match
the normal output of the
.I tar(1)
program.
.TP
.B \-z size
Combines the
.B \-S
and
.B \-s
flags.
.TP
.B \-b blocks
Number of blocks to allocate to shared memory circular buffer.
Defaults to the number required to fill up the shared memory requested.
.TP
.B \-m size
Maximum size of the shared memory chunk to allocate for the circular
queue. Defaults to one megabyte.
.TP
.B \-p percentage
Only start a write when the given percentage of the internal queue is
full.  A percentage around 75 often proves best. Defaults to zero.
.TP
.B \-u microseconds
After every write pause for this many microseconds.  Defaults to zero.
(Surprisingly a small sleep, 100 usecs, after each write can greatly enhance
throughput on some drives.)
.TP
.B \-B
Force each block written to be padded out to the blocksize.  This is needed by some tape
and cartridge drives.  Defaults to unpadded.  This only affects the
last block written.
.TP
.B \-t
On exiting print to stderr a brief message showing the total number of
bytes written.
.TP
.B \-Z
If reading/writing directly to a character device (like a tape drive)
then after each gigabyte perform an lseek to the start of the file.
Use this flag with extreme care.  It can only be used on devices where
an lseek does not rewind the tape but does reset the kernels position
flags.  It is used to allow more than 2 gigabytes to be written.
.TP
.B \-d
Print debug information to stderr during operation.
.PP
Sizes are a number with an optional trailing character.   A 'b' 
multiplies the size by 512, a 'k' by 1024 and an 'm' by a meg.
.SH DESCRIPTION
.I Buffer
reads from standard input reblocking to the given blocksize and writes
each block to standard output.
.PP
Internally
.I buffer
is a pair of processes communicating via a large circular queue held
in shared memory.  The reader process only has to block when the queue
is full and the writer process when the queue is empty.
.I Buffer
is designed to try and keep the writer side continuously busy so that
it can stream when writing to tape drives.  When used to write tapes
with an intervening network
.I buffer
can result in a considerable increase in throughput.
.PP
The default settings for
.I buffer
are normally good enough.  If you are a heavy tape user then it is
worth your while trying out various different combinations of options.
In particular running a
.I buffer
at both ends of the pipe can provide a substantial increase (see last
example below).
.SH EXAMPLES
.br
$ \fBbuffer < /etc/termcap > /dev/rst8\fP
.br
.sp
$ \fBtar cf - . | rsh somehost 'buffer > /dev/rst8'\fP
.br
.sp
$ \fBdump fu - | rsh somehost 'buffer -s 16k > /dev/nrst8'\fP
.br
$ \fBtar cf - . | buffer | 
.br
\ \ \ rsh somehost 'buffer -S 500K -p 75 > /dev/rst0'\fP
.SH BUFFER LIMITS
There are 2 limits in
.I buffer
affecting the maximum total buffer size: The maximum number of blocks (2048)
and the maximum size of a block (512kB). This results in a maximum total
buffer size of 1GB.
.PP

Note that there is also a kernel limit for the maximum size of a shared
memory segment (used by
.I buffer
internally) which is typically much lower than the limits in
.IR buffer .
So if
.I buffer
complains about not being able to create a shared memory segment, this limit
might have to be raised using the command \fBsysctl kernel.shmmax=\fP\fIXXX\fP (see also
sysctl(1) and proc(5)).

.SH BUGS
Internally, for printing purposes, buffer counts in terms of the
number of kilobytes output.  If the blocksize you use is not a whole
number of kilobytes then the numbers printed will be inaccurate.

.SH THANKS
Thanks to Kevin Twidle <kpt@doc.ic.ac.uk> for a lot of early
suggestions and patches to make it work with non-tar/dump tapes to
exabyte drives.

Thanks to Andi Karrer <karrer@bernina.ethz.ch>, Rumi Zahir
<rumi@iis.ethz.ch> and Christoph Wicki <wicki@iis.ethz.ch> for patches
to make buffer work when trying to write single tape files of greater
than 2 gigabytes.

.SH COPYRIGHT
.if n Copyright (C) 1990, 1991 by Lee McLoughlin.
.if t Copyright \(co 1990, 1991 by Lee McLoughlin.
.SH SEE ALSO
dd(1), tar(1), rsh(1)