diff --git a/.gitignore b/.gitignore
index 3c5419c..e7fd756 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,7 @@
 /test/internal_sdref
 /test/internal_utils
 /test/source_base
+/test/source_child
 /test/source_event
 /test/source_io
 /test/source_signal
diff --git a/src/Makefile.am b/src/Makefile.am
index 236e347..518ac1f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,9 @@
 nobase_include_HEADERS += sdeventplus/source/base.hpp
 libsdeventplus_la_SOURCES += sdeventplus/source/base.cpp
 
+nobase_include_HEADERS += sdeventplus/source/child.hpp
+libsdeventplus_la_SOURCES += sdeventplus/source/child.cpp
+
 nobase_include_HEADERS += sdeventplus/source/event.hpp
 libsdeventplus_la_SOURCES += sdeventplus/source/event.cpp
 
diff --git a/src/sdeventplus/internal/sdevent.cpp b/src/sdeventplus/internal/sdevent.cpp
index ad5114c..b5e4542 100644
--- a/src/sdeventplus/internal/sdevent.cpp
+++ b/src/sdeventplus/internal/sdevent.cpp
@@ -249,6 +249,12 @@
     return ::sd_event_source_get_signal(source);
 }
 
+int SdEventImpl::sd_event_source_get_child_pid(sd_event_source* source,
+                                               pid_t* pid) const
+{
+    return ::sd_event_source_get_child_pid(source, pid);
+}
+
 SdEventImpl sdevent_impl;
 
 } // namespace internal
diff --git a/src/sdeventplus/internal/sdevent.hpp b/src/sdeventplus/internal/sdevent.hpp
index 42427eb..3151981 100644
--- a/src/sdeventplus/internal/sdevent.hpp
+++ b/src/sdeventplus/internal/sdevent.hpp
@@ -28,6 +28,10 @@
     virtual int sd_event_add_signal(sd_event* event, sd_event_source** source,
                                     int sig, sd_event_signal_handler_t callback,
                                     void* userdata) const = 0;
+    virtual int sd_event_add_child(sd_event* event, sd_event_source** source,
+                                   pid_t, int options,
+                                   sd_event_child_handler_t callback,
+                                   void* userdata) const = 0;
     virtual int sd_event_add_defer(sd_event* event, sd_event_source** source,
                                    sd_event_handler_t callback,
                                    void* userdata) const = 0;
@@ -100,6 +104,8 @@
     virtual int sd_event_source_set_time_accuracy(sd_event_source* source,
                                                   uint64_t usec) const = 0;
     virtual int sd_event_source_get_signal(sd_event_source*) const = 0;
+    virtual int sd_event_source_get_child_pid(sd_event_source*,
+                                              pid_t* pid) const = 0;
 };
 
 class SdEventImpl : public SdEvent
@@ -125,6 +131,14 @@
         return ::sd_event_add_signal(event, source, sig, callback, userdata);
     }
 
+    int sd_event_add_child(sd_event* event, sd_event_source** source, pid_t pid,
+                           int options, sd_event_child_handler_t callback,
+                           void* userdata) const override
+    {
+        return ::sd_event_add_child(event, source, pid, options, callback,
+                                    userdata);
+    }
+
     int sd_event_add_defer(sd_event* event, sd_event_source** source,
                            sd_event_handler_t callback,
                            void* userdata) const override;
@@ -193,6 +207,8 @@
     int sd_event_source_set_time_accuracy(sd_event_source* source,
                                           uint64_t usec) const override;
     int sd_event_source_get_signal(sd_event_source*) const override;
+    int sd_event_source_get_child_pid(sd_event_source*,
+                                      pid_t* pid) const override;
 };
 
 extern SdEventImpl sdevent_impl;
