alsactl: Wrong line if (!sched_setscheduler(0, SCHED_IDLE, &sched_param)) #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As man page says: "If successful, the sched_setparam() function shall return zero."
So the if must be without !
Without update I got this output in the syslog (journalctl):
abr 16 09:25:30 mypc alsactl[1652]: alsactl 1.2.2 daemon started
abr 16 09:25:30 mypc alsactl[1652]: /usr/bin/alsactl: do_nice:165sched_setparam failed: No such file or directory
That I think that is a wrong message. The call to sched_setparam is correct.
This is the output with strace:
getpriority(PRIO_PROCESS, 0) = 20
setpriority(PRIO_PROCESS, 0, 19) = 0
getpriority(PRIO_PROCESS, 0) = 1
sched_getparam(0, [0]) = 0
sched_setscheduler(0, SCHED_IDLE, [0]) = 0
write(2, "/usr/bin/alsactl: do_nice:165: ", 31/usr/bin/alsactl: do_nice:165: ) = 31
write(2, "sched_setparam failed: No such f"..., 48sched_setparam failed: No such file or directory) = 48
write(2, "\n", 1) = 1
Call to sched_setscheduler returns 0, so it means that the call was successful.