diff --git a/.gitignore b/.gitignore
index 7d7cad2..9b8c3e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,4 +50,5 @@
 /test/internal_utils
 /test/source_base
 /test/source_event
+/test/source_io
 /test/source_time
diff --git a/src/Makefile.am b/src/Makefile.am
index 130c8e5..74f01f5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,6 +27,9 @@
 nobase_include_HEADERS += sdeventplus/source/event.hpp
 libsdeventplus_la_SOURCES += sdeventplus/source/event.cpp
 
+nobase_include_HEADERS += sdeventplus/source/io.hpp
+libsdeventplus_la_SOURCES += sdeventplus/source/io.cpp
+
 nobase_include_HEADERS += sdeventplus/source/time.hpp
 libsdeventplus_la_SOURCES += sdeventplus/source/time.cpp
 
diff --git a/src/sdeventplus/internal/sdevent.cpp b/src/sdeventplus/internal/sdevent.cpp
index e7cd633..467a3c3 100644
--- a/src/sdeventplus/internal/sdevent.cpp
+++ b/src/sdeventplus/internal/sdevent.cpp
@@ -26,6 +26,14 @@
     return ::sd_event_unref(event);
 }
 
+int SdEventImpl::sd_event_add_io(sd_event* event, sd_event_source** source,
+                                 int fd, uint32_t events,
+                                 sd_event_io_handler_t callback,
+                                 void* userdata) const
+{
+    return ::sd_event_add_io(event, source, fd, events, callback, userdata);
+}
+
 int SdEventImpl::sd_event_add_time(sd_event* event, sd_event_source** source,
                                    clockid_t clock, uint64_t usec,
                                    uint64_t accuracy,
@@ -172,6 +180,46 @@
     return ::sd_event_source_set_enabled(source, enabled);
 }
 