diff --git a/src/sdeventplus/source/child.cpp b/src/sdeventplus/source/child.cpp
new file mode 100644
index 0000000..cda067b
--- /dev/null
+++ b/src/sdeventplus/source/child.cpp
@@ -0,0 +1,55 @@
+#include <sdeventplus/exception.hpp>
+#include <sdeventplus/source/child.hpp>
+#include <type_traits>
+#include <utility>
+
+namespace sdeventplus
+{
+namespace source
+{
+
+Child::Child(const Event& event, pid_t pid, int options, Callback&& callback) :
+    Base(event, create_source(event, pid, options), std::false_type()),
+    callback(std::move(callback))
+{
+}
+
+pid_t Child::get_pid() const
+{
+    pid_t pid;
+    int r =
+        event.getSdEvent()->sd_event_source_get_child_pid(source.get(), &pid);
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_source_get_child_pid");
+    }
+    return pid;
+}
+
+const Child::Callback& Child::get_callback() const
+{
+    return callback;
+}
+
+sd_event_source* Child::create_source(const Event& event, pid_t pid,
+                                      int options)
+{
+    sd_event_source* source;
+    int r = event.getSdEvent()->sd_event_add_child(
+        event.get(), &source, pid, options, childCallback, nullptr);
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_add_child");
+    }
+    return source;
+}
+
+int Child::childCallback(sd_event_source* source, const siginfo_t* si,
+                         void* userdata)
+{
+    return sourceCallback<Callback, Child, &Child::get_callback>(
+        "childCallback", source, userdata, si);
+}
+
+} // namespace source
+} // namespace sdeventplus
diff --git a/src/sdeventplus/source/child.hpp b/src/sdeventplus/source/child.hpp
new file mode 100644
index 0000000..5af359a
--- /dev/null
+++ b/src/sdeventplus/source/child.hpp
@@ -0,0 +1,34 @@
+#pragma once
+
+#include <functional>
+#include <sdeventplus/source/base.hpp>
+#include <signal.h>
+
+namespace sdeventplus
+{
+namespace source
+{
+
+class Child : public Base
+{
+  public:
+    using Callback = std::function<void(Child& source, const siginfo_t* si)>;
+
+    Child(const Event& event, pid_t pid, int options, Callback&& callback);
+
+    pid_t get_pid() const;
+
+  private:
+    Callback callback;
+
+    const Callback& get_callback() const;
+
+    static sd_event_source* create_source(const Event& event, pid_t pid,
+                                          int options);
+
+    static int childCallback(sd_event_source* source, const siginfo_t* si,
+                             void* userdata);
+};
+
+} // namespace source
+} // namespace sdeventplus
diff --git a/src/sdeventplus/test/sdevent.hpp b/src/sdeventplus/test/sdevent.hpp
index 37b4464..1d87174 100644
--- a/src/sdeventplus/test/sdevent.hpp
+++ b/src/sdeventplus/test/sdevent.hpp
@@ -26,6 +26,9 @@
     MOCK_CONST_METHOD5(sd_event_add_signal,
                        int(sd_event*, sd_event_source**, int,
                            sd_event_signal_handler_t, void*));
+    MOCK_CONST_METHOD6(sd_event_add_child,
+                       int(sd_event*, sd_event_source**, pid_t, int,
+                           sd_event_child_handler_t, void*));
     MOCK_CONST_METHOD4(sd_event_add_defer, int(sd_event*, sd_event_source**,
                                                sd_event_handler_t, void*));
     MOCK_CONST_METHOD4(sd_event_add_post, int(sd_event*, sd_event_source**,
@@ -87,6 +90,8 @@
     MOCK_CONST_METHOD2(sd_event_source_set_time_accuracy,
                        int(sd_event_source*, uint64_t));
     MOCK_CONST_METHOD1(sd_event_source_get_signal, int(sd_event_source*));
+    MOCK_CONST_METHOD2(sd_event_source_get_child_pid,
+                       int(sd_event_source*, pid_t*));
 };
 
 } // namespace test
diff --git a/test/Makefile.am b/test/Makefile.am
index 5a6c1bb..6a5fd9e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -37,6 +37,11 @@
 source_base_CPPFLAGS = $(gtest_cppflags)
 source_base_LDADD = $(gtest_ldadd)
 
+check_PROGRAMS += source_child
+source_child_SOURCES = source/child.cpp
+source_child_CPPFLAGS = $(gtest_cppflags)
+source_child_LDADD = $(gtest_ldadd)
+
 check_PROGRAMS += source_event
 source_event_SOURCES = source/event.cpp
 source_event_CPPFLAGS = $(gtest_cppflags)
