summaryrefslogtreecommitdiffstats
path: root/usr.sbin/procctl/procctl.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1998-01-05 07:19:15 +0000
committercharnier <charnier@FreeBSD.org>1998-01-05 07:19:15 +0000
commited0fac07042c2788ae27970e78d4cbb3c7ff9dae (patch)
treea75a133d5369a105ec826bc8fb751b1b26de7070 /usr.sbin/procctl/procctl.c
parent4372046afcc5fe2c580bb9c53a3f6e9a998a66e7 (diff)
downloadFreeBSD-src-ed0fac07042c2788ae27970e78d4cbb3c7ff9dae.zip
FreeBSD-src-ed0fac07042c2788ae27970e78d4cbb3c7ff9dae.tar.gz
Use err(3). Change Synopsis to SYNOPSIS (needed for macro expansion) and
add SEE ALSO.
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 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;
OpenPOWER on IntegriCloud