This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH] Define unlocked io functions to locked ones if they are unavailable
- From: Ulf Hermann <ulf dot hermann at qt dot io>
- To: <elfutils-devel at sourceware dot org>
- Date: Thu, 4 May 2017 11:19:13 +0200
- Subject: [PATCH] Define unlocked io functions to locked ones if they are unavailable
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=qt.io;
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qtcompany.onmicrosoft.com; s=selector1-qt-io; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Q8kapyvFH2tcD56KrdpnAB/OMD+0Fq/JX83UQMOuLQ8=; b=PRQzZrSauhvmzf3wy3NyA+M8BhZ9Rrd/NLNnQ6yGDiK23XOuhC4xkV/LO+2z7tz5Z94OxJsZ3khuNHONh4PazjoVHo+0gVeqob9yCI/gbjZuhKw0mBUoYdOVnLyDpWpZPjfYZL/IBkdA+XWin2enVO/CezRK1XcAtmqvcqe4jXs=
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
The locked IO functions will still do the job, albeit a bit slower.
Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
ChangeLog | 4 ++++
configure.ac | 4 ++++
lib/ChangeLog | 5 +++++
lib/eu-config.h | 28 ++++++++++++++++++++++++++++
4 files changed, 41 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index d43eeb6..29013e8 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 f04a6c8..0432bb1 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 ecc6179..321513c 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 e69b213..6530044 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 */
--
2.1.4