Skip to content

restore original procmask for child process - #50

Open
dirk-zimoch wants to merge 2 commits into
ralphlange:masterfrom
dirk-zimoch:restore_sigprocmask
Open

restore original procmask for child process#50
dirk-zimoch wants to merge 2 commits into
ralphlange:masterfrom
dirk-zimoch:restore_sigprocmask

Conversation

@dirk-zimoch

Copy link
Copy Markdown
Contributor

Fix for issue #48.

Comment thread procServ.cc
sigaction(SIGINT, &sig, NULL);
sig.sa_handler = SIG_IGN;
sigaction(SIGQUIT, &sig, NULL);
}

@dirk-zimoch dirk-zimoch Apr 15, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? Ignore CTRL-C when running in the foreground?

@dirk-zimoch dirk-zimoch mentioned this pull request Apr 16, 2021
@dirk-zimoch

Copy link
Copy Markdown
Contributor Author

I rather have #52 than this one merged.

@ericonr ericonr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review of course applies to any PR with these two commits.

Perhaps merging this one first and then the other ones might be easier?

Comment thread procServ.h

// processFactory creates the process that we are managing
connectionItem * processFactory(char *exe, char *argv[]);
connectionItem * processFactory(char *exe, char *argv[], sigset_t *sigset);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be const sigset_t *sigset

Comment thread processClass.h
Comment on lines +18 to +22
friend connectionItem * processFactory(char *exe, char *argv[], sigset_t *sigset);
friend bool processFactoryNeedsRestart();
friend void processFactorySendSignal(int signal);
public:
processClass(char *exe, char *argv[]);
processClass(char *exe, char *argv[], sigset_t *sigset);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for these

Comment thread procServ.cc
Comment on lines +497 to +501
sigaddset(&sigset_block, SIGXFSZ);
if (inFgMode) {
sigaddset(&sigset_block, SIGINT);
sigaddset(&sigset_block, SIGQUIT);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This unblocks some more signals from the child, because the SIG_IGN disposition used in sigaction previously would still apply to the child processes, even if the sigmask was restored.

Would be nice if the commit message called out that nuance.

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.

2 participants