version 1.8, 1999/08/17 09:13:15 |
version 1.8.4.1, 2000/10/06 21:16:13 |
|
|
ops |= pid ? KTROP_CLEAR : KTROP_CLEARFILE; |
ops |= pid ? KTROP_CLEAR : KTROP_CLEARFILE; |
|
|
if (ktrace(tracefile, ops, trpoints, pid) < 0) |
if (ktrace(tracefile, ops, trpoints, pid) < 0) |
err(1, tracefile); |
err(1, "%s", tracefile); |
exit(0); |
exit(0); |
} |
} |
|
|
omask = umask(S_IRWXG|S_IRWXO); |
omask = umask(S_IRWXG|S_IRWXO); |
if (append) { |
if (append) { |
if ((fd = open(tracefile, O_CREAT | O_WRONLY, DEFFILEMODE)) < 0) |
if ((fd = open(tracefile, O_CREAT | O_WRONLY, DEFFILEMODE)) < 0) |
err(1, tracefile); |
err(1, "%s", tracefile); |
if (fstat(fd, &sb) != 0 || sb.st_uid != getuid()) |
if (fstat(fd, &sb) != 0 || sb.st_uid != getuid()) |
errx(1, "Refuse to append to %s: not owned by you.", |
errx(1, "Refuse to append to %s: not owned by you.", |
tracefile); |
tracefile); |
|
|
err(1, "unlink %s", tracefile); |
err(1, "unlink %s", tracefile); |
if ((fd = open(tracefile, O_CREAT | O_EXCL | O_WRONLY, |
if ((fd = open(tracefile, O_CREAT | O_EXCL | O_WRONLY, |
DEFFILEMODE)) < 0) |
DEFFILEMODE)) < 0) |
err(1, tracefile); |
err(1, "%s", tracefile); |
} |
} |
(void)umask(omask); |
(void)umask(omask); |
(void)close(fd); |
(void)close(fd); |
|
|
if (*argv) { |
if (*argv) { |
if (ktrace(tracefile, ops, trpoints, getpid()) < 0) |
if (ktrace(tracefile, ops, trpoints, getpid()) < 0) |
err(1, tracefile); |
err(1, "%s", tracefile); |
execvp(argv[0], &argv[0]); |
execvp(argv[0], &argv[0]); |
err(1, "exec of '%s' failed", argv[0]); |
err(1, "exec of '%s' failed", argv[0]); |
} |
} |
else if (ktrace(tracefile, ops, trpoints, pid) < 0) |
else if (ktrace(tracefile, ops, trpoints, pid) < 0) |
err(1, tracefile); |
err(1, "%s", tracefile); |
exit(0); |
exit(0); |
} |
} |
|
|