commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 24/25: Avoid warnings if increasing a threads priority fails.


From: Samuel Thibault
Subject: [hurd] 24/25: Avoid warnings if increasing a threads priority fails.
Date: Mon, 24 Oct 2016 00:16:46 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 355577bc99c91363a1b7828e81086031ce75979b
Author: Justus Winter <address@hidden>
Date:   Thu Oct 13 22:57:58 2016 +0200

    Avoid warnings if increasing a threads priority fails.
    
    * libports/manage-multithread.c (adjust_priorities): Avoid displaying
    error messages if we do not have the privileged processor set port by
    treating this error condition like EPERM.
    * proc/main.c (increase_priority, main): Likewise.
---
 libports/manage-multithread.c | 5 +++++
 proc/main.c                   | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c
index 1588f63..576e767 100644
--- a/libports/manage-multithread.c
+++ b/libports/manage-multithread.c
@@ -68,6 +68,11 @@ adjust_priority (unsigned int totalthreads)
     goto error_pset_priv;
 
   err = thread_max_priority (self, pset_priv, 0);
+  /* If we are running in an unprivileged subhurd, we got a faked
+     privileged processor set port.  This is indeed a kind of
+     permission problem, and we treat it as such.  */
+  if (err == KERN_INVALID_ARGUMENT)
+    err = EPERM;
   if (err)
     goto error_max_priority;
 
diff --git a/proc/main.c b/proc/main.c
index c4936f6..2c5ce55 100644
--- a/proc/main.c
+++ b/proc/main.c
@@ -80,6 +80,11 @@ increase_priority (void)
     goto out;
 
   err = thread_max_priority (mach_thread_self (), psetcntl, 0);
+  /* If we are running in an unprivileged subhurd, we got a faked
+     privileged processor set port.  This is indeed a kind of
+     permission problem, and we treat it as such.  */
+  if (err == KERN_INVALID_ARGUMENT)
+    err = EPERM;
   if (err)
     goto out;
 
@@ -155,7 +160,7 @@ main (int argc, char **argv, char **envp)
   /* Give ourselves good scheduling performance, because we are so
      important. */
   err = increase_priority ();
-  if (err)
+  if (err && err != EPERM)
     error (0, err, "Increasing priority failed");
 
   err = register_new_task_notification (_hurd_host_priv,

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]