Commit f9f7dad5 authored by Natanael Copa's avatar Natanael Copa

main/libc0.9.32: remove

we havent supported this for years
parent d89594d9
From d0d708fffcc475973736aea3759f4d7944a4629a Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Fri, 23 Dec 2011 14:06:09 +0100
Subject: [PATCH 1/8] Compatible stack protector for non Thread Local storage
Before we had thread local storage the __stack_chk_guard was a global
variable that was referenced to by the older binaries.
We since then have changed ABI so this patch can probably go away.
---
ldso/ldso/ldso.c | 7 +------
libc/misc/internals/__uClibc_main.c | 8 +-------
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 014bbf5..7690036 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -121,11 +121,7 @@ extern void _start(void);
#ifdef __UCLIBC_HAS_SSP__
# include <dl-osinfo.h>
static uintptr_t stack_chk_guard;
-# ifndef THREAD_SET_STACK_GUARD
-/* Only exported for architectures that don't store the stack guard canary
- * in local thread area. */
uintptr_t __stack_chk_guard attribute_relro;
-# endif
# ifdef __UCLIBC_HAS_SSP_COMPAT__
uintptr_t __guard attribute_relro;
# endif
@@ -1189,9 +1185,8 @@ of this helper program; chances are you did not intend to run this program.\n\
stack_chk_guard = _dl_setup_stack_chk_guard ();
# ifdef THREAD_SET_STACK_GUARD
THREAD_SET_STACK_GUARD (stack_chk_guard);
-# else
- __stack_chk_guard = stack_chk_guard;
# endif
+ __stack_chk_guard = stack_chk_guard;
# ifdef __UCLIBC_HAS_SSP_COMPAT__
__guard = stack_chk_guard;
# endif
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 71fdbd8..3a24acd 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -46,12 +46,7 @@ void *__libc_stack_end = NULL;
# ifdef __UCLIBC_HAS_SSP__
# include <dl-osinfo.h>
static uintptr_t stack_chk_guard;
-# ifndef THREAD_SET_STACK_GUARD
-/* Only exported for architectures that don't store the stack guard canary
- * in thread local area. */
-/* for gcc-4.1 non-TLS */
uintptr_t __stack_chk_guard attribute_relro;
-# endif
/* for gcc-3.x + Etoh ssp */
# ifdef __UCLIBC_HAS_SSP_COMPAT__
uintptr_t __guard attribute_relro;
@@ -251,9 +246,8 @@ void __uClibc_init(void)
stack_chk_guard = _dl_setup_stack_chk_guard();
# ifdef THREAD_SET_STACK_GUARD
THREAD_SET_STACK_GUARD (stack_chk_guard);
-# else
- __stack_chk_guard = stack_chk_guard;
# endif
+ __stack_chk_guard = stack_chk_guard;
# ifdef __UCLIBC_HAS_SSP_COMPAT__
__guard = stack_chk_guard;
# endif
--
1.7.8.4
From 9d101732ad0609f2f19ef20062a00cd26b01d859 Mon Sep 17 00:00:00 2001
From: "Peter S. Mazinger" <ps.m@gmx.net>
Date: Tue, 26 Apr 2011 23:03:44 +0200
Subject: [PATCH] add posix_madvise.c
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
libc/sysdeps/linux/common/Makefile.in | 2 +-
libc/sysdeps/linux/common/posix_madvise.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 libc/sysdeps/linux/common/posix_madvise.c
diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in
index cf9f25a..b40bb78 100644
--- a/libc/sysdeps/linux/common/Makefile.in
+++ b/libc/sysdeps/linux/common/Makefile.in
@@ -81,7 +81,7 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_getres.c clock_gettime.c clock_settime.c \
sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
# clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typed_mem_get_info|pthread_mutex_timedlock|sem_timedwait
-CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c
+CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c
CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
diff --git a/libc/sysdeps/linux/common/posix_madvise.c b/libc/sysdeps/linux/common/posix_madvise.c
new file mode 100644
index 0000000..2f95bcb
--- /dev/null
+++ b/libc/sysdeps/linux/common/posix_madvise.c
@@ -0,0 +1,25 @@
+/* vi: set sw=4 ts=4: */
+/* Licensed under the LGPL v2.1, see the file LICENSE in this tarball. */
+
+#include <sys/mman.h>
+#include <sys/syscall.h>
+
+#if defined __NR_madvise && defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
+int posix_madvise(void *addr, size_t len, int advice)
+{
+ int result;
+ /* We have one problem: the kernel's MADV_DONTNEED does not
+ * correspond to POSIX's POSIX_MADV_DONTNEED. The former simply
+ * discards changes made to the memory without writing it back to
+ * disk, if this would be necessary. The POSIX behaviour does not
+ * allow this. There is no functionality mapping for the POSIX
+ * behaviour so far so we ignore that advice for now. */
+ if (advice == POSIX_MADV_DONTNEED)
+ return 0;
+
+ /* this part might use madvise function */
+ INTERNAL_SYSCALL_DECL (err);
+ result = INTERNAL_SYSCALL (madvise, err, 3, addr, len, advice);
+ return INTERNAL_SYSCALL_ERRNO (result, err);
+}
+#endif
--
1.7.11.1
From b26db0813ca2aab8882535caa9d0a6c8671e9bbc Mon Sep 17 00:00:00 2001
From: "Peter S. Mazinger" <ps.m@gmx.net>
Date: Thu, 21 Apr 2011 21:19:39 +0200
Subject: [PATCH 1/6] cancel.h: add generic file to ease cancellation support
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
(cherry picked from commit 9f68f0cbf8c8eea6a7f9e195e4617bbaa808d7c6)
Conflicts:
Makefile.in
---
Makefile.in | 1 +
include/cancel.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+)
create mode 100644 include/cancel.h
diff --git a/Makefile.in b/Makefile.in
index 9ba590d..e81926d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -210,6 +210,7 @@ $(top_builddir)extra/scripts/unifdef: $(top_srcdir)extra/scripts/unifdef.c
# a "y" here means the feature is enabled and so we should *not* rm it.
# if the option expands to nothing though, we can punt the headers.
HEADERS_RM- := \
+ cancel.h \
dl-osinfo.h \
hp-timing.h \
_lfs_64.h \
diff --git a/include/cancel.h b/include/cancel.h
new file mode 100644
index 0000000..ac6f6b6
--- /dev/null
+++ b/include/cancel.h
@@ -0,0 +1,101 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright (C) 2000-2011 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef _CANCEL_H
+#define _CANCEL_H
+
+/*
+ * Usage of this header:
+ * 1. define a static or hidden function __NC(NAME) - expands to __NAME_nocancel
+ * 2. if it is hidden, add the prototype to the appropiate header where NAME has
+ * it's prototype (guarded by _LIBC)
+ * 3. add a CANCELLABLE_SYSCALL(...) line at the end, this will create the function
+ * NAME (as weak) with enabled cancellation for NPTL (and later for new LT), for
+ * LT_OLD it will also create a strong_alias to __libc_NAME to be used in libpthread
+ * 4. if you need libc_hidden_(weak|def) line, use instead lt_libc_hidden, this will
+ * take care of the correct type, weak or strong depending on the THREADS type
+ * 5. If the implementation can't be done using CANCELLABLE_SYSCALL (like for fcntl)
+ * you need to manually add lt_strong_alias() line too, to optionally create the
+ * __libc_NAME alias
+ * 6. if functions are needed to implement __NC(NAME), that themselves are cancellable,
+ * decide how the cancellation should be solved, two variants are possible:
+ * a. use the other function as __NC(FUNC), this way you access the non-cancellable
+ * variant and provide by CANCELLABLE_SYSCALL(...) the dedicated cancellation for NAME.
+ * be aware, that for this case __NC(FUNC) has to be hidden (not static)
+ * b. use the other function with it's name (FUNC) and add LIBC_CANCEL_HANDLED(); at
+ * the end of file with a comment telling us which function took care of the cancellation
+ * Note: LIBC_CANCEL_HANDLED() is noop on uClibc, glibc uses it only for tests, we use
+ * it only for "documentation".
+ *
+ * For now the use of this file is limited to libc, will expand later to support libpthread
+ * and librt as well.
+ */
+
+#include <features.h>
+
+#ifndef NOT_IN_libc
+
+#define __NC(name) _NC(name)
+#define _NC(name) __##name##_nocancel
+
+#define __NC_OLD(name) _NC_OLD(name)
+#define _NC_OLD(name) __libc_##name
+
+#define __NC_PROTO(name) extern __typeof(name) __NC(name) attribute_hidden;
+#define __NC_OLD_PROTO(name) extern __typeof(name) __NC_OLD(name);
+
+#if defined __UCLIBC_HAS_THREADS__ && !defined __LINUXTHREADS_OLD__
+# define __NEW_THREADS 1
+#else
+# define SINGLE_THREAD_P 1
+#endif
+
+#ifdef __NEW_THREADS
+# include <sysdep-cancel.h>
+
+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
+res_type weak_function name param_list \
+{ \
+ if (SINGLE_THREAD_P) \
+ return __NC(name) params; \
+ int oldtype = LIBC_CANCEL_ASYNC(); \
+ res_type result = __NC(name) params; \
+ LIBC_CANCEL_RESET(oldtype); \
+ return result; \
+}
+
+# define lt_strong_alias(name)
+# define lt_libc_hidden(name) libc_hidden_def(name)
+
+#elif defined __LINUXTHREADS_OLD__
+
+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
+weak_alias(__NC(name),name) \
+lt_strong_alias(name)
+
+# define lt_strong_alias(name) \
+__NC_OLD_PROTO(name) \
+strong_alias(name,__NC_OLD(name))
+# define lt_libc_hidden(name) libc_hidden_weak(name)
+
+#else
+
+# define CANCELLABLE_SYSCALL(res_type, name, param_list, params) \
+strong_alias(__NC(name),name)
+
+# define lt_strong_alias(name)
+# define lt_libc_hidden(name) libc_hidden_def(name)
+
+#endif
+
+/* disable it, useless, glibc uses it only for tests */
+# undef LIBC_CANCEL_HANDLED
+# define LIBC_CANCEL_HANDLED()
+
+#endif /* NOT_IN_libc */
+
+#endif
--
1.7.11.1
--- uClibc-0.9.33.2.orig/utils/ldd.c
+++ uClibc-0.9.33.2/utils/ldd.c
@@ -827,7 +827,7 @@
for (cur = lib_list; cur; cur = cur->next) {
if (cur->resolved == 0 && cur->path) {
got_em_all = 1;
- printf("checking sub-depends for '%s'\n", cur->path);
+ fprintf(stderr, "checking sub-depends for '%s'\n", cur->path);
find_dependencies(cur->path);
cur->resolved = 1;
}
From 42d1b23fc0f3748b8bf474e456d6c44aa7e563fd Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Wed, 14 Nov 2012 00:30:54 -0500
Subject: [PATCH] libc/stdlib: add mkostemp helpers
Some projects (like udev) are starting to use this.
Imported from glibc.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
include/stdlib.h | 23 +++++++++++++++++++++++
libc/stdlib/Makefile.in | 4 ++--
libc/stdlib/mkostemp.c | 32 ++++++++++++++++++++++++++++++++
libc/stdlib/mkostemp64.c | 33 +++++++++++++++++++++++++++++++++
4 files changed, 90 insertions(+), 2 deletions(-)
create mode 100644 libc/stdlib/mkostemp.c
create mode 100644 libc/stdlib/mkostemp64.c
diff --git a/include/stdlib.h b/include/stdlib.h
index 354fc66..79ccc55 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -652,6 +652,29 @@ extern int mkstemp64 (char *__template) __nonnull ((1)) __wur;
extern char *mkdtemp (char *__template) __THROW __nonnull ((1)) __wur;
#endif
+#ifdef __USE_GNU
+/* Generate a unique temporary file name from TEMPLATE similar to
+ mkstemp. But allow the caller to pass additional flags which are
+ used in the open call to create the file..
+
+ This function is a possible cancellation point and therefore not
+ marked with __THROW. */
+# ifndef __USE_FILE_OFFSET64
+extern int mkostemp (char *__template, int __flags) __nonnull ((1)) __wur;
+# else
+# ifdef __REDIRECT
+extern int __REDIRECT (mkostemp, (char *__template, int __flags), mkostemp64)
+ __nonnull ((1)) __wur;
+# else
+# define mkostemp mkostemp64
+# endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int mkostemp64 (char *__template, int __flags) __nonnull ((1)) __wur;
+# endif
+
+#endif
+
__BEGIN_NAMESPACE_STD
/* Execute the given line as a shell command.
diff --git a/libc/stdlib/Makefile.in b/libc/stdlib/Makefile.in
index 3166b8e..b92f7ce 100644
--- a/libc/stdlib/Makefile.in
+++ b/libc/stdlib/Makefile.in
@@ -12,7 +12,7 @@ include $(top_srcdir)libc/stdlib/malloc-simple/Makefile.in
include $(top_srcdir)libc/stdlib/malloc-standard/Makefile.in
CSRC-y := \
- abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c \
+ abort.c getenv.c mkdtemp.c realpath.c canonicalize.c mkstemp.c mkostemp.c \
rand.c random.c random_r.c setenv.c div.c ldiv.c lldiv.c \
getpt.c drand48-iter.c jrand48.c \
jrand48_r.c lcong48.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \
@@ -21,7 +21,7 @@ CSRC-y := \
CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_memalign.c
CSRC-$(UCLIBC_HAS_PTY) += grantpt.c unlockpt.c ptsname.c
CSRC-$(UCLIBC_HAS_ARC4RANDOM) += arc4random.c
-CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c
+CSRC-$(UCLIBC_HAS_LFS) += mkstemp64.c mkostemp64.c
CSRC-$(UCLIBC_HAS_FLOATS) += drand48.c drand48_r.c erand48.c erand48_r.c
CSRC-$(if $(findstring yy,$(UCLIBC_HAS_FLOATS)$(UCLIBC_SUSV3_LEGACY)),y) += \
gcvt.c
diff --git a/libc/stdlib/mkostemp.c b/libc/stdlib/mkostemp.c
new file mode 100644
index 0000000..93b50fc
--- /dev/null
+++ b/libc/stdlib/mkostemp.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "../misc/internals/tempname.h"
+
+/* Generate a unique temporary file name from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+ Then open the file and return a fd. */
+int
+mkostemp (template, flags)
+ char *template;
+ int flags;
+{
+ return __gen_tempname (template, __GT_FILE, flags);
+}
diff --git a/libc/stdlib/mkostemp64.c b/libc/stdlib/mkostemp64.c
new file mode 100644
index 0000000..5509d8c
--- /dev/null
+++ b/libc/stdlib/mkostemp64.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "../misc/internals/tempname.h"
+
+/* Generate a unique temporary file name from TEMPLATE.
+ The last six characters of TEMPLATE must be "XXXXXX";
+ they are replaced with a string that makes the filename unique.
+ Then open the file and return a fd. */
+int
+mkostemp64 (template, flags)
+ char *template;
+ int flags;
+{
+ return __gen_tempname (template, __GT_BIGFILE, flags | O_LARGEFILE);
+}
--
1.8.3.3
From a66161f44853403b2cf464de08753d4b5aa6d2dd Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 25 Apr 2013 11:28:37 +0000
Subject: [PATCH] libm/x86_64: implement fegetround
---
libm/x86_64/fegetround.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 libm/x86_64/fegetround.c
diff --git a/libm/x86_64/fegetround.c b/libm/x86_64/fegetround.c
new file mode 100644
index 0000000..8ae0c3a
--- /dev/null
+++ b/libm/x86_64/fegetround.c
@@ -0,0 +1,31 @@
+/* Return current rounding direction.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+
+int
+fegetround (void)
+{
+ int cw;
+
+ __asm__ ("fnstcw %0" : "=m" (*&cw));
+
+ return cw & 0xc00;
+}
--
1.8.2.1
From 79899f6b3cade5b0ad39b70d30ccf15f182ba045 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 16 May 2013 14:04:39 +0000
Subject: [PATCH] stdio: inline getchar/putchar
Some apps like lvm2 modifies stdin. This breaks getchar since it is
a macro that uses __stdin.
(cherry picked from commit aabeb90f74aa2736fb993cd5840a894eff3b958f)
Conflicts:
include/stdio.h
libc/sysdeps/linux/common/bits/uClibc_stdio.h
---
include/stdio.h | 17 +++++++----------
libc/stdio/getchar.c | 2 --
libc/stdio/putchar.c | 3 ---
libc/sysdeps/linux/common/bits/uClibc_stdio.h | 6 ------
4 files changed, 7 insertions(+), 21 deletions(-)
diff --git a/include/stdio.h b/include/stdio.h
index 289b861..4d6092a 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -906,19 +906,16 @@ extern void funlockfile (FILE *__stream) __THROW;
#define fputc_unlocked(_ch, _fp) __FPUTC_UNLOCKED(_ch, _fp)
#endif
-#ifndef __STDIO_GETC_MACRO
-#define __stdin stdin
-#endif
-#define getchar() __GETC(__stdin)
+#ifdef __USE_EXTERN_INLINES
-#ifndef __STDIO_PUTC_MACRO
-#define __stdout stdout
-#endif
-#define putchar(_ch) __PUTC((_ch), __stdout)
+__extern_inline int getchar(void) { return __GETC(stdin); }
+__extern_inline int putchar(int c) { return __PUTC(c, stdout); }
#if defined __USE_POSIX || defined __USE_MISC
-#define getchar_unlocked() __GETC_UNLOCKED(__stdin)
-#define putchar_unlocked(_ch) __PUTC_UNLOCKED((_ch), __stdout)
+__extern_inline int getchar_unlocked(void) { return __GETC_UNLOCKED(stdin); }
+__extern_inline int putchar_unlocked(int c) { return __PUTC_UNLOCKED(c, stdout); }
+#endif
+
#endif
/* Clear the error and EOF indicators for STREAM. */
diff --git a/libc/stdio/getchar.c b/libc/stdio/getchar.c
index b6c650c..f8c487b 100644
--- a/libc/stdio/getchar.c
+++ b/libc/stdio/getchar.c
@@ -8,11 +8,9 @@
#include "_stdio.h"
-#undef getchar
#ifdef __DO_UNLOCKED
/* the only use of the hidden getchar_unlocked is in gets.c */
-#undef getchar_unlocked
int getchar_unlocked(void)
{
register FILE *stream = stdin;
diff --git a/libc/stdio/putchar.c b/libc/stdio/putchar.c
index 583e90f..804b09d 100644
--- a/libc/stdio/putchar.c
+++ b/libc/stdio/putchar.c
@@ -7,11 +7,8 @@
#include "_stdio.h"
-
-#undef putchar
#ifdef __DO_UNLOCKED
-#undef putchar_unlocked
int putchar_unlocked(int c)
{
register FILE *stream = stdout;
diff --git a/libc/sysdeps/linux/common/bits/uClibc_stdio.h b/libc/sysdeps/linux/common/bits/uClibc_stdio.h
index a8cf4eb..2ec8ad4 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_stdio.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_stdio.h
@@ -411,8 +411,6 @@ libc_hidden_proto(__fputc_unlocked)
#ifdef __STDIO_GETC_MACRO
-extern FILE *__stdin; /* For getchar() macro. */
-
# undef __GETC_UNLOCKED_MACRO
# define __GETC_UNLOCKED_MACRO(__stream) \
( ((__stream)->__bufpos < (__stream)->__bufgetc_u) \
@@ -463,15 +461,11 @@ extern FILE *__stdin; /* For getchar() macro. */
# endif
# endif
-#else
-
#endif /* __STDIO_GETC_MACRO */
#ifdef __STDIO_PUTC_MACRO
-extern FILE *__stdout; /* For putchar() macro. */
-
# undef __PUTC_UNLOCKED_MACRO
# define __PUTC_UNLOCKED_MACRO(__c, __stream) \
( ((__stream)->__bufpos < (__stream)->__bufputc_u) \
--
1.8.2.3
From 5084cf8b6b8f01890b62bfd0edf085d04887d084 Mon Sep 17 00:00:00 2001
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Date: Sun, 10 Feb 2013 17:21:15 +0100
Subject: [PATCH] stdlib: Fix fndecl of mkostemp, mkostemp64
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
libc/stdlib/mkostemp.c | 4 +---
libc/stdlib/mkostemp64.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/libc/stdlib/mkostemp.c b/libc/stdlib/mkostemp.c
index 93b50fc..0369235 100644
--- a/libc/stdlib/mkostemp.c
+++ b/libc/stdlib/mkostemp.c
@@ -24,9 +24,7 @@
they are replaced with a string that makes the filename unique.
Then open the file and return a fd. */
int
-mkostemp (template, flags)
- char *template;
- int flags;
+mkostemp (char *template, int flags)
{
return __gen_tempname (template, __GT_FILE, flags);
}
diff --git a/libc/stdlib/mkostemp64.c b/libc/stdlib/mkostemp64.c
index 5509d8c..d21def5 100644
--- a/libc/stdlib/mkostemp64.c
+++ b/libc/stdlib/mkostemp64.c
@@ -25,9 +25,7 @@
they are replaced with a string that makes the filename unique.
Then open the file and return a fd. */
int
-mkostemp64 (template, flags)
- char *template;
- int flags;
+mkostemp64 (char *template, int flags)
{
return __gen_tempname (template, __GT_BIGFILE, flags | O_LARGEFILE);
}
--
1.8.3.4
From 1bdc1ab2938ddc824c01b9b4487ea6a73e4216cd Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Wed, 30 May 2012 01:15:03 -0400
Subject: [PATCH 2/6] pread/pwrite: handle renamed syscalls in
common/ppc/xtensa code
Some arches got this fix, but many did not. So copy the ifdef logic to
the ones that missed it to fix behavior in linux-2.6+.
URL: https://bugs.busybox.net/show_bug.cgi?id=5258
Reported-by: David Laight <david.laight@aculab.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
(cherry picked from commit 52fa45da0f86651b70608a58914f3aece7fdfed5)
---