WARNSify, fix .Nm usage, deprecate register, use warn
This commit is contained in:
parent
4e304b8dd7
commit
3859d5b356
|
@ -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
|
.\" Copyright (c) 1983, 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" from: @(#)renice.8 8.1 (Berkeley) 6/9/93
|
.\" 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
|
.Dd June 9, 1993
|
||||||
.Dt RENICE 8
|
.Dt RENICE 8
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
.Nm renice
|
.Nm renice
|
||||||
.Nd alter priority of running processes
|
.Nd alter priority of running processes
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm renice
|
.Nm
|
||||||
.Ar priority
|
.Ar priority
|
||||||
.Oo
|
.Oo
|
||||||
.Op Fl p
|
.Op Fl p
|
||||||
|
@ -56,24 +56,24 @@
|
||||||
.Ar user ...
|
.Ar user ...
|
||||||
.Oc
|
.Oc
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm Renice
|
.Nm
|
||||||
alters the
|
alters the
|
||||||
scheduling priority of one or more running processes.
|
scheduling priority of one or more running processes.
|
||||||
The following
|
The following
|
||||||
.Ar who
|
.Ar who
|
||||||
parameters are interpreted as process ID's, process group
|
parameters are interpreted as process ID's, process group
|
||||||
ID's, or user names.
|
ID's, or user names.
|
||||||
.Nm Renice Ns 'ing
|
.Nm "" Ns 'ing
|
||||||
a process group causes all processes in the process group
|
a process group causes all processes in the process group
|
||||||
to have their scheduling priority altered.
|
to have their scheduling priority altered.
|
||||||
.Nm Renice Ns 'ing
|
.Nm "" Ns 'ing
|
||||||
a user causes all processes owned by the user to have
|
a user causes all processes owned by the user to have
|
||||||
their scheduling priority altered.
|
their scheduling priority altered.
|
||||||
By default, the processes to be affected are specified by
|
By default, the processes to be affected are specified by
|
||||||
their process ID's.
|
their process ID's.
|
||||||
.Pp
|
.Pp
|
||||||
Options supported by
|
Options supported by
|
||||||
.Nm renice :
|
.Nm "" :
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Fl g
|
.It Fl g
|
||||||
Force
|
Force
|
||||||
|
|
|
@ -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
|
* Copyright (c) 1983, 1989, 1993
|
||||||
|
@ -33,30 +33,37 @@
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
__COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1993\n\
|
||||||
"@(#) Copyright (c) 1983, 1989, 1993\n\
|
The Regents of the University of California. All rights reserved.\n");
|
||||||
The Regents of the University of California. All rights reserved.\n";
|
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)renice.c 8.1 (Berkeley) 6/9/93";*/
|
/*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 */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <err.h>
|
||||||
#include <pwd.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
|
* Change the priority (nice) of processes
|
||||||
* or groups of processes which are already
|
* or groups of processes which are already
|
||||||
* running.
|
* running.
|
||||||
*/
|
*/
|
||||||
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
int which = PRIO_PROCESS;
|
int which = PRIO_PROCESS;
|
||||||
|
@ -91,16 +98,14 @@ main(argc, argv)
|
||||||
register struct passwd *pwd = getpwnam(*argv);
|
register struct passwd *pwd = getpwnam(*argv);
|
||||||
|
|
||||||
if (pwd == NULL) {
|
if (pwd == NULL) {
|
||||||
fprintf(stderr, "renice: %s: unknown user\n",
|
warnx("%s: unknown user", *argv);
|
||||||
*argv);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
who = pwd->pw_uid;
|
who = pwd->pw_uid;
|
||||||
} else {
|
} else {
|
||||||
who = atoi(*argv);
|
who = atoi(*argv);
|
||||||
if (who < 0) {
|
if (who < 0) {
|
||||||
fprintf(stderr, "renice: %s: bad value\n",
|
warnx("%s: bad value", *argv);
|
||||||
*argv);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +114,7 @@ main(argc, argv)
|
||||||
exit(errs != 0);
|
exit(errs != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
donice(which, who, prio)
|
donice(which, who, prio)
|
||||||
int which, who, prio;
|
int which, who, prio;
|
||||||
{
|
{
|
||||||
|
@ -117,13 +123,11 @@ donice(which, who, prio)
|
||||||
|
|
||||||
errno = 0, oldprio = getpriority(which, who);
|
errno = 0, oldprio = getpriority(which, who);
|
||||||
if (oldprio == -1 && errno) {
|
if (oldprio == -1 && errno) {
|
||||||
fprintf(stderr, "renice: %d: ", who);
|
warn("%d: getpriority", who);
|
||||||
perror("getpriority");
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
if (setpriority(which, who, prio) < 0) {
|
if (setpriority(which, who, prio) < 0) {
|
||||||
fprintf(stderr, "renice: %d: ", who);
|
warn("%d: setpriority", who);
|
||||||
perror("setpriority");
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
printf("%d: old priority %d, new priority %d\n", who, oldprio, prio);
|
printf("%d: old priority %d, new priority %d\n", who, oldprio, prio);
|
||||||
|
|
Loading…
Reference in New Issue