[systemd-devel] [PATCH 0/3] Cross fork() synchronization via Barrier API
David Herrmann
dh.herrmann at gmail.com
Sun Jul 13 03:37:05 PDT 2014
Hi
While working on a PTY helper I needed a synchronized fork() where parent and
child can both perform their setup before either proceeds.
src/shared/eventfd-util.c already provides a coarse API for that, but lacks many
features like implicit exit() handling. Therefore, I went ahead and wrote
barrier.[ch] based on eventfd-util.
Patch #1 adds the Barrier API with extensive tests, #2 converts nspawn to use
it and #3 adds a PTY helper as another example.
As I'm one of these old guys (cough) who never used containers, testing is
welcome! But I'll try to setup nspawn as soon as possible.
Code is also available at fdo in my @ui branch:
http://cgit.freedesktop.org/~dvdhrm/systemd/log/?h=ui
Comments welcome!
David
David Herrmann (3):
shared: add generic IPC barrier
nspawn: use Barrier API instead of eventfd-util
shared: add PTY helper
.gitignore | 2 +
Makefile.am | 20 +-
src/nspawn/nspawn.c | 136 +++++-------
src/shared/barrier.c | 442 +++++++++++++++++++++++++++++++++++++
src/shared/barrier.h | 97 +++++++++
src/shared/eventfd-util.c | 169 ---------------
src/shared/eventfd-util.h | 43 ----
src/shared/pty.c | 542 ++++++++++++++++++++++++++++++++++++++++++++++
src/shared/pty.h | 61 ++++++
src/test/test-barrier.c | 460 +++++++++++++++++++++++++++++++++++++++
src/test/test-pty.c | 143 ++++++++++++
11 files changed, 1825 insertions(+), 290 deletions(-)
create mode 100644 src/shared/barrier.c
create mode 100644 src/shared/barrier.h
delete mode 100644 src/shared/eventfd-util.c
delete mode 100644 src/shared/eventfd-util.h
create mode 100644 src/shared/pty.c
create mode 100644 src/shared/pty.h
create mode 100644 src/test/test-barrier.c
create mode 100644 src/test/test-pty.c
--
2.0.1
More information about the systemd-devel
mailing list