glibc 2.34 adds a close_range() function call. This one is straight forward
as it allows ENOSYS to be returned and the caller has to handle it so
lets do that.

Signed-off-by: Richard Purdie <[email protected]>
---
 ports/linux/guts/close_range.c | 20 ++++++++++++++++++++
 ports/linux/wrapfuncs.in       |  1 +
 2 files changed, 21 insertions(+)
 create mode 100644 ports/linux/guts/close_range.c

diff --git a/ports/linux/guts/close_range.c b/ports/linux/guts/close_range.c
new file mode 100644
index 0000000..4bd2fe1
--- /dev/null
+++ b/ports/linux/guts/close_range.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2021 Richard Purdie
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ * int close_range(unsigned int lowfd, unsigned int maxfd, int flags)
+ *      int rc = -1;
+ */
+
+        (void) lowfd;
+        (void) maxfd;
+        (void) flags;
+        /* for now pretend the kernel doesn't support it regardless 
+           which users are supposed to be able to handle */
+        errno = ENOSYS;
+        rc = -1;
+
+/*      return rc;
+ * }
+ */
diff --git a/ports/linux/wrapfuncs.in b/ports/linux/wrapfuncs.in
index 3824fd8..e978367 100644
--- a/ports/linux/wrapfuncs.in
+++ b/ports/linux/wrapfuncs.in
@@ -61,3 +61,4 @@ int capset(cap_user_header_t hdrp, const cap_user_data_t 
datap); /* real_func=ps
 long syscall(long nr, ...); /* hand_wrapped=1 */
 int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char 
*newpath, unsigned int flags); /* flags=AT_SYMLINK_NOFOLLOW */
 int prctl(int option, ...); /* hand_wrapped=1 */
+int close_range(unsigned int lowfd, unsigned int maxfd, int flags);
-- 
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#155858): 
https://lists.openembedded.org/g/openembedded-core/message/155858
Mute This Topic: https://lists.openembedded.org/mt/85487318/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to