0.47pre
+ * added 'renice' command -- thanks to Dave Cinege <dcinege@psychosis.com>
* 'make install' now creates relative symlinks, and added a new
'make install-hardlinks' target to (tada) install hardlinks.
* syslogd can now log messages to a remote host -- patch thanks
#ifdef BB_REBOOT
{"reboot", reboot_main, _BB_DIR_SBIN, reboot_usage},
#endif
+#ifdef BB_RENICE
+ {"renice", renice_main, _BB_DIR_USR_BIN},
+#endif
#ifdef BB_RM
{"rm", rm_main, _BB_DIR_BIN, rm_usage},
#endif
#ifdef BB_SH
/* Add in a special case hack -- whenever **argv == '-'
* (i.e. '-su' or '-sh') always invoke the shell */
- if (**argv == '-')
+ if (**argv == '-' && *(*argv+1)!= '-') {
exit(((*(shell_main)) (argc, argv)));
+ }
#endif
while (a->name != 0) {
;
#endif
+
+#if defined BB_RENICE
+const char renice_usage[] =
+ "renice priority pid [pid ...]\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nChanges priority of running processes. Allowed priorities range\n"
+ "from 20 (the process runs only when nothing else is running) to 0\n"
+ "(default priority) to -20 (almost nothing else ever gets to run).\n"
+#endif
+ ;
+#endif
+
#if defined BB_RM
const char rm_usage[] =
"rm [OPTION]... FILE...\n"
#ifdef BB_REBOOT
{"reboot", reboot_main, _BB_DIR_SBIN, reboot_usage},
#endif
+#ifdef BB_RENICE
+ {"renice", renice_main, _BB_DIR_USR_BIN},
+#endif
#ifdef BB_RM
{"rm", rm_main, _BB_DIR_BIN, rm_usage},
#endif
#ifdef BB_SH
/* Add in a special case hack -- whenever **argv == '-'
* (i.e. '-su' or '-sh') always invoke the shell */
- if (**argv == '-')
+ if (**argv == '-' && *(*argv+1)!= '-') {
exit(((*(shell_main)) (argc, argv)));
+ }
#endif
while (a->name != 0) {
#define BB_PS
#define BB_PWD
#define BB_REBOOT
+#define BB_RENICE
#define BB_RM
#define BB_RMDIR
#define BB_RMMOD
head, hostid, hostname, id, init, insmod, kill, killall, length, ln,
loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, mkdir,
mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc,
-nslookup, ping, poweroff, printf, ps, pwd, reboot, rm, rmdir, rmmod, sed,
+nslookup, ping, poweroff, printf, ps, pwd, reboot, renice, rm, rmdir, rmmod, sed,
setkeycodes, sh, sleep, sort, swapoff, swapon, sync, syslogd, tail,
tar, tee, telnet, test, touch, tr, true, tty, umount, uname, uniq, update,
uptime, usleep, uudecode, uuencode, wc, which, whoami, yes, zcat, [
-------------------------------
+=item renice
+
+Usage: renice priority pid [pid ...]
+
+Changes priority of running processes. Allowed priorities range
+from 20 (the process runs only when nothing else is running) to 0
+(default priority) to -20 (almost nothing else ever gets to run).
+
+-------------------------------
+
=item rm
Usage: rm [OPTION]... FILE...
=cut
-# $Id: busybox.pod,v 1.58 2000/07/21 15:10:57 proski Exp $
+# $Id: busybox.pod,v 1.59 2000/07/21 21:32:12 andersen Exp $
loadacm, loadfont, loadkmap, logger, logname, ls, lsmod,
makedevs, mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp,
more, mount, mt, mv, nc, nslookup, ping, poweroff, printf, ps,
- pwd, reboot, rm, rmdir, rmmod, sed, setkeycodes, sh, sleep,
+ pwd, reboot, renice, rm, rmdir, rmmod, sed, setkeycodes, sh, sleep,
sort, swapoff, swapon, sync, syslogd, tail, tar, tee, telnet,
test, touch, tr, true, tty, umount, uname, uniq, update,
uptime, usleep, uudecode, uuencode, wc, which, whoami, yes,
</para>
</sect1>
+ <sect1 id="renice">
+ <title>renice</title>
+
+ <para>
+ Usage: renice priority pid [pid ...]
+ </para>
+
+ <para>
+ Changes priority of running processes. Allowed priorities range
+ from 20 (the process runs only when nothing else is running) to 0
+ (default priority) to -20 (almost nothing else ever gets to run).
+ </para>
+ </sect1>
+
<sect1 id="rm">
<title>rm</title>
extern int ps_main(int argc, char** argv);
extern int pwd_main(int argc, char** argv);
extern int reboot_main(int argc, char** argv);
+extern int renice_main(int argc, char** argv);
extern int rm_main(int argc, char** argv);
extern int rmdir_main(int argc, char **argv);
extern int rmmod_main(int argc, char** argv);
extern const char ps_usage[];
extern const char pwd_usage[];
extern const char reboot_usage[];
+extern const char renice_usage[];
extern const char rm_usage[];
extern const char rmdir_usage[];
extern const char rmmod_usage[];
--- /dev/null
+/*
+ * Mini renice implementation for busybox
+ *
+ *
+ * Copyright (C) 2000 Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "internal.h"
+#include <stdio.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+
+extern int renice_main(int argc, char **argv)
+{
+ int prio, err = 0;
+
+ if (argc < 3) usage(renice_usage);
+
+ prio = atoi(*++argv);
+ if (prio > 20) prio = 20;
+ if (prio < -20) prio = -20;
+
+ while (*++argv) {
+ int ps = atoi(*argv);
+ int oldp = getpriority(PRIO_PROCESS, ps);
+
+ if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
+ printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
+ } else {
+ fprintf(stderr, "renice: %d: setpriority: ", ps);
+ perror("");
+ err = 1;
+ }
+ }
+ exit(err);
+}
--- /dev/null
+/*
+ * Mini renice implementation for busybox
+ *
+ *
+ * Copyright (C) 2000 Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "internal.h"
+#include <stdio.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+
+
+extern int renice_main(int argc, char **argv)
+{
+ int prio, err = 0;
+
+ if (argc < 3) usage(renice_usage);
+
+ prio = atoi(*++argv);
+ if (prio > 20) prio = 20;
+ if (prio < -20) prio = -20;
+
+ while (*++argv) {
+ int ps = atoi(*argv);
+ int oldp = getpriority(PRIO_PROCESS, ps);
+
+ if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
+ printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
+ } else {
+ fprintf(stderr, "renice: %d: setpriority: ", ps);
+ perror("");
+ err = 1;
+ }
+ }
+ exit(err);
+}
;
#endif
+
+#if defined BB_RENICE
+const char renice_usage[] =
+ "renice priority pid [pid ...]\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+ "\nChanges priority of running processes. Allowed priorities range\n"
+ "from 20 (the process runs only when nothing else is running) to 0\n"
+ "(default priority) to -20 (almost nothing else ever gets to run).\n"
+#endif
+ ;
+#endif
+
#if defined BB_RM
const char rm_usage[] =
"rm [OPTION]... FILE...\n"