]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't check for error when lowering priority (according to the manpage, it should...
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 9 Apr 2007 02:49:06 +0000 (02:49 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 9 Apr 2007 02:49:06 +0000 (02:49 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@60849 65c4cc65-6c06-0410-ace0-fbb531ad65f3

asterisk.c
include/asterisk.h

index 228a1acd589d835e85146768963e08b66bb08c35..9c484605a259bb6b0e73d87c63664df041e9a6d4 100644 (file)
@@ -795,6 +795,7 @@ int ast_set_priority(int pri)
        struct sched_param sched;
        memset(&sched, 0, sizeof(sched));
 #ifdef __linux__
+#undef sched_setscheduler
        if (pri) {  
                sched.sched_priority = 10;
                if (sched_setscheduler(0, SCHED_RR, &sched)) {
@@ -805,12 +806,11 @@ int ast_set_priority(int pri)
                                ast_verbose("Set to realtime thread\n");
        } else {
                sched.sched_priority = 0;
-               if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
-                       ast_log(LOG_WARNING, "Unable to set normal priority\n");
-                       return -1;
-               }
+               /* According to the manpage, this can never fail, with these parameters. */
+               sched_setscheduler(0, SCHED_OTHER, &sched);
        }
 #else
+#undef setpriority
        if (pri) {
                if (setpriority(PRIO_PROCESS, 0, -10) == -1) {
                        ast_log(LOG_WARNING, "Unable to set high priority\n");
@@ -819,10 +819,8 @@ int ast_set_priority(int pri)
                        if (option_verbose)
                                ast_verbose("Set to high priority\n");
        } else {
-               if (setpriority(PRIO_PROCESS, 0, 0) == -1) {
-                       ast_log(LOG_WARNING, "Unable to set normal priority\n");
-                       return -1;
-               }
+               /* According to the manpage, this can never fail, with these parameters. */
+               setpriority(PRIO_PROCESS, 0, 0);
        }
 #endif
        return 0;
index 68f17ea5f5fb4b7d009382ad719c51d23d615d76..b8ea85038512032c3348cdfc846c9462e3bc28b8 100644 (file)
@@ -21,6 +21,8 @@
 #define DEFAULT_LANGUAGE "en"
 
 #define AST_CONFIG_MAX_PATH 255
+#define        setpriority     __PLEASE_USE_ast_set_priority_INSTEAD_OF_setpriority__
+#define        sched_setscheduler      __PLEASE_USE_ast_set_priority_INSTEAD_OF_sched_setscheduler__
 
 /* provided in asterisk.c */
 extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];