sdevent: Support floating sources

This will be used by our source/base to support floating references.

Change-Id: I711d75b3552fe7f96f4c42e346741862999f1ee2
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/meson.build b/src/meson.build
index c41f6bf..fb47688 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -20,7 +20,7 @@
 endif
 
 sdeventplus_deps = [
-  dependency('libsystemd', version: '>=239'),
+  dependency('libsystemd', version: '>=240'),
   dependency('stdplus', fallback: ['stdplus', 'stdplus']),
   function2_dep,
 ]
diff --git a/src/sdeventplus/internal/sdevent.cpp b/src/sdeventplus/internal/sdevent.cpp
index 26b2f80..608dbcf 100644
--- a/src/sdeventplus/internal/sdevent.cpp
+++ b/src/sdeventplus/internal/sdevent.cpp
@@ -261,6 +261,17 @@
     return ::sd_event_source_get_destroy_callback(source, callback);
 }
 
+int SdEventImpl::sd_event_source_set_floating(sd_event_source* source,
+                                              int b) const
+{
+    return ::sd_event_source_set_floating(source, b);
+}
+
+int SdEventImpl::sd_event_source_get_floating(sd_event_source* source) const
+{
+    return ::sd_event_source_get_floating(source);
+}
+
 SdEventImpl sdevent_impl;
 
 } // namespace internal
diff --git a/src/sdeventplus/internal/sdevent.hpp b/src/sdeventplus/internal/sdevent.hpp
index 46486f7..ceab0fe 100644
--- a/src/sdeventplus/internal/sdevent.hpp
+++ b/src/sdeventplus/internal/sdevent.hpp
@@ -111,6 +111,9 @@
         sd_event_source* source, sd_event_destroy_t callback) const = 0;
     virtual int sd_event_source_get_destroy_callback(
         sd_event_source* source, sd_event_destroy_t* callback) const = 0;
+    virtual int sd_event_source_set_floating(sd_event_source* source,
+                                             int b) const = 0;
+    virtual int sd_event_source_get_floating(sd_event_source* source) const = 0;
 };
 
 /** @class SdEventImpl
@@ -220,6 +223,9 @@
         sd_event_source* source, sd_event_destroy_t callback) const override;
     int sd_event_source_get_destroy_callback(
         sd_event_source* source, sd_event_destroy_t* callback) const override;
+    int sd_event_source_set_floating(sd_event_source* source,
+                                     int b) const override;
+    int sd_event_source_get_floating(sd_event_source* source) const override;
 };
 
 /** @brief Default instantiation of sd_event
diff --git a/src/sdeventplus/test/sdevent.hpp b/src/sdeventplus/test/sdevent.hpp
index 818c85d..13411e8 100644
--- a/src/sdeventplus/test/sdevent.hpp
+++ b/src/sdeventplus/test/sdevent.hpp
@@ -98,6 +98,9 @@
                        int(sd_event_source*, sd_event_destroy_t));
     MOCK_CONST_METHOD2(sd_event_source_get_destroy_callback,
                        int(sd_event_source*, sd_event_destroy_t*));
+    MOCK_CONST_METHOD2(sd_event_source_set_floating,
+                       int(sd_event_source*, int));
+    MOCK_CONST_METHOD1(sd_event_source_get_floating, int(sd_event_source*));
 };
 
 } // namespace test