From 4632adf403611b50be2b4e852a4607070935d0e5 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 4 Oct 2017 18:03:54 +0200 Subject: core: Allow disabling the use of SYS_getdents for Linux. * configure.ac (USE_LINUX_GETDENTS): New ac_define. Add option --disable-linux-getdents. * src/posix-io.c: Make use of USE_LINUX_GETDENTS. Signed-off-by: Werner Koch --- src/posix-io.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/posix-io.c') diff --git a/src/posix-io.c b/src/posix-io.c index 42677138..9b7b181d 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -47,11 +47,11 @@ #include #include -#if __linux__ +#ifdef USE_LINUX_GETDENTS # include # include # include -#endif /*__linux__ */ +#endif /*USE_LINUX_GETDENTS*/ #include "util.h" @@ -60,6 +60,7 @@ #include "ath.h" #include "debug.h" + void _gpgme_io_subsystem_init (void) @@ -280,7 +281,7 @@ _gpgme_io_set_nonblocking (int fd) } -#ifdef __linux__ +#ifdef USE_LINUX_GETDENTS /* This is not declared in public headers; getdents(2) says that we must * define it ourselves. */ struct linux_dirent @@ -292,7 +293,8 @@ struct linux_dirent }; # define DIR_BUF_SIZE 1024 -#endif /* __linux__ */ +#endif /*USE_LINUX_GETDENTS*/ + static long int get_max_fds (void) @@ -310,7 +312,7 @@ get_max_fds (void) * fork and exec in a multi-threaded process because opendir uses * malloc and thus a mutex which may deadlock with a malloc in another * thread. However, the underlying getdents system call is safe. */ -#ifdef __linux__ +#ifdef USE_LINUX_GETDENTS { int dir_fd; char dir_buf[DIR_BUF_SIZE]; @@ -356,7 +358,7 @@ get_max_fds (void) source = "/proc"; } } -#endif /* __linux__ */ +#endif /*USE_LINUX_GETDENTS*/ #ifdef RLIMIT_NOFILE if (fds == -1) -- cgit v1.2.3