add function to return all inherited files #68
Merged
+89
−0
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 is helpful in the use case of integrating with systemd socket activation.
When there is no parent, the app need to scan or use actication.Files() to
find all the fds and call upgrader.AddFile() to track them. But when there is a
parent, with the help of this new function, we can find the fds from upgrader
instance rather then by scanning fds or calling actication.Files() both of which
creates a set of os.File representing the underlying fds.
Without this change, there would be two set of os.File objects that represent
the same fd set. One set of os.File is hold by the upgrader while the another set
returning from fd scanning (or actication.Files()) is being used at other places.
This raise a risk of closing the same fd twice at different time which is really bad
when the fd number get reused by other files during the two close calls.