aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/procctl/procctl.c
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1998-01-05 07:19:15 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1998-01-05 07:19:15 +0000
commitcfebbb6c1a01f867a1ab9c277cb3d3c1d3df97a9 (patch)
treef82fe8881e11d2c63e4b4e5f6b030f3341221061 /usr.sbin/procctl/procctl.c
parentd3173ea71cd11fc17958d428dfebfd7be6a139ad (diff)
Notes
Diffstat (limited to 'usr.sbin/procctl/procctl.c')
-rw-r--r--usr.sbin/procctl/procctl.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/usr.sbin/procctl/procctl.c b/usr.sbin/procctl/procctl.c
index 679f903fa1442..ade673d27cbcb 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;