From 8fbfb0b973b1ff8307f7c29e6e8facb7e0f72ea0 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 17 May 2024 17:58:27 -0400 Subject: dir: Add support for posix_getdents() This will be added to the next POSIX standard, and is already implemented in musl. Link: https://www.austingroupbugs.net/view.php?id=697 Link: https://git.musl-libc.org/cgit/musl/commit/?id=1b0d48517f816e98f19111df82f32bfc1608ecec --- build/has/attribute-format-syslog.c | 13 +++++++++++++ build/has/posix-getdents.c | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 build/has/attribute-format-syslog.c create mode 100644 build/has/posix-getdents.c (limited to 'build/has') diff --git a/build/has/attribute-format-syslog.c b/build/has/attribute-format-syslog.c new file mode 100644 index 0000000..ce988e5 --- /dev/null +++ b/build/has/attribute-format-syslog.c @@ -0,0 +1,13 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include + +__attribute__((format(syslog, 1, 2))) +static int foo(const char *format, ...) { + return 0; +} + +int main(void) { + return foo("%s: %m\n", "main()"); +} diff --git a/build/has/posix-getdents.c b/build/has/posix-getdents.c new file mode 100644 index 0000000..f74bbe5 --- /dev/null +++ b/build/has/posix-getdents.c @@ -0,0 +1,9 @@ +// Copyright © Tavian Barnes +// SPDX-License-Identifier: 0BSD + +#include + +int main(void) { + char buf[1024]; + return posix_getdents(3, (void *)buf, sizeof(buf), 0); +} -- cgit v1.2.3