
Путь: Toys/POSIX, команды версии: Ver.4 Ver.9 renice Комментарии в файле renice.c :
Исходный текст в файле renice.c #define FOR_renice
#include "toys.h"
GLOBALS(
long n;
)
void renice_main(void) {
int which = (toys.optflags & FLAG_g) ? PRIO_PGRP :
((toys.optflags & FLAG_u) ? PRIO_USER : PRIO_PROCESS);
char **arg;
for (arg = toys.optargs; *arg; arg++) {
char *s = *arg;
int id = -1;
if (toys.optflags & FLAG_u) {
struct passwd *p = getpwnam(s);
if (p) id = p->pw_uid;
} else {
id = strtol(s, &s, 10);
if (*s) id = -1;
}
if (id < 0) {
error_msg("bad '%s'", *arg);
continue;
}
if (setpriority(which, id, getpriority(which, id)+TT.n) < 0)
perror_msg("setpriority %d", id);
}
} |
![]() |