diff options
-rw-r--r-- | usr.sbin/procctl/procctl.8 | 22 | ||||
-rw-r--r-- | usr.sbin/procctl/procctl.c | 36 |
2 files changed, 29 insertions, 29 deletions
diff --git a/usr.sbin/procctl/procctl.8 b/usr.sbin/procctl/procctl.8 index fc98081..7179ceb 100644 --- a/usr.sbin/procctl/procctl.8 +++ b/usr.sbin/procctl/procctl.8 @@ -1,16 +1,16 @@ -.\" $Id$ +.\" $Id: procctl.8,v 1.2 1997/12/07 02:30:43 peter Exp $ .Dd Nov 23, 1997 .Dt PROCCTL 1 .Os FreeBSD .Sh NAME -.Nm \&procctl +.Nm procctl .Nd clear procfs event flags -.Sh Synopsis -.Nm \&procctl +.Sh SYNOPSIS +.Nm procctl .Ar command -.Ar [...] +.Op Ar ... .Sh DESCRIPTION -.Nm \&procctl +.Nm Procctl clears the .Xr procfs 5 event mask used by @@ -20,11 +20,15 @@ the .Xr procfs 5 events result in a non-killable process. The options are a list of process ID's; -.Nm \&procctl +.Nm goes through the list and clears the event masks for each specified process. +.Sh SEE ALSO .Xr truss 1 , .Xr procfs 5 .Sh HISTORY The -.Nm procctl -command was written by Sean Eric Fagan for FreeBSD. +.Nm +command was written by +.An Sean Eric Fagan +for +.Bx Free . diff --git a/usr.sbin/procctl/procctl.c b/usr.sbin/procctl/procctl.c index 679f903..ade673d 100644 --- a/usr.sbin/procctl/procctl.c +++ b/usr.sbin/procctl/procctl.c @@ -30,6 +30,11 @@ * */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + /* * procctl -- clear the event mask, and continue, any specified processes. * This is largely an example of how to use the procfs interface; however, @@ -38,26 +43,22 @@ * procfs code, almost certainly; however, this program will still be useful * for some annoying circumstances.) */ -/* - * $Id: procctl.c,v 1.2 1997/12/13 03:13:49 sef Exp $ - */ +#include <err.h> +#include <errno.h> +#include <fcntl.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <errno.h> -#include <err.h> -#include <signal.h> -#include <fcntl.h> +#include <unistd.h> #include <sys/ioctl.h> #include <sys/pioctl.h> +int main(int ac, char **av) { int fd; int i; - unsigned int mask; - char **command; - struct procfs_status pfs; for (i = 1; i < ac; i++) { char buf[32]; @@ -67,18 +68,13 @@ main(int ac, char **av) { if (fd == -1) { if (errno == ENOENT) continue; - fprintf(stderr, "%s: cannot open pid %s: %s\n", - av[0], av[i], strerror(errno)); + warn("cannot open pid %s", av[i]); continue; } - if (ioctl(fd, PIOCBIC, ~0) == -1) { - fprintf(stderr, "%s: cannot clear process %s's event mask: %s\n", - av[0], av[i], strerror(errno)); - } - if (ioctl(fd, PIOCCONT, 0) == -1 && errno != EINVAL) { - fprintf(stderr, "%s: cannot continue process %s: %s\n", - av[0], av[i], strerror(errno)); - } + if (ioctl(fd, PIOCBIC, ~0) == -1) + warn("cannot clear process %s's event mask", av[i]); + if (ioctl(fd, PIOCCONT, 0) == -1 && errno != EINVAL) + warn("cannot continue process %s", av[i]); close(fd); } return 0; |