Skip to content
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

Closed
smcv opened this issue Jan 17, 2018 · 2 comments
Closed

please document sd_journal_stream_fd as async-signal-safe, if it is #7912

smcv opened this issue Jan 17, 2018 · 2 comments

Comments

@smcv
Copy link
Contributor

smcv commented Jan 17, 2018

Submission type

  • Request for enhancement (RFE)

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.

@sourcejedi
Copy link
Contributor

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).

@keszybz
Copy link
Member

keszybz commented Jan 21, 2018

Oops. There's nothing wrong with #7938, but it documents the wrong function ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants