pump 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. .TH PUMP 1
  2. .SH NAME
  3. pump \- copy asynchronously via a large circular buffer
  4. .SH SYNOPSIS
  5. .B pump
  6. [
  7. .B -b
  8. .I iando
  9. ] [
  10. .B -d
  11. .I sleepms
  12. ] [
  13. .B -f
  14. .I ofile
  15. ] [
  16. .B -i
  17. .I ireadsize
  18. ] [
  19. .B -k
  20. .I KB-buf
  21. ] [
  22. .B -o
  23. .I owritesize
  24. ] [
  25. .B -s
  26. .I start-KB
  27. ] [
  28. .B -S
  29. .I off
  30. ] [
  31. .B -t
  32. .I minutes
  33. ] [
  34. .I file
  35. \&... ]
  36. .SH DESCRIPTION
  37. .I Pump
  38. copies
  39. .IR files
  40. (or standard input if none)
  41. to standard output
  42. by using two processes,
  43. one reading and one writing,
  44. sharing a large circular buffer,
  45. thus permitting the reading process to
  46. get ahead of the writing process if the
  47. output device is slow (e.g., an optical disc).
  48. This in turn can keep the output device busy.
  49. The pipeline
  50. .L "dd | dd"
  51. can approximate this, but pipe buffering is limited to 64K
  52. bytes, which is fairly modest.
  53. .PP
  54. Options are:
  55. .TF \fL-m
  56. .TP
  57. .B -b
  58. sets the size of
  59. .I read
  60. and
  61. .I write
  62. operations to
  63. .I iando
  64. bytes.
  65. The default size is 8 kilobytes.
  66. .TP
  67. .B -d
  68. causes the output process to sleep for
  69. .I sleepms
  70. milliseconds initially, giving the reading
  71. process time to accumulate data in the buffer.
  72. .TP
  73. .B -f
  74. writes
  75. .I ofile
  76. rather than standard output
  77. .TP
  78. .B -i
  79. sets the size of
  80. .I read
  81. operations to
  82. .I ireadsize
  83. bytes.
  84. .TP
  85. .B -k
  86. allocates a circular buffer of
  87. .I KB-buf
  88. kilobytes rather than the default
  89. 5000 kilobytes.
  90. .TP
  91. .B -o
  92. sets the size of
  93. .I write
  94. operations to
  95. .I owritesize
  96. bytes.
  97. .TP
  98. .B -s
  99. prevents output until
  100. .I start-KB
  101. kilobytes have been read.
  102. .TP
  103. .B -S
  104. seeks both input and output files to
  105. .I off
  106. before copying.
  107. .TP
  108. .B -t
  109. stops output after
  110. .I minutes
  111. have passed.
  112. This assumes that
  113. .I pump
  114. can copy 10,584,000 bytes per minute.
  115. .SH EXAMPLES
  116. Append a
  117. .IR venti (8)
  118. arena to a DVD or BD quickly.
  119. .PD 0
  120. .IP
  121. .EX
  122. cdfs
  123. venti/rdarena arena0 arena.3 |
  124. pump -b 65536 -k 51200 >/mnt/cd/wd/arena.3
  125. .EE
  126. .PD
  127. .\" .SH FILES
  128. .SH SOURCE
  129. .B /sys/src/cmd/pump.c
  130. .SH SEE ALSO
  131. .IR cp (1),
  132. .IR dd (1),
  133. .IR ecp (1),
  134. .IR cdfs (4)
  135. .SH BUGS
  136. .I Pump
  137. processes spin while waiting for the circular buffer
  138. to fill or drain.
  139. .PP
  140. .IR Dd ,
  141. .IR ecp
  142. and
  143. .I pump
  144. occupy slightly different niches
  145. but perhaps some simplification is possible.