WARNSify, fix .Nm usage, deprecate register, use warn

This commit is contained in:
lukem 1997-10-19 14:01:33 +00:00
parent 4e304b8dd7
commit 3859d5b356
2 changed files with 25 additions and 21 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: renice.8,v 1.4 1997/08/25 16:43:47 kleink Exp $
.\" $NetBSD: renice.8,v 1.5 1997/10/19 14:01:33 lukem Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -32,7 +32,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)renice.8 8.1 (Berkeley) 6/9/93
.\" $NetBSD: renice.8,v 1.4 1997/08/25 16:43:47 kleink Exp $
.\" $NetBSD: renice.8,v 1.5 1997/10/19 14:01:33 lukem Exp $
.\"
.Dd June 9, 1993
.Dt RENICE 8
@ -41,7 +41,7 @@
.Nm renice
.Nd alter priority of running processes
.Sh SYNOPSIS
.Nm renice
.Nm
.Ar priority
.Oo
.Op Fl p
@ -56,24 +56,24 @@
.Ar user ...
.Oc
.Sh DESCRIPTION
.Nm Renice
.Nm
alters the
scheduling priority of one or more running processes.
The following
.Ar who
parameters are interpreted as process ID's, process group
ID's, or user names.
.Nm Renice Ns 'ing
.Nm "" Ns 'ing
a process group causes all processes in the process group
to have their scheduling priority altered.
.Nm Renice Ns 'ing
.Nm "" Ns 'ing
a user causes all processes owned by the user to have
their scheduling priority altered.
By default, the processes to be affected are specified by
their process ID's.
.Pp
Options supported by
.Nm renice :
.Nm "" :
.Bl -tag -width Ds
.It Fl g
Force

View File

@ -1,4 +1,4 @@
/* $NetBSD: renice.c,v 1.4 1997/01/09 14:39:12 tls Exp $ */
/* $NetBSD: renice.c,v 1.5 1997/10/19 14:01:38 lukem Exp $ */
/*
* Copyright (c) 1983, 1989, 1993
@ -33,30 +33,37 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1983, 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
__COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n");
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)renice.c 8.1 (Berkeley) 6/9/93";*/
static char rcsid[] = "$NetBSD: renice.c,v 1.4 1997/01/09 14:39:12 tls Exp $";
__RCSID("$NetBSD: renice.c,v 1.5 1997/10/19 14:01:38 lukem Exp $");
#endif /* not lint */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <stdio.h>
#include <err.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
int donice __P((int, int, int));
int main __P((int, char **));
/*
* Change the priority (nice) of processes
* or groups of processes which are already
* running.
*/
int
main(argc, argv)
int argc;
char **argv;
{
int which = PRIO_PROCESS;
@ -91,16 +98,14 @@ main(argc, argv)
register struct passwd *pwd = getpwnam(*argv);
if (pwd == NULL) {
fprintf(stderr, "renice: %s: unknown user\n",
*argv);
warnx("%s: unknown user", *argv);
continue;
}
who = pwd->pw_uid;
} else {
who = atoi(*argv);
if (who < 0) {
fprintf(stderr, "renice: %s: bad value\n",
*argv);
warnx("%s: bad value", *argv);
continue;
}
}
@ -109,6 +114,7 @@ main(argc, argv)
exit(errs != 0);
}
int
donice(which, who, prio)
int which, who, prio;
{
@ -117,13 +123,11 @@ donice(which, who, prio)
errno = 0, oldprio = getpriority(which, who);
if (oldprio == -1 && errno) {
fprintf(stderr, "renice: %d: ", who);
perror("getpriority");
warn("%d: getpriority", who);
return (1);
}
if (setpriority(which, who, prio) < 0) {
fprintf(stderr, "renice: %d: ", who);
perror("setpriority");
warn("%d: setpriority", who);
return (1);
}
printf("%d: old priority %d, new priority %d\n", who, oldprio, prio);