source/io: Temporarily remove {get,set}_fd_own
These functions were implemented only in newer systemd 237+. We often
deal with older verisons so lets add them back after some time passes.
We could also make them an optional autodetected feature to work around
the issue.
diff --git a/src/sdeventplus/internal/sdevent.cpp b/src/sdeventplus/internal/sdevent.cpp
index b5e4542..6d8cde9 100644
--- a/src/sdeventplus/internal/sdevent.cpp
+++ b/src/sdeventplus/internal/sdevent.cpp
@@ -191,17 +191,6 @@
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
{
diff --git a/src/sdeventplus/internal/sdevent.hpp b/src/sdeventplus/internal/sdevent.hpp
index 3151981..80a321c 100644
--- a/src/sdeventplus/internal/sdevent.hpp
+++ b/src/sdeventplus/internal/sdevent.hpp
@@ -85,10 +85,6 @@
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,
@@ -189,9 +185,6 @@
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,
diff --git a/src/sdeventplus/source/io.cpp b/src/sdeventplus/source/io.cpp
index 2955a7d..a325f91 100644
--- a/src/sdeventplus/source/io.cpp
+++ b/src/sdeventplus/source/io.cpp
@@ -32,26 +32,6 @@
}
}
-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;
diff --git a/src/sdeventplus/source/io.hpp b/src/sdeventplus/source/io.hpp
index f8547ec..030f75e 100644
--- a/src/sdeventplus/source/io.hpp
+++ b/src/sdeventplus/source/io.hpp
@@ -19,8 +19,6 @@
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;
diff --git a/src/sdeventplus/test/sdevent.hpp b/src/sdeventplus/test/sdevent.hpp
index 1d87174..5079a99 100644
--- a/src/sdeventplus/test/sdevent.hpp
+++ b/src/sdeventplus/test/sdevent.hpp
@@ -72,9 +72,6 @@
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,
diff --git a/test/source/io.cpp b/test/source/io.cpp
index e3b5921..b680be7 100644
--- a/test/source/io.cpp
+++ b/test/source/io.cpp
@@ -172,37 +172,6 @@
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;