diff options
| author | Lexi Winter <lexi@hemlock.eden.le-fay.org> | 2025-03-26 14:26:31 +0000 |
|---|---|---|
| committer | Lexi Winter <lexi@hemlock.eden.le-fay.org> | 2025-03-26 14:26:31 +0000 |
| commit | 131d475e05c3e31681873d73c6a9fdb40a4e008b (patch) | |
| tree | 4607808bb078ce722746cf3612c24b238fbda7aa | |
| parent | cd42c5db90295d28a5842baeb8cd47095d75f2fe (diff) | |
| download | libnvxx-131d475e05c3e31681873d73c6a9fdb40a4e008b.tar.gz libnvxx-131d475e05c3e31681873d73c6a9fdb40a4e008b.tar.bz2 | |
nvxx.3: document some misc functions
| -rw-r--r-- | libnvxx/const_nv_list.cc | 2 | ||||
| -rw-r--r-- | libnvxx/nvxx.3 | 69 |
2 files changed, 71 insertions, 0 deletions
diff --git a/libnvxx/const_nv_list.cc b/libnvxx/const_nv_list.cc index 19d139e..8a3bab5 100644 --- a/libnvxx/const_nv_list.cc +++ b/libnvxx/const_nv_list.cc @@ -116,6 +116,8 @@ __const_nv_list::operator bool() const noexcept void __const_nv_list::send(int fd) const { + __throw_if_error(); + if (::nvlist_send(fd, __m_nv) == 0) return; diff --git a/libnvxx/nvxx.3 b/libnvxx/nvxx.3 index 9f8e3b3..b1c0223 100644 --- a/libnvxx/nvxx.3 +++ b/libnvxx/nvxx.3 @@ -309,6 +309,75 @@ Thrown when an attempt is made to add a key to an nvlist when a key of the same name is already present, and the list does permit duplicates. .El .Sh CONST_NV_LIST OPERATIONS +The +.Fn dump +and +.Fn fdump +member functions write the contents of the nvlist to the provided file +descriptor or file pointer in a human-readable format. +These functions are intended for debugging; the output format should not be +considered stable. +.Pp +The +.Fn error +member function returns the current error code of the nvlist. +If the nvlist is not in an error state, a default-initialized +.Fn std::error_code +is returned. +.Pp +The +.Fn "operator bool" +member function returns +.Dv false +if the nvlist is in an error state, otherwise +.Dv true . +.Pp +The +.Fn empty +member function returns +.Dv true +if the nvlist is empty, i.e. it contains no values. +.Pp +The +.Fn flags +member function returns the flags that were used to create this nvlist. +Refer to +.Xr nvlist_create 9 +for documentation on the flags that may be set here. +.Pp +.Fn +The +.Fn pack +member function serializes the nvlist to a byte stream and returns it. +The byte stream can later be passed to +.Fn nv_list::unpack +to turn it back into an nvlist. +.Pp +The +.Fn packed_size +member function returns the number of bytes that would be generated by +.Fn pack . +.Pp +The +.Fn send +function packs the contents of the nvlist as if by +.Fn pack , +and sends the resulting byte stream over the given file descriptor. +If the nvlist is in the error state, an exception of type +.Vt nv_error_state +is thrown. +If an operating system error occurs while writing to the file descriptor, +an exception of type +.Vt std::system_error +is thrown. +.Pp +The +.Fn exists +member function returns +.Dv true +if a key by the given name exists, otherwise +.Dv false . +.Pp The .Fn exists_null , .Fn exists_bool , |