diff --git a/test/source/child.cpp b/test/source/child.cpp
new file mode 100644
index 0000000..e1e1322
--- /dev/null
+++ b/test/source/child.cpp
@@ -0,0 +1,163 @@
+#include <cerrno>
+#include <functional>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <memory>
+#include <sdeventplus/event.hpp>
+#include <sdeventplus/exception.hpp>
+#include <sdeventplus/source/child.hpp>
+#include <sdeventplus/test/sdevent.hpp>
+#include <sys/wait.h>
+#include <systemd/sd-event.h>
+#include <type_traits>
+#include <utility>
+
+namespace sdeventplus
+{
+namespace source
+{
+namespace
+{
+
+using testing::DoAll;
+using testing::Return;
+using testing::SaveArg;
+using testing::SetArgPointee;
+
+using UniqueEvent = std::unique_ptr<Event, std::function<void(Event*)>>;
+
+class ChildTest : public testing::Test
+{
+  protected:
+    testing::StrictMock<test::SdEventMock> mock;
+    sd_event_source* const expected_source =
+        reinterpret_cast<sd_event_source*>(1234);
+    sd_event* const expected_event = reinterpret_cast<sd_event*>(2345);
+    UniqueEvent event = make_event(expected_event);
+
+    UniqueEvent make_event(sd_event* event)
+    {
+        auto deleter = [this, event](Event* e) {
+            EXPECT_CALL(this->mock, sd_event_unref(event))
+                .WillOnce(Return(nullptr));
+            delete e;
+        };
+        return UniqueEvent(new Event(event, std::false_type(), &mock), deleter);
+    }
+
+    void expect_destruct()
+    {
+        {
+            testing::InSequence sequence;
+            EXPECT_CALL(mock, sd_event_source_set_enabled(expected_source,
+                                                          SD_EVENT_OFF))
+                .WillOnce(Return(0));
+            EXPECT_CALL(mock, sd_event_source_unref(expected_source))
+                .WillOnce(Return(nullptr));
+        }
+        EXPECT_CALL(mock, sd_event_unref(expected_event))
+            .WillOnce(Return(nullptr));
+    }
+};
+
+TEST_F(ChildTest, ConstructSuccess)
+{
+    const pid_t pid = 50;
+    const int options = WEXITED;
+
+    EXPECT_CALL(mock, sd_event_ref(expected_event))
+        .WillOnce(Return(expected_event));
+    sd_event_child_handler_t handler;
+    EXPECT_CALL(mock, sd_event_add_child(expected_event, testing::_, pid,
+                                         options, testing::_, nullptr))
+        .WillOnce(DoAll(SetArgPointee<1>(expected_source), SaveArg<4>(&handler),
+                        Return(0)));
+    void* userdata;
+    EXPECT_CALL(mock, sd_event_source_set_userdata(expected_source, testing::_))
+        .WillOnce(DoAll(SaveArg<1>(&userdata), Return(nullptr)));
+    int completions = 0;
+    const siginfo_t* return_si;
+    Child::Callback callback = [&](Child&, const siginfo_t* si) {
+        return_si = si;
+        completions++;
+    };
+    Child child(*event, pid, options, std::move(callback));
+    EXPECT_FALSE(callback);
+    EXPECT_EQ(&child, userdata);
+    EXPECT_EQ(0, completions);
+
+    const siginfo_t* expected_si = reinterpret_cast<siginfo_t*>(865);
+    EXPECT_EQ(0, handler(nullptr, expected_si, &child));
+    EXPECT_EQ(1, completions);
+    EXPECT_EQ(expected_si, return_si);
+
+    expect_destruct();
+}
+
+TEST_F(ChildTest, ConstructError)
+{
+    const pid_t pid = 50;
+    const int options = WEXITED;
+
+    EXPECT_CALL(mock, sd_event_add_child(expected_event, testing::_, pid,
+                                         options, testing::_, nullptr))
+        .WillOnce(Return(-EINVAL));
+    int completions = 0;
+    Child::Callback callback = [&completions](Child&, const siginfo_t*) {
+        completions++;
+    };
+    EXPECT_THROW(Child(*event, pid, options, std::move(callback)),
+                 SdEventError);
+    EXPECT_TRUE(callback);
+    EXPECT_EQ(0, completions);
+}
+
+class ChildMethodTest : public ChildTest
+{
+  protected:
+    std::unique_ptr<Child> child;
+
+    void SetUp()
+    {
+        const pid_t pid = 50;
+        const int options = WEXITED;
+
+        EXPECT_CALL(mock, sd_event_ref(expected_event))
+            .WillOnce(Return(expected_event));
+        EXPECT_CALL(mock, sd_event_add_child(expected_event, testing::_, pid,
+                                             options, testing::_, nullptr))
+            .WillOnce(DoAll(SetArgPointee<1>(expected_source), Return(0)));
+        EXPECT_CALL(mock,
+                    sd_event_source_set_userdata(expected_source, testing::_))
+            .WillOnce(Return(nullptr));
+        child = std::make_unique<Child>(*event, pid, options,
+                                        [](Child&, const siginfo_t*) {});
+    }
+
+    void TearDown()
+    {
+        expect_destruct();
+        child.reset();
+    }
+};
+
+TEST_F(ChildMethodTest, GetPidSuccess)
+{
+    const pid_t pid = 32;
+    EXPECT_CALL(mock,
+                sd_event_source_get_child_pid(expected_source, testing::_))
+        .WillOnce(DoAll(SetArgPointee<1>(pid), Return(0)));
+    EXPECT_EQ(pid, child->get_pid());
+}
+
+TEST_F(ChildMethodTest, GetPidError)
+{
+    EXPECT_CALL(mock,
+                sd_event_source_get_child_pid(expected_source, testing::_))
+        .WillOnce(Return(-EINVAL));
+    EXPECT_THROW(child->get_pid(), SdEventError);
+}
+
+} // namespace
+} // namespace source
+} // namespace sdeventplus
