aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-06-20 10:06:28 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-06-20 10:06:28 +0200
commit06448912e6af33a1ac95f985448f83cbd39bac44 (patch)
tree822eea2ea50f9c23cbf13816ef0129c4fa05515b /include
parentadcabf3235a13e77a32ff2a7b7cf80be8ee3dfe3 (diff)
downloadbusybox-06448912e6af33a1ac95f985448f83cbd39bac44.tar.gz
libbb: use _unlocked variants of stdio I/O.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 953bec334..963ae1e47 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -160,6 +160,44 @@ int sysinfo(struct sysinfo* info);
#endif
+/* Busybox does not use threads, we can speed up stdio.
+ * But don't define foo to foo_unlocked if foo_unlocked
+ * is a macro (it might be defined back to foo!).
+ */
+#ifndef getc_unlocked
+# undef getc
+# define getc(stream) getc_unlocked(stream)
+#endif
+#ifndef getchar_unlocked
+# undef getchar
+# define getchar() getchar_unlocked()
+#endif
+#ifndef putc_unlocked
+# undef putc
+# define putc(c, stream) putc_unlocked(c, stream)
+#endif
+#ifndef putchar_unlocked
+# undef putchar
+# define putchar(c) putchar_unlocked(c)
+#endif
+#ifndef fgetc_unlocked
+# undef fgetc
+# define fgetc(stream) fgetc_unlocked(stream)
+#endif
+#ifndef fputc_unlocked
+# undef fputc
+# define fputc(c, stream) fputc_unlocked(c, stream)
+#endif
+#ifndef fgets_unlocked
+# undef fgets
+# define fgets(s, n, stream) fgets_unlocked(s, n, stream)
+#endif
+#ifndef fputs_unlocked
+# undef fputs
+# define fputs(s, stream) fputs_unlocked(s, stream)
+#endif
+
+
/* Make all declarations hidden (-fvisibility flag only affects definitions) */
/* (don't include system headers after this until corresponding pop!) */
PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN