Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from

Conversation

Oscar65
Copy link
Contributor

@Oscar65 Oscar65 commented Apr 16, 2020

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.

…am))

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.
@perexg
Copy link
Member

perexg commented Apr 16, 2020

Add Signed-off-by line, please.

@Oscar65
Copy link
Contributor Author

Oscar65 commented Apr 16, 2020

Add Signed-off-by line, please.

I never did it. Reading I find out that is to certify that I have created the patch. Yes, I did it.

Do I need to do this:

git commit --amend --signoff
git push --force

This will change the commit id. I don't know if this will corrupt the PR.

Could you help me, please?

I was wrong in the last commit.
The if command must check that sched_setscheduler returns -1 before show error message.

Signed-off-by: Oscar Megía <megia.oscar@gmail.com>
@Oscar65
Copy link
Contributor Author

Oscar65 commented Apr 17, 2020

I added Signed-off-by line to the last commit. Is this correct or you need Signed-off-by line in previous commit?

@perexg
Copy link
Member

perexg commented Apr 17, 2020

Merged with cleanups via d2bf876 . Thanks.

@perexg perexg closed this Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants