Open
Conversation
added 2 commits
November 4, 2024 15:39
Adljack starts itself in a terminal application. The terminal application obtains the same pid as is started by the NSM daemon. This is the pid the NSM Daemon 'owns'. To announce with the same pid as the process started by the NSM daemon, it's needed to use getppid (get parent pid), this is the pid of the terminal, whereas getpid gets us the pid of adljack.
When under NSM session management, a NSM clients needs to exite when it gets a SIGTERM signal from the NSM daemon. The case of adljack is a special one, as it launches itself in a terminal application. To match the pid process of the NSM daemon when it starts adljack, the pid of the terminal application is send (parent pid). So the terminal applications get the SIGTERM signal from the NSM daemon. SIGHUP is a signal sent to a process when its controlled terminal is closed. So by adding SIGHUP to the catched signals, adljack exites when the terminal application adljack is launched in, gets a SIGTERM signal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This a way to match the pid send from adljack to that of the process started by the NSM daemon.
It sends the parent pid (the pid of the terminal adljack is launched in) and let's adljack exite by catching SIGHUP when the terminal application gets SIGTERM from the NSM daemon.
Adljack still works this way in NSM. You might want to test it yourself to first.
See: #28