-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
initctl signal <name> <signal> for send process signals #225
Comments
Neat idea, I'm using something similar myself right now! :) |
Basic idea for the implementation, @jorgensigvardsson:
|
So, basically, this issue is about locating the correct PID for the currently executing service, and send the requested signal to it. Shouldn't this be restricted in some way? Normally you can't do this to any other process than your own:
Do you mean that this function is free for all? No group membership required, or finit config specifying which users (or groups) that may do this? Globally or per service (or both)? |
Just to clarify, it's to send a custom signal to a run/task/service managed by Finit. Not unlike the start/stop/restart commands. Maybe that info got lost. (For other processes there's Yes, it's currently restricted by 1) the execute permission flags on Sorry for the confusion my comment may have caused. I sometimes forget to mention all the specific use-cases, and the details surrounding them, that exist. |
Hey no problem! So, if I understand you correctly, the policies are already in place, or at least the assumption is that they are. I suppose looking at |
Yes they are. Locked down by default :) Yup, they are all the same under the hood. Good luck! |
Ok, I have extended the command parsing with a new callback Also, could not find a precedented way to send multiple arguments to the backend (via do_svc), so I came up with the following convention:
I just separate the arguments with |
Looks very promising so far! 😃👍 I have several comments, but lets start with your question. I think it's better to reuse the However, in this specific case I don't think we need to add multiarg, we only need one extra arg, and for that you can use the runlevel field. It is up to each CMD to define the API. (The field names are only historical, there was an old SysV compatible FIFO in /dev prior to the current UNIX domain socket API.) Now, for some other feedback:
|
Yeah, sorry about the brace inconsistency. Combination of typing on a laptop, in a sofa, half watching "Mello", while discussing the merits of the contestants with children. In those situations, all seconds count as the battle with mental fatigue does not afford any complicated movements on the keyboard! 😂 Rest assured, I don't fancy braced single statements. Comments, I'll fix those, no problems. Old habits die hard! I'll drop the calloc/free. Embarrassed I didn't snprintf straight into the buffer. Guess I stared too hard on Not sure what you mean about the API part though. Just to clarify, this commit isn't done yet. The intent is to amend and force push it. I had in mind a two part PR: one for In which commit would you like to see the man page changes? I take it goes into the |
And also, the command description, I'll of course drop the optional ID thing! |
Consider it a pre-review to your PR, glad to you took it so well :) Yeah, depending on the size of the change of course, but splitting commits in a way that they are easy to review, adds or changes one thing at a time, i.e., bisectable. The man page update can be a separate commit. Sometimes the README commit can actually be the first commit. Depends on the thing to do, but writing down how someone else should use your thing is a really good design exercise. Looking forward to your PR, we can do more nit-picking there, if needed 😃 |
Now I'm confused. |
There we go, I think I've smacked the commit around a little to suit your taste better: jorgensigvardsson@d3238e4 And I don't mind the nit-picking. I'm basically a contractor doing work in your home, with the promising of me and my coworkers crashing there! 😅 Edit: force pushed a small change that removes a warning about comparing |
PR coming up real soon. I think I'm doing the right thing in |
Tried to run it on
Not sure why this is an issue. Did specify Will have to look at this later this evening. I'm a bit stumped :) |
This looks much better, well done! I'll comment in detail on the PR later tonight; only some minor things. Re: panic. This is what happens when PID 1 dies, kernel is a slave under PID 1 basically. So we don't do bugs in PID 1 :-) |
Thanks for the tip! Will return to computer shortly for a while, and run make with V=1 too. That may also give some clues to what is happening. |
Also going to muck around in the output directory. I suppose I will find the target file system in there in a directory used as a basis for the image. This is an opportunity for learning! Sorry for a low signal to noise ratio on this issue! 😅 |
Not sure what triggered the panic. I had a look at the target file system under Now I have other issues. finit doesn't seem to send the request (found |
Found the issue. Looks like |
I have now successfully killed Did some git sorcery, updated the history (rebased bug fix onto first commit, as the fix was for that particular commit, keeping the noise low in the PR). |
Basis build validates the signal feature of finit. |
Rebuilding in Buildroot sometimes requires -rebuild, sometimes, -reconfigure, and sometimes a -dirclean is needed. It depends on what you do. The manual explains this in a bit more detail :) Great work so far! HUP and KILL we already sort of test, op suggested this feature to send USR1/USR2 to udhcpc. I guress this is as good a time as any to create a test case. You can add signal support to the shell script used, |
Nice! Not at the computer right now, but I presume these scripts all use unshare? |
Yes, it's actually a framework designed by Jacques, so if you run into any issues with the framework he might be better to ask :) |
I tracked the error down to this: print_result(RANDOM_BYTES != copyfile("/dev/urandom", RANDOMSEED, RANDOM_BYTES, 0)); When looking in tenv-root/var/lib/misc, I see:
The code specifies that 32 KB should be saved, but only 512 bytes are saved. Have no idea what's going on here, but my suspicion is that there is not enough entropy to save 32 KB. Will try testing without random seed turned on. |
@jorgensigvardsson Let's move that topic to a separate discussion/issue, OK? We need to at least try to keep this one on point. |
There are times where I need to send a custom signal directly to a running process.
For example, udhcpc can receive a custom user signal to release or renew an ip if running as a daemon.
It would be great if there was a command in initctl to do this. I am thinking something like:
initctl signal <name> <signal>
For example
initctl signal udhcpc SIGUSR1
I do have a workaround but it is not very elegant:
initctl -b -p status udhcpc| grep '\s*PID\s:' | sed 's|.*: ||' | xargs kill -s SIGUSR1
The text was updated successfully, but these errors were encountered: