Skip to contentSkip to conversation

alsactl: Wrong line if (!sched_setscheduler(0, SCHED_IDLE, &sched_param))

DISCUSSION GitHub pull_request - opened 1 participant 1 message Apr 16, 2020 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

alsa-project/alsa-utils pull request #38 was opened from Oscar65:

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.

Request URL : https://github.com/alsa-project/alsa-utils/pull/38
Patch URL : https://github.com/alsa-project/alsa-utils/pull/38.patch
Repository URL: https://github.com/alsa-project/alsa-utils