[PATCH v22 19/24] eal/windows: add wrapper for access function

Stephen Hemminger
2026-04-14T16:12:23Z

Like other Posix functions in unistd.h add wrapper
using the Windows equivalent.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/eal/windows/include/rte_os_shim.h | 1 +
lib/eal/windows/include/unistd.h | 7 +++++++
2 files changed, 8 insertions(+)

diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h
index f16b2230c8..44664a5062 100644
--- a/lib/eal/windows/include/rte_os_shim.h
+++ b/lib/eal/windows/include/rte_os_shim.h
@@ -33,6 +33,7 @@
#define unlink(path) _unlink(path)
#define fileno(f) _fileno(f)
#define isatty(fd) _isatty(fd)
+#define access(path, mode) _access(path, mode)

#define IPVERSION 4

diff --git a/lib/eal/windows/include/unistd.h b/lib/eal/windows/include/unistd.h
index 78150c6480..f95888f4e1 100644
--- a/lib/eal/windows/include/unistd.h
+++ b/lib/eal/windows/include/unistd.h
@@ -23,4 +23,11 @@
#define STDERR_FILENO _fileno(stderr)
#endif

+/* Mode values for the _access() function. */
+#ifndef F_OK
+#define F_OK 0 /* test for existence of file */
+#define W_OK 0x02 /* test for write permission */
+#define R_OK 0x04 /* test for read permission */
+#endif
+
#endif /* _UNISTD_H_ */
--
2.53.0