Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 151724 Details for
Bug 206773
setting ionice (ioniceness) of portage in the make.conf
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Adds the ionice (ioniceness) feature
ionice.patch (text/plain), 1.99 KB, created by
Matthias Lübben
on 2008-05-03 20:14:03 UTC
(
hide
)
Description:
Adds the ionice (ioniceness) feature
Filename:
MIME Type:
Creator:
Matthias Lübben
Created:
2008-05-03 20:14:03 UTC
Size:
1.99 KB
patch
obsolete
>--- /usr/bin/emerge 2008-05-03 21:49:13.000000000 +0200 >+++ /home/ml/emerge 2008-05-03 21:48:03.000000000 +0200 >@@ -6617,6 +6617,34 @@ > settings["NOCOLOR"] = "true" > settings.backup_changes("NOCOLOR") > >+def ionice(io_class, io_prio, pid = -1): >+ """Execute the program ionice to adapt io performance""" >+ >+ # Only the root user can use ionice >+ if os.getuid() != 0: >+ return False # Failed not root >+ >+ # Determine the process id to change >+ if pid == -1: >+ npid = os.getpid() >+ else: >+ npid = pid >+ >+ # Search ionice executable in PATH >+ ionice_bin = None >+ for path in os.environ["PATH"].split(":"): >+ file = os.path.join(path, "ionice") >+ if os.path.exists(file): >+ ionice_bin = file >+ break >+ if ionice_bin is None: >+ return False # Failed binary not installed >+ >+ # Execute the ionice program >+ rv = os.system("%s -c%d -n%d -p%d >/dev/null 2>&1" % \ >+ (ionice_bin, io_class, io_prio, npid)) >+ return rv == 0 >+ > def emerge_main(): > # Disable color until we're sure that it should be enabled (after > # EMERGE_DEFAULT_OPTS has been parsed). >@@ -6636,6 +6664,23 @@ > settings, trees, mtimedb = load_emerge_config() > portdb = trees[settings["ROOT"]]["porttree"].dbapi > >+ # Use ionice to amend the performance or responsivness of the system >+ io_class_dict = {"realtime":1, "besteffort":2, "idle":3, "1":1, "2":2, "3":3, "none":-1} >+ try: >+ io_class = io_class_dict[settings.get("PORTAGE_IONICE_CLASS", "none")] >+ io_prio = int(settings.get("PORTAGE_IONICE_PRIO", "4")) >+ if io_prio < 0: raise ValueError >+ if io_prio > 7: raise ValueError >+ except (KeyError, ValueError), e: >+ portage.writemsg("!!! Invalid value in PORTAGE_IONICE_CLASS or PORTAGE_IONICE_PRIO\n") >+ portage.writemsg("!!! PORTAGE_IONICE_CLASS=<realtime|besteffort|idle>\n") >+ portage.writemsg("!!! PORTAGE_IONICE_PRIO=<0..7>\n") >+ io_class = -1 >+ io_prio = -1 >+ del e >+ if io_class != -1 and io_prio != -1: >+ ionice(io_class, io_prio) >+ > try: > os.nice(int(settings.get("PORTAGE_NICENESS", "0"))) > except (OSError, ValueError), e:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 206773
:
151724
|
161266