3
0
forked from pool/util-linux
OBS User unknown 2007-07-05 17:13:28 +00:00 committed by Git OBS Bridge
parent 7e333fa6b3
commit 55b45f1820
6 changed files with 48 additions and 292 deletions

View File

@ -1,247 +0,0 @@
Index: util-linux-ng-2.12r+git20070703/sys-utils/ionice.1
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070703/sys-utils/ionice.1
@@ -0,0 +1,71 @@
+.TH ionice "1" "August 2005" ionice
+.SH NAME
+ionice \- get/set program io scheduling class and priority
+.SH SYNOPSIS
+.B ionice
+[\fI-c\fR] \fI[-n\fR] [\fI-p\fR] [COMMAND [ARG...]]
+
+.SH DESCRIPTION
+This program sets the io scheduling class and priority for a program. As of
+this writing, Linux supports 3 scheduling classes:
+
+\fBIdle\fR.
+A program running with idle io priority will only get disk time when no other
+program has asked for disk io for a defined grace period. The impact of idle
+io processes on normal system activity should be zero. This scheduling
+class does not take a priority argument.
+
+\fBBest effort\fR.
+This is the default scheduling class for any process that hasn't asked for
+a specific io priority. Programs inherit the CPU nice setting for io
+priorities. This class takes a priority argument from \fI0-7\fR, with lower
+number being higher priority. Programs running at the same best effort
+priority are served in a round-robin fashion.
+
+\fBReal time\fR.
+The RT scheduling class is given first access to the disk, regardless of
+what else is going on in the system. Thus the RT class needs to be used with
+some care, as it can starve other processes. As with the best effort class,
+8 priority levels are defined denoting how big a time slice a given process
+will receive on each scheduling window.
+
+If no arguments or just \fI-p\fR is given, \fIionice\fR will query the
+current io scheduling class and priority for that process.
+
+.SH OPTIONS
+.LP
+.TP 7
+\fB-c\fP
+The scheduling class. 1 for real time, 2 for best-effort, 3 for idle.
+.TP 7
+\fB-n\fP
+The scheduling class data. This defines the class data, if the class
+accepts an argument. For real time and best-effort, \fI0-7\fR is valid
+data.
+.TP 7
+\fB-p\fP
+Pass in a process pid to change an already running process. If this argument
+is not given, \fBionice\fP will run the listed program with the given
+parameters.
+
+.SH EXAMPLES
+.LP
+.TP 7
+# \fBionice\fP -c3 -p89
+.TP 7
+Sets process with PID 89 as an idle io process.
+.TP 7
+# \fBionice\fP -c2 -n0 bash
+.TP 7
+Runs 'bash' as a best-effort program with highest priority.
+.TP 7
+# \fBionice\fP -p89
+.TP 7
+Returns the class and priority of the process with PID 89.
+
+.SH NOTES
+Linux supports io scheduling priorities and classes since 2.6.13 with the CFQ
+io scheduler.
+
+.SH AUTHORS
+Jens Axboe <axboe@suse.de>
Index: util-linux-ng-2.12r+git20070703/sys-utils/ionice.c
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070703/sys-utils/ionice.c
@@ -0,0 +1,144 @@
+/*
+ * ionice: set or get process io scheduling class and priority
+ *
+ * Copyright (C) 2005 Jens Axboe <axboe@suse.de> SUSE Labs
+ *
+ * Released under the terms of the GNU General Public License version 2
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+#include <asm/unistd.h>
+
+#if defined(__i386__)
+#define __NR_ioprio_set 289
+#define __NR_ioprio_get 290
+#elif defined(__powerpc__) || defined(__powerpc64__)
+#define __NR_ioprio_set 273
+#define __NR_ioprio_get 274
+#elif defined(__x86_64__)
+#define __NR_ioprio_set 251
+#define __NR_ioprio_get 252
+#elif defined(__ia64__)
+#define __NR_ioprio_set 1274
+#define __NR_ioprio_get 1275
+#elif defined(__alpha__)
+#define __NR_ioprio_set 442
+#define __NR_ioprio_get 443
+#elif defined(__s390__) || defined(__s390x__)
+#define __NR_ioprio_set 282
+#define __NR_ioprio_get 283
+#elif defined(__arm__)
+#define __NR_ioprio_set 314
+#define __NR_ioprio_get 315
+#else
+#error "Unsupported arch"
+#endif
+
+static int ioprio_set(int which, int who, int ioprio)
+{
+ return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
+static int ioprio_get(int which, int who)
+{
+ return syscall(__NR_ioprio_get, which, who);
+}
+
+enum {
+ IOPRIO_CLASS_NONE,
+ IOPRIO_CLASS_RT,
+ IOPRIO_CLASS_BE,
+ IOPRIO_CLASS_IDLE,
+};
+
+enum {
+ IOPRIO_WHO_PROCESS = 1,
+ IOPRIO_WHO_PGRP,
+ IOPRIO_WHO_USER,
+};
+
+#define IOPRIO_CLASS_SHIFT 13
+
+const char *to_prio[] = { "none", "realtime", "best-effort", "idle", };
+
+static void usage(void)
+{
+ printf("Usage: ionice [OPTIONS] [COMMAND [ARG]...]\n");
+ printf("Sets or gets process io scheduling class and priority.\n");
+ printf("\n\t-n\tClass data (typically 0-7, lower being higher prio)\n");
+ printf("\t-c\tScheduling class\n");
+ printf("\t\t\t1: realtime, 2: best-effort, 3: idle\n");
+ printf("\t-p\tProcess pid\n");
+ printf("\t-h\tThis help page\n");
+ printf("\nJens Axboe <axboe@suse.de> (C) 2005\n");
+}
+
+int main(int argc, char *argv[])
+{
+ int ioprio = 4, set = 0, ioprio_class = IOPRIO_CLASS_BE;
+ int c, pid = 0;
+
+ while ((c = getopt(argc, argv, "+n:c:p:h")) != EOF) {
+ switch (c) {
+ case 'n':
+ ioprio = strtol(optarg, NULL, 10);
+ set = 1;
+ break;
+ case 'c':
+ ioprio_class = strtol(optarg, NULL, 10);
+ set = 1;
+ break;
+ case 'p':
+ pid = strtol(optarg, NULL, 10);
+ break;
+ case 'h':
+ default:
+ usage();
+ exit(0);
+ }
+ }
+
+ switch (ioprio_class) {
+ case IOPRIO_CLASS_NONE:
+ ioprio_class = IOPRIO_CLASS_BE;
+ break;
+ case IOPRIO_CLASS_RT:
+ case IOPRIO_CLASS_BE:
+ break;
+ case IOPRIO_CLASS_IDLE:
+ ioprio = 7;
+ break;
+ default:
+ printf("bad prio class %d\n", ioprio_class);
+ return 1;
+ }
+
+ if (!set) {
+ if (!pid && argv[optind])
+ pid = strtol(argv[optind], NULL, 10);
+
+ ioprio = ioprio_get(IOPRIO_WHO_PROCESS, pid);
+
+ if (ioprio == -1)
+ perror("ioprio_get");
+ else {
+ ioprio_class = ioprio >> IOPRIO_CLASS_SHIFT;
+ ioprio = ioprio & 0xff;
+ printf("%s: prio %d\n", to_prio[ioprio_class], ioprio);
+ }
+ } else {
+ if (ioprio_set(IOPRIO_WHO_PROCESS, pid, ioprio | ioprio_class << IOPRIO_CLASS_SHIFT) == -1)
+ perror("ioprio_set");
+
+ if (argv[optind])
+ execvp(argv[optind], &argv[optind]);
+ }
+
+ return 0;
+}
Index: util-linux-ng-2.12r+git20070703/sys-utils/Makefile.am
===================================================================
--- util-linux-ng-2.12r+git20070703.orig/sys-utils/Makefile.am
+++ util-linux-ng-2.12r+git20070703/sys-utils/Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/config/include-Mak
bin_PROGRAMS = dmesg
-usrbinexec_PROGRAMS = cytune flock ipcrm ipcs renice setsid setarch
+usrbinexec_PROGRAMS = cytune flock ionice ipcrm ipcs renice setsid setarch
cytune_SOURCES = cytune.c cyclades.h
@@ -12,7 +12,7 @@ usrsbinexec_PROGRAMS = readprofile tunel
tunelp_SOURCES = tunelp.c lp.h
-man_MANS = flock.1 readprofile.1 \
+man_MANS = flock.1 ionice.1 readprofile.1 \
ctrlaltdel.8 cytune.8 dmesg.1 ipcrm.1 ipcs.1 renice.1 \
setsid.1 tunelp.8 setarch.8

View File

@ -1,26 +0,0 @@
--- misc-utils/cal.c
+++ misc-utils/cal.c
@@ -702,18 +702,16 @@
}
void
-trim_trailing_spaces(s)
- char *s;
+trim_trailing_spaces(char *s)
{
char *p;
for (p = s; *p; ++p)
continue;
- while (p > s && isspace(*--p))
- continue;
- if (p > s)
- ++p;
- *p = '\0';
+
+ p--;
+ if (isspace(*p))
+ *p = '\0';
}
/*

View File

@ -1,14 +1,14 @@
Index: util-linux-ng-2.12r+git20070703/sys-utils/Makefile.am
Index: util-linux-ng-2.13-rc1/sys-utils/Makefile.am
===================================================================
--- util-linux-ng-2.12r+git20070703.orig/sys-utils/Makefile.am
+++ util-linux-ng-2.12r+git20070703/sys-utils/Makefile.am
--- util-linux-ng-2.13-rc1.orig/sys-utils/Makefile.am
+++ util-linux-ng-2.13-rc1/sys-utils/Makefile.am
@@ -1,9 +1,11 @@
include $(top_srcdir)/config/include-Makefile.am
-bin_PROGRAMS = dmesg
+bin_PROGRAMS = arch dmesg
usrbinexec_PROGRAMS = cytune flock ionice ipcrm ipcs renice setsid setarch
usrbinexec_PROGRAMS = cytune flock ipcrm ipcs renice setsid setarch
+arch_SOURCES = arch.c
+
@ -19,15 +19,15 @@ Index: util-linux-ng-2.12r+git20070703/sys-utils/Makefile.am
tunelp_SOURCES = tunelp.c lp.h
-man_MANS = flock.1 ionice.1 readprofile.1 \
+man_MANS = arch.1 flock.1 ionice.1 readprofile.1 \
-man_MANS = flock.1 readprofile.1 \
+man_MANS = arch.1 flock.1 readprofile.1 \
ctrlaltdel.8 cytune.8 dmesg.1 ipcrm.1 ipcs.1 renice.1 \
setsid.1 tunelp.8 setarch.8
Index: util-linux-ng-2.12r+git20070703/sys-utils/arch.1
Index: util-linux-ng-2.13-rc1/sys-utils/arch.1
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070703/sys-utils/arch.1
+++ util-linux-ng-2.13-rc1/sys-utils/arch.1
@@ -0,0 +1,34 @@
+.\" arch.1 --
+.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
@ -63,10 +63,10 @@ Index: util-linux-ng-2.12r+git20070703/sys-utils/arch.1
+.\" Then how come we get these i586 values?
+.\" Well, the routine check_bugs() does system_utsname.machine[1] = '0' + x86;
+.\" (called in init/main.c, defined in ./include/asm-i386/bugs.h)
Index: util-linux-ng-2.12r+git20070703/sys-utils/arch.c
Index: util-linux-ng-2.13-rc1/sys-utils/arch.c
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070703/sys-utils/arch.c
+++ util-linux-ng-2.13-rc1/sys-utils/arch.c
@@ -0,0 +1,35 @@
+/* arch -- print machine architecture information
+ * Created: Mon Dec 20 12:27:15 1993 by faith@cs.unc.edu

View File

@ -0,0 +1,16 @@
Index: util-linux-ng-2.13-rc1/sys-utils/Makefile.am
===================================================================
--- util-linux-ng-2.13-rc1.orig/sys-utils/Makefile.am
+++ util-linux-ng-2.13-rc1/sys-utils/Makefile.am
@@ -26,6 +26,11 @@ usrsbinexec_PROGRAMS += rdev
man_MANS += rdev.8 ramsize.8 rootflags.8 vidmode.8
RDEV_LINKS = ramsize vidmode rootflags
endif
+if ARCH_86_64
+usrsbinexec_PROGRAMS += rdev
+man_MANS += rdev.8 ramsize.8 rootflags.8 vidmode.8
+RDEV_LINKS = ramsize vidmode rootflags
+endif
endif
SETARCH_LINKS = linux32 linux64

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Jul 5 16:08:58 CEST 2007 - mkoenig@suse.de
- use %config(noreplace) for /etc/filesystems
- Keep rdev stuff for x86_64
util-linux-2.13-sys_utils_build_rdev_x86_64.patch
- removed patches (merged upstream)
util-linux-2.12r-misc_utils_cal_formatting.patch
util-linux-2.12q-sys_utils_ionice.patch
-------------------------------------------------------------------
Thu Jul 5 11:59:30 CEST 2007 - mkoenig@suse.de

View File

@ -21,7 +21,7 @@ License: BSD 3-Clause, GPL v2 or later
Group: System/Base
Autoreqprov: on
Version: 2.12r+2.13rc1
Release: 1
Release: 2
%define upver 2.13-rc1
Summary: A collection of basic system utilities
Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/%name-ng-%upver.tar.bz2
@ -59,8 +59,6 @@ Patch6: util-linux-2.11z-hwclock_geteuid.patch
Patch8: util-linux-2.12a-mount_procswapcheck.patch
# 57097 (suse42097) - mount doesn't allow to mount files that have colons in their path
Patch10: util-linux-2.12a-mount_mountpointwithcolon.patch
# add ionice
Patch14: util-linux-2.12q-sys_utils_ionice.patch
# 104405 - mount -a doesn't work with hotpluggable devices
Patch16: util-linux-mount_opt_hotplug.patch
# 115129 - mount --move doesn't work as expected
@ -78,8 +76,6 @@ Patch26: util-linux-2.12r-mount_mount.8_xfs_update.patch
Patch29: util-linux-2.12r-fdisk_cyl.patch
# 179122 - Fix readprofile one ppc64
Patch30: util-linux-2.12r-sys_utils_readprofile_mapfile.patch
# 203469
Patch31: util-linux-2.12r-misc_utils_cal_formatting.patch
# 205956 - default swap to V1 in any case
Patch32: util-linux-2.12r-disk_utils_mkswap_fix.patch
# 238687 - let mkfs tools open block devices with O_EXCL
@ -91,6 +87,7 @@ Patch35: util-linux-2.12r-fdisk_remove_bogus_warnings.patch
Patch38: util-linux-2.12r-mount_swapon_swsuspend_resume.patch
Patch40: util-linux-2.13-sys_utils_arch.patch
Patch44: util-linux-2.13-schedutils_chrt.patch
Patch45: util-linux-2.13-sys_utils_build_rdev_x86_64.patch
##
## adjtimex
##
@ -130,7 +127,6 @@ Authors:
%patch6
%patch8 -p1
%patch10 -p1
%patch14 -p1
%patch16 -p1
%patch18
%patch21
@ -138,13 +134,13 @@ Authors:
%patch26
%patch29 -p1
%patch30 -p1
%patch31
%patch32 -p1
%patch34 -p1
%patch35 -p1
#%patch38 -p1
%patch40 -p1
%patch44 -p1
%patch45 -p1
#
cd adjtimex-*
%patch50 -p1
@ -372,7 +368,7 @@ fi
%doc README.largedisk
%config %attr(744,root,root) /etc/init.d/raw
%config(noreplace) %attr(644,root,root) /etc/raw
%config /etc/filesystems
%config(noreplace) /etc/filesystems
/usr/sbin/rcraw
/bin/arch
/bin/dmesg
@ -535,7 +531,7 @@ fi
/sbin/cfdisk
/sbin/sfdisk
%endif
%ifarch %ix86
%ifarch %ix86 x86_64
/usr/sbin/ramsize
/usr/sbin/rdev
/usr/sbin/rootflags
@ -582,6 +578,13 @@ fi
%changelog
* Thu Jul 05 2007 - mkoenig@suse.de
- use %%config(noreplace) for /etc/filesystems
- Keep rdev stuff for x86_64
util-linux-2.13-sys_utils_build_rdev_x86_64.patch
- removed patches (merged upstream)
util-linux-2.12r-misc_utils_cal_formatting.patch
util-linux-2.12q-sys_utils_ionice.patch
* Thu Jul 05 2007 - mkoenig@suse.de
- update to 2.13-rc1:
* mount fixes
* agetty: add 'O' escape code to display domain name