+int SdEventImpl::sd_event_source_get_io_fd(sd_event_source* source) const
+{
+    return ::sd_event_source_get_io_fd(source);
+}
+
+int SdEventImpl::sd_event_source_set_io_fd(sd_event_source* source,
+                                           int fd) const
+{
+    return ::sd_event_source_set_io_fd(source, fd);
+}
+
+int SdEventImpl::sd_event_source_get_io_fd_own(sd_event_source* source) const
+{
+    return ::sd_event_source_get_io_fd_own(source);
+}
+
+int SdEventImpl::sd_event_source_set_io_fd_own(sd_event_source* source,
+                                               int own) const
+{
+    return ::sd_event_source_set_io_fd_own(source, own);
+}
+
+int SdEventImpl::sd_event_source_get_io_events(sd_event_source* source,
+                                               uint32_t* events) const
+{
+    return ::sd_event_source_get_io_events(source, events);
+}
+
+int SdEventImpl::sd_event_source_set_io_events(sd_event_source* source,
+                                               uint32_t events) const
+{
+    return ::sd_event_source_set_io_events(source, events);
+}
+
+int SdEventImpl::sd_event_source_get_io_revents(sd_event_source* source,
+                                                uint32_t* revents) const
+{
+    return ::sd_event_source_get_io_revents(source, revents);
+}
+
 int SdEventImpl::sd_event_source_get_time(sd_event_source* source,
                                           uint64_t* usec) const
 {
diff --git a/src/sdeventplus/internal/sdevent.hpp b/src/sdeventplus/internal/sdevent.hpp
index fb26fd2..62acbbe 100644
--- a/src/sdeventplus/internal/sdevent.hpp
+++ b/src/sdeventplus/internal/sdevent.hpp
@@ -17,6 +17,9 @@
     virtual sd_event* sd_event_ref(sd_event* event) const = 0;
     virtual sd_event* sd_event_unref(sd_event* event) const = 0;
 
+    virtual int sd_event_add_io(sd_event* event, sd_event_source** source,
+                                int fd, uint32_t events, sd_event_io_handler_t,
+                                void* userdata) const = 0;
     virtual int sd_event_add_time(sd_event* event, sd_event_source** source,
                                   clockid_t clock, uint64_t usec,
                                   uint64_t accuracy,
@@ -72,6 +75,19 @@
                                             int* enabled) const = 0;
     virtual int sd_event_source_set_enabled(sd_event_source* source,
                                             int enabled) const = 0;
+    virtual int sd_event_source_get_io_fd(sd_event_source* source) const = 0;
+    virtual int sd_event_source_set_io_fd(sd_event_source* source,
+                                          int fd) const = 0;
+    virtual int
+        sd_event_source_get_io_fd_own(sd_event_source* source) const = 0;
+    virtual int sd_event_source_set_io_fd_own(sd_event_source* source,
+                                              int own) const = 0;
+    virtual int sd_event_source_get_io_events(sd_event_source* source,
+                                              uint32_t* events) const = 0;
+    virtual int sd_event_source_set_io_events(sd_event_source* source,
+                                              uint32_t events) const = 0;
+    virtual int sd_event_source_get_io_revents(sd_event_source* source,
+                                               uint32_t* revents) const = 0;
     virtual int sd_event_source_get_time(sd_event_source* source,
                                          uint64_t* usec) const = 0;
     virtual int sd_event_source_set_time(sd_event_source* source,
@@ -90,6 +106,9 @@
     sd_event* sd_event_ref(sd_event* event) const override;
     sd_event* sd_event_unref(sd_event* event) const override;
 
+    int sd_event_add_io(sd_event* event, sd_event_source** source, int fd,
+                        uint32_t events, sd_event_io_handler_t callback,
+                        void* userdata) const override;
     int sd_event_add_time(sd_event* event, sd_event_source** source,
                           clockid_t clock, uint64_t usec, uint64_t accuracy,
                           sd_event_time_handler_t callback,
@@ -141,6 +160,18 @@
                                     int* enabled) const override;
     int sd_event_source_set_enabled(sd_event_source* source,
                                     int enabled) const override;
+    int sd_event_source_get_io_fd(sd_event_source* source) const override;
+    int sd_event_source_set_io_fd(sd_event_source* source,
+                                  int fd) const override;
+    int sd_event_source_get_io_fd_own(sd_event_source* source) const override;
+    int sd_event_source_set_io_fd_own(sd_event_source* source,
+                                      int own) const override;
+    int sd_event_source_get_io_events(sd_event_source* source,
+                                      uint32_t* events) const override;
+    int sd_event_source_set_io_events(sd_event_source* source,
+                                      uint32_t events) const override;
+    int sd_event_source_get_io_revents(sd_event_source* source,
+                                       uint32_t* revents) const override;
     int sd_event_source_get_time(sd_event_source* source,
                                  uint64_t* usec) const override;
     int sd_event_source_set_time(sd_event_source* source,
diff --git a/src/sdeventplus/source/io.cpp b/src/sdeventplus/source/io.cpp
new file mode 100644
index 0000000..2955a7d
--- /dev/null
+++ b/src/sdeventplus/source/io.cpp
@@ -0,0 +1,114 @@
+#include <sdeventplus/source/io.hpp>
+#include <type_traits>
+#include <utility>
+
+namespace sdeventplus
+{
+namespace source
+{
+
+IO::IO(const Event& event, int fd, uint32_t events, Callback&& callback) :
+    Base(event, create_source(event, fd, events), std::false_type()),
+    callback(std::move(callback))
+{
+}
+
+int IO::get_fd() const
+{
+    int r = event.getSdEvent()->sd_event_source_get_io_fd(source.get());
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_source_get_io_fd");
+    }
+    return r;
+}
+
+void IO::set_fd(int fd) const
+{
+    int r = event.getSdEvent()->sd_event_source_set_io_fd(source.get(), fd);
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_source_set_io_fd");
+    }
+}
+
+bool IO::get_fd_own() const
+{
+    int r = event.getSdEvent()->sd_event_source_get_io_fd_own(source.get());
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_source_get_io_fd_own");
+    }
+    return r;
+}
+
+void IO::set_fd_own(bool own) const
+{
+    int r =
+        event.getSdEvent()->sd_event_source_set_io_fd_own(source.get(), own);
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_source_set_io_fd_own");
+    }
+}
+
+uint32_t IO::get_events() const
+{
+    uint32_t events;
+    int r = event.getSdEvent()->sd_event_source_get_io_events(source.get(),
+                                                              &events);
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_source_get_io_events");
+    }
+    return events;
+}
+
+void IO::set_events(uint32_t events) const
+{
+    int r =
+        event.getSdEvent()->sd_event_source_set_io_events(source.get(), events);
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_source_set_io_events");
+    }
+}
+
+uint32_t IO::get_revents() const
+{
+    uint32_t revents;
+    int r = event.getSdEvent()->sd_event_source_get_io_revents(source.get(),
+                                                               &revents);
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_source_get_io_revents");
+    }
+    return revents;
+}
+
+const IO::Callback& IO::get_callback() const
+{
+    return callback;
+}
+
+sd_event_source* IO::create_source(const Event& event, int fd, uint32_t events)
+{
+    sd_event_source* source;
+    int r = event.getSdEvent()->sd_event_add_io(event.get(), &source, fd,
+                                                events, ioCallback, nullptr);
+    if (r < 0)
+    {
+        throw SdEventError(-r, "sd_event_add_io");
+    }
+    return source;
+}
+
+int IO::ioCallback(sd_event_source* source, int fd, uint32_t revents,
+                   void* userdata)
+{
+    return sourceCallback<Callback, IO, &IO::get_callback>(
+        "ioCallback", source, userdata, fd, revents);
+}
+
+} // namespace source
+} // namespace sdeventplus
diff --git a/src/sdeventplus/source/io.hpp b/src/sdeventplus/source/io.hpp
new file mode 100644
index 0000000..f8547ec
--- /dev/null
+++ b/src/sdeventplus/source/io.hpp
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <cstdint>
+#include <functional>
+#include <sdeventplus/source/base.hpp>
+#include <systemd/sd-event.h>
+
+namespace sdeventplus
+{
+namespace source
+{
+
+class IO : public Base
+{
+  public:
+    using Callback = std::function<void(IO&, int fd, uint32_t revents)>;
+
+    IO(const Event& event, int fd, uint32_t events, Callback&& callback);
+
+    int get_fd() const;
+    void set_fd(int fd) const;
+    bool get_fd_own() const;
+    void set_fd_own(bool own) const;
+    uint32_t get_events() const;
+    void set_events(uint32_t events) const;
+    uint32_t get_revents() const;
+
+  private:
+    Callback callback;
+
+    const Callback& get_callback() const;
+
+    static sd_event_source* create_source(const Event& event, int fd,
+                                          uint32_t events);
+
+    static int ioCallback(sd_event_source* source, int fd, uint32_t revents,
+                          void* userdata);
+};
+
+} // namespace source
+} // namespace sdeventplus
diff --git a/src/sdeventplus/test/sdevent.hpp b/src/sdeventplus/test/sdevent.hpp
index ce386d6..28c484d 100644
--- a/src/sdeventplus/test/sdevent.hpp
+++ b/src/sdeventplus/test/sdevent.hpp
@@ -17,6 +17,9 @@
     MOCK_CONST_METHOD1(sd_event_ref, sd_event*(sd_event*));
     MOCK_CONST_METHOD1(sd_event_unref, sd_event*(sd_event*));
 
