aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLexi Winter <lexi@hemlock.eden.le-fay.org>2025-03-29 01:08:16 +0000
committerLexi Winter <lexi@hemlock.eden.le-fay.org>2025-03-29 01:08:16 +0000
commit54b85919051bb6508b53ce98116608196573cfe7 (patch)
tree0758ef549a1c03abdbb358c261e9b304fc0a3409
parent7ff3e9ee6a6ebd7010af8cca7e8c3decd92fc6fb (diff)
downloadlibnvxx-54b85919051bb6508b53ce98116608196573cfe7.tar.gz
libnvxx-54b85919051bb6508b53ce98116608196573cfe7.tar.bz2
move_descriptor should use nv_fd
-rw-r--r--libnvxx/nv_list.cc6
-rw-r--r--libnvxx/nvxx.32
-rw-r--r--libnvxx/nvxx_base.h2
-rw-r--r--libnvxx/tests/nvxx_iterator.cc2
4 files changed, 7 insertions, 5 deletions
diff --git a/libnvxx/nv_list.cc b/libnvxx/nv_list.cc
index 780c9de..72fc937 100644
--- a/libnvxx/nv_list.cc
+++ b/libnvxx/nv_list.cc
@@ -735,11 +735,13 @@ __nv_list::add_descriptor(std::string_view key, int value)
}
void
-__nv_list::move_descriptor(std::string_view key, int value)
+__nv_list::move_descriptor(std::string_view key, nv_fd &&fd)
{
__throw_if_error();
- ::nvlist_move_descriptor(__m_nv, std::string(key).c_str(), value);
+ ::nvlist_move_descriptor(__m_nv,
+ std::string(key).c_str(),
+ std::move(fd).release());
}
void
diff --git a/libnvxx/nvxx.3 b/libnvxx/nvxx.3
index b252768..73e880f 100644
--- a/libnvxx/nvxx.3
+++ b/libnvxx/nvxx.3
@@ -144,7 +144,7 @@ struct nv_list : <unspecified> {
void add_binary_range(std::string_view key, std::ranges::range auto &&);
void move_string(std::string_view key, char *);
- void move_descriptor(std::string_view key, int);
+ void move_descriptor(std::string_view key, nv_fd &&);
void move_binary(std::string_view key, std::span<std::byte>);
void move_nvlist(std::string_view key, nv_list &&);
void move_nvlist(std::string_view key, ::nvlist_t *);
diff --git a/libnvxx/nvxx_base.h b/libnvxx/nvxx_base.h
index 126f944..0817f0a 100644
--- a/libnvxx/nvxx_base.h
+++ b/libnvxx/nvxx_base.h
@@ -268,7 +268,7 @@ struct __nv_list : virtual __nv_list_base {
void move_string(std::string_view, char *);
void move_nvlist(std::string_view, nv_list &&);
void move_nvlist(std::string_view, ::nvlist_t *);
- void move_descriptor(std::string_view, int);
+ void move_descriptor(std::string_view, nv_fd &&);
void move_binary(std::string_view, std::span<std::byte>);
void move_bool_array(std::string_view, std::span<bool>);
diff --git a/libnvxx/tests/nvxx_iterator.cc b/libnvxx/tests/nvxx_iterator.cc
index 07e9aa6..12511e9 100644
--- a/libnvxx/tests/nvxx_iterator.cc
+++ b/libnvxx/tests/nvxx_iterator.cc
@@ -52,7 +52,7 @@ TEST_CASE(nvxx_basic_iterate)
nvl.add_string_range("a string array", string_array);
auto fdesc = fds[0];
- nvl.move_descriptor("an fd", fdesc);
+ nvl.move_descriptor("an fd", bsd::nv_fd(fdesc));
nvl.add_descriptor_range("a descriptor array", fds2);