aboutsummaryrefslogtreecommitdiffstats
path: root/libsimple.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-01-27 19:05:28 +0100
committerMattias Andrée <maandree@kth.se>2024-01-27 19:05:28 +0100
commitd055dfe7bbdbcbc7fbd521168b4dc728e004dcd1 (patch)
treeda559a50512c1b3446a1a91d0702b7713ecca97b /libsimple.h
parentFix man pages (diff)
downloadlibsimple-d055dfe7bbdbcbc7fbd521168b4dc728e004dcd1.tar.gz
libsimple-d055dfe7bbdbcbc7fbd521168b4dc728e004dcd1.tar.bz2
libsimple-d055dfe7bbdbcbc7fbd521168b4dc728e004dcd1.tar.xz
Add libsimple_close_range
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libsimple.h')
-rw-r--r--libsimple.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libsimple.h b/libsimple.h
index f4238cb..9cc0f8f 100644
--- a/libsimple.h
+++ b/libsimple.h
@@ -191,6 +191,20 @@ libsimple_close(int *fdp__)
/**
+ * Close a range of file descriptors
+ *
+ * @param first The lowest file descriptor to close
+ * @param last The highest file descriptor to close
+ * @param next Output parameter for the potentially first unclosed file descriptor; may be `NULL`
+ * @return 0 on successful completion, -1 on failure
+ * @throws EINVAL If `first > last`
+ * @throws Any error for close(3) except EBADF
+ */
+int libsimple_close_range(unsigned int first, unsigned int last, unsigned int *next);
+#define LIBSIMPLE_CLOSE_RANGE_MAX (~0U)
+
+
+/**
* Remove an item from a list, keeping the list ordered
*
* `list` must be non-void pointer to a complete type,