+    MOCK_CONST_METHOD6(sd_event_add_io,
+                       int(sd_event*, sd_event_source**, int, uint32_t,
+                           sd_event_io_handler_t, void*));
     MOCK_CONST_METHOD7(sd_event_add_time,
                        int(sd_event*, sd_event_source**, clockid_t, uint64_t,
                            uint64_t, sd_event_time_handler_t, void*));
@@ -61,6 +64,17 @@
     MOCK_CONST_METHOD2(sd_event_source_get_enabled,
                        int(sd_event_source*, int*));
     MOCK_CONST_METHOD2(sd_event_source_set_enabled, int(sd_event_source*, int));
+    MOCK_CONST_METHOD1(sd_event_source_get_io_fd, int(sd_event_source*));
+    MOCK_CONST_METHOD2(sd_event_source_set_io_fd, int(sd_event_source*, int));
+    MOCK_CONST_METHOD1(sd_event_source_get_io_fd_own, int(sd_event_source*));
+    MOCK_CONST_METHOD2(sd_event_source_set_io_fd_own,
+                       int(sd_event_source*, int));
+    MOCK_CONST_METHOD2(sd_event_source_get_io_events,
+                       int(sd_event_source*, uint32_t*));
+    MOCK_CONST_METHOD2(sd_event_source_set_io_events,
+                       int(sd_event_source*, uint32_t));
+    MOCK_CONST_METHOD2(sd_event_source_get_io_revents,
+                       int(sd_event_source*, uint32_t*));
     MOCK_CONST_METHOD2(sd_event_source_get_time,
                        int(sd_event_source*, uint64_t*));
     MOCK_CONST_METHOD2(sd_event_source_set_time,
diff --git a/test/Makefile.am b/test/Makefile.am
index 49c7402..3d51b65 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -42,6 +42,11 @@
 source_event_CPPFLAGS = $(gtest_cppflags)
 source_event_LDADD = $(gtest_ldadd)
 
+check_PROGRAMS += source_io
+source_io_SOURCES = source/io.cpp
+source_io_CPPFLAGS = $(gtest_cppflags)
+source_io_LDADD = $(gtest_ldadd)
+
 check_PROGRAMS += source_time
 source_time_SOURCES = source/time.cpp
 source_time_CPPFLAGS = $(gtest_cppflags)
diff --git a/test/source/io.cpp b/test/source/io.cpp
new file mode 100644
index 0000000..e3b5921
--- /dev/null
+++ b/test/source/io.cpp
@@ -0,0 +1,258 @@
+#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/io.hpp>
+#include <sdeventplus/test/sdevent.hpp>
+#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 IOTest : 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(IOTest, ConstructSuccess)
+{
+    const int fd = 10;
+    const uint32_t events = EPOLLIN | EPOLLET;
+
+    EXPECT_CALL(mock, sd_event_ref(expected_event))
+        .WillOnce(Return(expected_event));
+    sd_event_io_handler_t handler;
+    EXPECT_CALL(mock, sd_event_add_io(expected_event, testing::_, fd, events,
+                                      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;
+    int return_fd;
+    uint32_t return_revents;
+    IO::Callback callback = [&](IO&, int fd, uint32_t revents) {
+        return_fd = fd;
+        return_revents = revents;
+        completions++;
+    };
+    IO io(*event, fd, events, std::move(callback));
+    EXPECT_FALSE(callback);
+    EXPECT_EQ(&io, userdata);
+    EXPECT_EQ(0, completions);
+
+    EXPECT_EQ(0, handler(nullptr, 5, EPOLLIN, &io));
+    EXPECT_EQ(1, completions);
+    EXPECT_EQ(5, return_fd);
+    EXPECT_EQ(EPOLLIN, return_revents);
+
+    expect_destruct();
+}
+
+TEST_F(IOTest, ConstructError)
+{
+    const int fd = 10;
+    const uint32_t events = EPOLLIN | EPOLLET;
+
+    EXPECT_CALL(mock, sd_event_add_io(expected_event, testing::_, fd, events,
+                                      testing::_, nullptr))
+        .WillOnce(Return(-EINVAL));
+    int completions = 0;
+    IO::Callback callback = [&completions](IO&, int, uint32_t) {
+        completions++;
+    };
+    EXPECT_THROW(IO(*event, fd, events, std::move(callback)), SdEventError);
+    EXPECT_TRUE(callback);
+    EXPECT_EQ(0, completions);
+}
+
+class IOMethodTest : public IOTest
+{
+  protected:
+    std::unique_ptr<IO> io;
+
+    void SetUp()
+    {
+        const int fd = 7;
+        const int events = EPOLLOUT;
+
+        EXPECT_CALL(mock, sd_event_ref(expected_event))
+            .WillOnce(Return(expected_event));
+        EXPECT_CALL(mock, sd_event_add_io(expected_event, testing::_, fd,
+                                          events, testing::_, nullptr))
+            .WillOnce(DoAll(SetArgPointee<1>(expected_source), Return(0)));
+        EXPECT_CALL(mock,
+                    sd_event_source_set_userdata(expected_source, testing::_))
+            .WillOnce(Return(nullptr));
+        io =
+            std::make_unique<IO>(*event, fd, events, [](IO&, int, uint32_t) {});
+    }
+
+    void TearDown()
+    {
+        expect_destruct();
+        io.reset();
+    }
+};
+
+TEST_F(IOMethodTest, GetFdSuccess)
+{
+    const int fd = 5;
+    EXPECT_CALL(mock, sd_event_source_get_io_fd(expected_source))
+        .WillOnce(Return(fd));
+    EXPECT_EQ(fd, io->get_fd());
+}
+
+TEST_F(IOMethodTest, GetFdError)
+{
+    EXPECT_CALL(mock, sd_event_source_get_io_fd(expected_source))
+        .WillOnce(Return(-EINVAL));
+    EXPECT_THROW(io->get_fd(), SdEventError);
+}
+
+TEST_F(IOMethodTest, SetFdSuccess)
+{
+    const int fd = 5;
+    EXPECT_CALL(mock, sd_event_source_set_io_fd(expected_source, fd))
+        .WillOnce(Return(0));
+    io->set_fd(fd);
+}
+
+TEST_F(IOMethodTest, SetFdError)
+{
+    const int fd = 3;
+    EXPECT_CALL(mock, sd_event_source_set_io_fd(expected_source, fd))
+        .WillOnce(Return(-EINVAL));
+    EXPECT_THROW(io->set_fd(fd), SdEventError);
+}
+
+TEST_F(IOMethodTest, GetFdOwnSuccess)
+{
+    EXPECT_CALL(mock, sd_event_source_get_io_fd_own(expected_source))
+        .WillOnce(Return(3));
+    EXPECT_TRUE(io->get_fd_own());
+    EXPECT_CALL(mock, sd_event_source_get_io_fd_own(expected_source))
+        .WillOnce(Return(0));
+    EXPECT_FALSE(io->get_fd_own());
+}
+
+TEST_F(IOMethodTest, GetFdOwnError)
+{
+    EXPECT_CALL(mock, sd_event_source_get_io_fd_own(expected_source))
+        .WillOnce(Return(-EINVAL));
+    EXPECT_THROW(io->get_fd_own(), SdEventError);
+}
+
+TEST_F(IOMethodTest, SetFdOwnSuccess)
+{
+    EXPECT_CALL(mock, sd_event_source_set_io_fd_own(expected_source, true))
+        .WillOnce(Return(0));
+    io->set_fd_own(true);
+}
+
+TEST_F(IOMethodTest, SetFdOwnError)
+{
+    EXPECT_CALL(mock, sd_event_source_set_io_fd_own(expected_source, false))
+        .WillOnce(Return(-EINVAL));
+    EXPECT_THROW(io->set_fd_own(false), SdEventError);
+}
+
+TEST_F(IOMethodTest, GetEventsSuccess)
+{
+    const uint32_t events = EPOLLIN | EPOLLOUT;
+    EXPECT_CALL(mock,
+                sd_event_source_get_io_events(expected_source, testing::_))
+        .WillOnce(DoAll(SetArgPointee<1>(events), Return(0)));
+    EXPECT_EQ(events, io->get_events());
+}
+
+TEST_F(IOMethodTest, GetEventsError)
+{
+    EXPECT_CALL(mock,
+                sd_event_source_get_io_events(expected_source, testing::_))
+        .WillOnce(Return(-EINVAL));
+    EXPECT_THROW(io->get_events(), SdEventError);
+}
+
+TEST_F(IOMethodTest, SetEventsSuccess)
+{
+    const uint32_t events = EPOLLIN | EPOLLOUT;
+    EXPECT_CALL(mock, sd_event_source_set_io_events(expected_source, events))
+        .WillOnce(Return(0));
+    io->set_events(events);
+}
+
+TEST_F(IOMethodTest, SetEventsError)
+{
+    const uint32_t events = EPOLLIN | EPOLLOUT;
+    EXPECT_CALL(mock, sd_event_source_set_io_events(expected_source, events))
+        .WillOnce(Return(-EINVAL));
+    EXPECT_THROW(io->set_events(events), SdEventError);
+}
+
+TEST_F(IOMethodTest, GetREventsSuccess)
+{
+    const uint32_t revents = EPOLLOUT;
+    EXPECT_CALL(mock,
+                sd_event_source_get_io_revents(expected_source, testing::_))
+        .WillOnce(DoAll(SetArgPointee<1>(revents), Return(0)));
+    EXPECT_EQ(revents, io->get_revents());
+}
+
+TEST_F(IOMethodTest, GetREventsError)
+{
+    EXPECT_CALL(mock,
+                sd_event_source_get_io_revents(expected_source, testing::_))
+        .WillOnce(Return(-EINVAL));
+    EXPECT_THROW(io->get_revents(), SdEventError);
+}
+
+} // namespace
+} // namespace source
+} // namespace sdeventplus
