-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
please document sd_journal_stream_fd as async-signal-safe, if it is #7912
Labels
Comments
Pedantry: you need an async-signal-safe function when you want to call it between fork() and exec() in a program which has multiple threads. (No criticism of your real point; this seems reasonable to ask for). |
Oops. There's nothing wrong with #7938, but it documents the wrong function ;) |
keszybz
added a commit
to keszybz/systemd
that referenced
this issue
Jan 21, 2018
yuwata
pushed a commit
that referenced
this issue
Jan 21, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Submission type
systemd version the issue has been seen with
236
Used distribution
Debian
sd_journal_stream_fd(3) is not documented to be async-signal-safe (see POSIX signal-safety(7)), making it unsafe (formally undefined behaviour in POSIX, I think) to call it between fork(2) and the following execve(2).
Last time I looked, the implementation did seem to be async-signal-safe. If so, please consider documenting that it is and will remain so.
dbus-daemon uses sd_journal_stream_fd() to give new stdout, stderr streams to traditional (non-systemd) activated services when running under systemd. However, because sd_journal_stream_fd() is not documented to be async-signal-safe, we call it before forking, so the _PID in the Journal is dbus-daemon's pid. If we knew sd_journal_stream_fd() would continue to be async-signal-safe indefinitely, we could call it in the child process (or in fact the grandchild process) that is going to exec the activatable service, which would make the _PID correct.
The text was updated successfully, but these errors were encountered: