summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2017-05-04 11:15:55 +0200
committerUlf Hermann <ulf.hermann@qt.io>2017-05-04 12:14:59 +0000
commit04c4853ab9cedc5d14bf7f08936ee4e26878f395 (patch)
tree91707c57e8595d6f9c734fdf7c765d61099c4ba6
parentbc44466ccd2045eea2352f0569399fb0515b46ba (diff)
Define unlocked io functions to locked ones if they are unavailable
The locked IO functions will still do the job, albeit a bit slower. Change-Id: I65c2b6aaa00374302aff3bcf4852a252e1eefd17 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac4
-rw-r--r--lib/ChangeLog5
-rw-r--r--lib/eu-config.h28
4 files changed, 41 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d43eeb65..29013e85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-05-04 Ulf Hermann <ulf.hermann@qt.io>
+
+ * configure.ac: Check for unlocked I/O functions.
+
2017-04-28 Ulf Hermann <ulf.hermann@qt.io>
* configure.ac: Determine the binary format we're building natively.
diff --git a/configure.ac b/configure.ac
index f04a6c81..0432bb19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -590,6 +590,10 @@ AM_CONDITIONAL(HAVE_FEATURES_H, [test "x$ac_cv_header_features_h" = "xyes"])
AC_CHECK_HEADERS(stdio_ext.h)
AM_CONDITIONAL(HAVE_STDIO_EXT_H, [test "x$ac_cv_header_stdio_ext_h" = "xyes"])
+AC_CHECK_DECLS([feof_unlocked, ferror_unlocked, fputc_unlocked, fputs_unlocked,
+ fwrite_unlocked, putc_unlocked, putchar_unlocked],
+ [], [], [[#include <stdio.h>]])
+
dnl Check if we have <linux/bpf.h> for EM_BPF disassembly.
AC_CHECK_HEADERS(linux/bpf.h)
AM_CONDITIONAL(HAVE_LINUX_BPF_H, [test "x$ac_cv_header_linux_bpf_h" = "xyes"])
diff --git a/lib/ChangeLog b/lib/ChangeLog
index ecc61795..321513ca 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,8 @@
+2017-05-04 Ulf Hermann <ulf.hermann@qt.io>
+
+ * eu-config.h: Define unlocked I/O functions to locked ones if they
+ are unavailable.
+
2017-04-27 Ulf Hermann <ulf.hermann@qt.io>
* eu-config.h: Define attribute_hidden to be empty if the compiler
diff --git a/lib/eu-config.h b/lib/eu-config.h
index e69b213d..65300442 100644
--- a/lib/eu-config.h
+++ b/lib/eu-config.h
@@ -206,4 +206,32 @@ asm (".section predict_data, \"aw\"; .previous\n"
# define funlockfile(fp) /* nop */
#endif
+#if !HAVE_DECL_FEOF_UNLOCKED
+#define feof_unlocked(x) feof (x)
+#endif
+
+#if !HAVE_DECL_FERROR_UNLOCKED
+#define ferror_unlocked(x) ferror (x)
+#endif
+
+#if !HAVE_DECL_FPUTC_UNLOCKED
+#define fputc_unlocked(x,y) fputc (x,y)
+#endif
+
+#if !HAVE_DECL_FPUTS_UNLOCKED
+#define fputs_unlocked(x,y) fputs (x,y)
+#endif
+
+#if !HAVE_DECL_FWRITE_UNLOCKED
+#define fwrite_unlocked(w,x,y,z) fwrite (w,x,y,z)
+#endif
+
+#if !HAVE_DECL_PUTC_UNLOCKED
+#define putc_unlocked(x,y) putc (x,y)
+#endif
+
+#if !HAVE_DECL_PUTCHAR_UNLOCKED
+#define putchar_unlocked(x) putchar (x)
+#endif
+
#endif /* eu-config.h */