9 fprint(2, "usage: %s [-d] [-o snapfile] pid...\n", argv0);
14 main(int argc, char **argv)
16 char *user, *sys, *arch, *term, *ofile;
38 /* get kernel compilation time */
39 if((d = dirstat("#/")) == nil)
40 sysfatal("cannot stat #/: %r");
42 if((b = Bopen(ofile, OWRITE)) == nil)
43 sysfatal("cannot write to \"%s\": %r", ofile);
45 if((user = getuser()) == nil)
47 if((sys = sysname()) == nil)
49 if((arch = getenv("cputype")) == nil)
51 if((term = getenv("terminal")) == nil)
52 term = "unknown terminal type";
54 Bprint(b, "process snapshot %ld %s@%s %s %ld \"%s\"\n",
55 time(0), user, sys, arch, d->mtime, term);
57 for(i=0; i<argc; i++) {
58 if((pid = atol(argv[i])) == me)
59 fprint(2, "warning: will not snapshot self\n");
60 else if(p = snap(pid, 1))