[PATCH] Add a stdio_ext.h that defines __fsetlocking away

Ulf Hermann ulf.hermann@qt.io
Thu May 4 09:19:00 GMT 2017


__fsetlocking is a nice optimization, but if it's unavailable, we can do
without.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 ChangeLog             |  4 ++++
 configure.ac          |  3 +++
 libgnu/ChangeLog      |  5 +++++
 libgnu/Makefile.am    |  9 ++++++++-
 libgnu/stdio_ext.in.h | 35 +++++++++++++++++++++++++++++++++++
 5 files changed, 55 insertions(+), 1 deletion(-)
 create mode 100644 libgnu/stdio_ext.in.h

diff --git a/ChangeLog b/ChangeLog
index 4024550..30b3884 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* configure.ac: Check for stdio_ext.h.
+
+2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* configure.ac: Check for features.h.
 
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
diff --git a/configure.ac b/configure.ac
index fc5edf8..2488bbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -583,6 +583,9 @@ AM_CONDITIONAL(HAVE_AR_H, [test "x$ac_cv_header_ar_h" = "xyes"])
 AC_CHECK_HEADERS(features.h)
 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"])
+
 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/libgnu/ChangeLog b/libgnu/ChangeLog
index 7d70bfc..2cbc87f 100644
--- a/libgnu/ChangeLog
+++ b/libgnu/ChangeLog
@@ -1,5 +1,10 @@
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* Makefile.am: If stdio_ext.h is unavailable, use our own.
+	* stdio_ext.in.h: New file.
+
+2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* Makefile.am: If features.h is unavailable, use our own.
 	* features.in.h: New file.
 
diff --git a/libgnu/Makefile.am b/libgnu/Makefile.am
index ed8aff1..ca1a078 100644
--- a/libgnu/Makefile.am
+++ b/libgnu/Makefile.am
@@ -36,7 +36,7 @@ MOSTLYCLEANFILES =
 MOSTLYCLEANDIRS =
 BUILT_SOURCES =
 EXTRA_DIST = endian.in.h byteswap.in.h sys_mman.win32.h mman_win32.c sysconf_win32.c ar.in.h \
-             features.in.h
+             features.in.h stdio_ext.in.h
 CLEANFILES =
 SUFFIXES =
 
@@ -77,6 +77,13 @@ MOSTLYCLEANFILES += sys/mman.h
 endif
 endif
 
+if !HAVE_STDIO_EXT_H
+stdio_ext.h: stdio_ext.in.h
+	$(AM_V_GEN)rm -f $@ && cat $< > $@
+BUILT_SOURCES += stdio_ext.h
+MOSTLYCLEANFILES += stdio_ext.h
+endif
+
 include gnulib.am
 
 if !HAVE_SYS_MMAN_H
diff --git a/libgnu/stdio_ext.in.h b/libgnu/stdio_ext.in.h
new file mode 100644
index 0000000..62565f4
--- /dev/null
+++ b/libgnu/stdio_ext.in.h
@@ -0,0 +1,35 @@
+/* This file defines __fsetlocking to noop
+   Copyright (C) 2017 The Qt Company Ltd
+   This file is part of elfutils.
+
+   This file is free software; you can redistribute it and/or modify
+   it under the terms of either
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version
+
+   or both in parallel, as here.
+
+   elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _STDIO_EXT_H
+#define _STDIO_EXT_H 1
+
+#define __fsetlocking(stream, type) (void)0
+
+#endif /* stdio_ext.h */
+
-- 
2.1.4



More information about the Elfutils-devel mailing list