mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-03 20:01:57 +00:00
Merge pull request #690 in FS/freeswitch from ~SJTHOMASON/freeswitch:bugfix/FS-8195-compatibility-with-solaris-11-process to master
* commit '4b9bf111d76495b0f97215ece8913e5a2c05ec07': Allow Solaris privileges to work on both Solaris and derivatives
This commit is contained in:
commit
a541519fec
@ -982,24 +982,30 @@ SWITCH_DECLARE(int32_t) set_realtime_priority(void)
|
|||||||
#ifdef SOLARIS_PRIVILEGES
|
#ifdef SOLARIS_PRIVILEGES
|
||||||
/* request the privileges to elevate the priority */
|
/* request the privileges to elevate the priority */
|
||||||
if (priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_PROC_PRIOCNTL, NULL) < 0) {
|
if (priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_PROC_PRIOCNTL, NULL) < 0) {
|
||||||
|
#ifdef PRIV_PROC_PRIOUP
|
||||||
|
/* fallback to PRIV_PROC_PRIOUP on SmartOS */
|
||||||
fprintf(stderr, "WARN: Failed to acquire proc_priocntl privilege (%s)\n", strerror(errno));
|
fprintf(stderr, "WARN: Failed to acquire proc_priocntl privilege (%s)\n", strerror(errno));
|
||||||
} else {
|
if (priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_PROC_PRIOUP, NULL) < 0) {
|
||||||
if (sched_setscheduler(0, SCHED_FIFO, &sched) < 0) {
|
fprintf(stderr, "ERROR: Failed to acquire proc_prioup privilege (%s)\n", strerror(errno));
|
||||||
fprintf(stderr, "ERROR: Failed to set SCHED_FIFO scheduler (%s)\n", strerror(errno));
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv_set(PRIV_ON, PRIV_EFFECTIVE, PRIV_PROC_PRIOUP, NULL) < 0) {
|
|
||||||
fprintf(stderr, "ERROR: Failed to acquire proc_prioup privilege (%s)\n", strerror(errno));
|
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
if (setpriority(PRIO_PROCESS, 0, -10) < 0) {
|
|
||||||
fprintf(stderr, "ERROR: Could not set nice level\n");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "ERROR: Failed to acquire proc_priocntl privilege (%s)\n", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sched_setscheduler(0, SCHED_FIFO, &sched) < 0) {
|
||||||
|
fprintf(stderr, "WARN: Failed to set SCHED_FIFO scheduler (%s)\n", strerror(errno));
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setpriority(PRIO_PROCESS, 0, -10) < 0) {
|
||||||
|
fprintf(stderr, "ERROR: Could not set nice level\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user