[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 22/64: proc: gracefully handle failure to increase priority
From: |
Samuel Thibault |
Subject: |
[hurd] 22/64: proc: gracefully handle failure to increase priority |
Date: |
Wed, 10 Dec 2014 15:17:04 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 8bee9fcf5fc9e47e1aac0a670cc8d5e3fba8a7dd
Author: Justus Winter <address@hidden>
Date: Fri Nov 7 14:57:43 2014 +0100
proc: gracefully handle failure to increase priority
* proc/main.c (increase_priority): New function.
(main): Move code increasing the proc servers priority to a new
function and handle errors gracefully.
---
proc/main.c | 44 ++++++++++++++++++++++++++++++++------------
1 file changed, 32 insertions(+), 12 deletions(-)
diff --git a/proc/main.c b/proc/main.c
index f1f4e1b..3419d44 100644
--- a/proc/main.c
+++ b/proc/main.c
@@ -60,12 +60,40 @@ message_demuxer (mach_msg_header_t *inp,
pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
+error_t
+increase_priority (void)
+{
+ mach_port_t pset = MACH_PORT_NULL, psetcntl = MACH_PORT_NULL;
+ error_t err;
+
+ err = thread_get_assignment (mach_thread_self (), &pset);
+ if (err)
+ goto out;
+
+ err = host_processor_set_priv (_hurd_host_priv, pset, &psetcntl);
+ if (err)
+ goto out;
+
+ err = thread_max_priority (mach_thread_self (), psetcntl, 0);
+ if (err)
+ goto out;
+
+ err = task_priority (mach_task_self (), 2, 1);
+
+ out:
+ if (MACH_PORT_VALID (pset))
+ mach_port_deallocate (mach_task_self (), pset);
+ if (MACH_PORT_VALID (psetcntl))
+ mach_port_deallocate (mach_task_self (), psetcntl);
+
+ return err;
+}
+
int
main (int argc, char **argv, char **envp)
{
mach_port_t boot;
error_t err;
- mach_port_t pset, psetcntl;
void *genport;
process_t startup_port;
struct argp argp = { 0, 0, 0, "Hurd process server" };
@@ -120,17 +148,9 @@ main (int argc, char **argv, char **envp)
/* Give ourselves good scheduling performance, because we are so
important. */
- err = thread_get_assignment (mach_thread_self (), &pset);
- assert_perror (err);
- err = host_processor_set_priv (_hurd_host_priv, pset, &psetcntl);
- assert_perror (err);
- thread_max_priority (mach_thread_self (), psetcntl, 0);
- assert_perror (err);
- err = task_priority (mach_task_self (), 2, 1);
- assert_perror (err);
-
- mach_port_deallocate (mach_task_self (), pset);
- mach_port_deallocate (mach_task_self (), psetcntl);
+ err = increase_priority ();
+ if (err)
+ error (0, err, "Increasing priority failed");
{
/* Get our stderr set up to print on the console, in case we have
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] branch upstream updated (e4a9a4d -> 4c7abe4), Samuel Thibault, 2014/12/10
- [hurd] 09/64: Fix recording complete path of passive relative translators, Samuel Thibault, 2014/12/10
- [hurd] 10/64: Fix compiler warning, Samuel Thibault, 2014/12/10
- [hurd] 12/64: trans/mtab: avoid firmlink loops, Samuel Thibault, 2014/12/10
- [hurd] 15/64: startup: rename /hurd/init to /hurd/startup, Samuel Thibault, 2014/12/10
- [hurd] 11/64: Always canonicalize fstab entries with realpath, Samuel Thibault, 2014/12/10
- [hurd] 23/64: startup: also open `console' for reading, Samuel Thibault, 2014/12/10
- [hurd] 26/64: boot: drop obsolete device procedures, Samuel Thibault, 2014/12/10
- [hurd] 16/64: init: add a minimalist init program, Samuel Thibault, 2014/12/10
- [hurd] 22/64: proc: gracefully handle failure to increase priority,
Samuel Thibault <=
- [hurd] 25/64: boot: remove unused function `boot_script_read_file', Samuel Thibault, 2014/12/10
- [hurd] 31/64: libdiskfs: fix fabrication of protid, Samuel Thibault, 2014/12/10
- [hurd] 17/64: startup: do not pass signals on to the child, Samuel Thibault, 2014/12/10
- [hurd] 29/64: boot: improve the demuxer, Samuel Thibault, 2014/12/10
- [hurd] 14/64: procfs: do not hard-code the default argument values, Samuel Thibault, 2014/12/10
- [hurd] 32/64: Fix proc crashes, Samuel Thibault, 2014/12/10
- [hurd] 13/64: Add proc_set_init_task, make runsystem pid 1, Samuel Thibault, 2014/12/10
- [hurd] 40/64: libnetfs: add a payload-aware intrans function, Samuel Thibault, 2014/12/10
- [hurd] 21/64: Makeconf: handle the gnumach protocol, Samuel Thibault, 2014/12/10
- [hurd] 39/64: libdiskfs: add payload-aware intrans functions, Samuel Thibault, 2014/12/10