snap 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. .TH SNAP 4
  2. .SH NAME
  3. snap, snapfs \- create and mount process snapshots
  4. .SH SYNOPSIS
  5. .B snap
  6. [
  7. .B -o
  8. .I file
  9. ]
  10. .I pid...
  11. .PP
  12. .B snapfs
  13. [
  14. .B -a
  15. ]
  16. [
  17. .B -m
  18. .I mtpt
  19. ]
  20. [
  21. .B -s
  22. .I service
  23. ]
  24. .I file...
  25. .SH DESCRIPTION
  26. .I Snap
  27. and
  28. .I snapfs
  29. allow one to save and restore (static) process images,
  30. usually for debugging
  31. on a different machine or at a different time.
  32. .PP
  33. .I Snap
  34. writes a snapshot
  35. (see
  36. .IR snap (6))
  37. of the named processes to
  38. .I file
  39. (default standard output).
  40. If
  41. .I pid
  42. is a text string
  43. rather than a process id,
  44. .I snap
  45. will save all processes with
  46. that name that
  47. are owned by the current user.
  48. Both memory and text images are saved.
  49. .PP
  50. .I Snapfs
  51. is a file server that
  52. recreates the
  53. .B /proc
  54. directories for the processes in the snapshot.
  55. By default, it mounts the new directories
  56. into
  57. .B /proc
  58. before the current entries.
  59. The
  60. .B -m
  61. option can be used to specify
  62. an alternate mountpoint,
  63. while
  64. .B -a
  65. will cause it to mount the new directories
  66. after the current entries.
  67. The
  68. .B -s
  69. option causes it to serve requests via
  70. .BI /srv/ service.
  71. .SH EXAMPLE
  72. Suppose
  73. .I page
  74. has hung viewing Postscript on your terminal, but the author is gone for the rest of
  75. the month and you want to make sure the process
  76. is still around for debugging on his return.
  77. You can save the errant processes with
  78. .IP
  79. .EX
  80. snap -o page.snap `{psu | awk '$NF ~ /page|gs/ {print $2}'}
  81. .EE
  82. .PP
  83. When the author returns, he can add the process images to his name space
  84. by running
  85. .IP
  86. .EX
  87. snapfs page.snap
  88. .EE
  89. .PP
  90. and then use a conventional
  91. debugger to debug them.
  92. .SH SOURCE
  93. .B /sys/src/cmd/snap
  94. .SH SEE ALSO
  95. .IR acid (1),
  96. .IR db (1),
  97. .IR proc (3),
  98. .IR snap (6)
  99. .SH BUGS
  100. The snapshots take up about as much disk space
  101. as the processes they contain did memory.
  102. Compressing them when not in use is recommended,
  103. as is storing them on a rewritable disk.
  104. .PP
  105. .I Pid
  106. as a non-numeric string is unimplemented; it has to be a number.