9 fprint(2, "usage: %s [-o snapfile] pid...\n", argv0);
14 main(int argc, char **argv)
16 char *user, *sys, *arch, *term, *ofile;
35 /* get kernel compilation time */
36 if((d = dirstat("#/")) == nil) {
37 fprint(2, "cannot stat #/ ???\n");
41 if((b = Bopen(ofile, OWRITE)) == nil) {
42 fprint(2, "cannot write to \"%s\"\n", ofile);
46 if((user = getuser()) == nil)
48 if((sys = sysname()) == nil)
50 if((arch = getenv("cputype")) == nil)
52 if((term = getenv("terminal")) == nil)
53 term = "unknown terminal type";
55 Bprint(b, "process snapshot %ld %s@%s %s %ld \"%s\"\n",
56 time(0), user, sys, arch, d->mtime, term);
58 for(i=0; i<argc; i++) {
59 if((pid = atol(argv[i])) == me)
60 fprint(2, "warning: will not snapshot self\n");
61 else if(p = snap(pid, 1))