summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/alloca.h35
-rw-r--r--include/link.h6
-rw-r--r--include/time.h4
-rw-r--r--ldso/ldso/mips/dl-sysdep.h5
-rw-r--r--libc/sysdeps/linux/mips/sysdep.h1
-rw-r--r--libpthread/nptl/compat/libc-symbols.h31
-rw-r--r--libpthread/nptl/descr.h7
-rw-r--r--libpthread/nptl/forward.c2
-rw-r--r--libpthread/nptl/init.c7
-rw-r--r--libpthread/nptl/pt-system.c1
-rw-r--r--libpthread/nptl/pthreadP.h1
-rw-r--r--libpthread/nptl/pthread_attr_init.c4
-rw-r--r--libpthread/nptl/pthread_getschedparam.c8
-rw-r--r--libpthread/nptl/pthread_setschedparam.c4
-rw-r--r--libpthread/nptl/sem_open.c3
-rw-r--r--libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h4
-rw-r--r--libpthread/nptl/sysdeps/mips/tls.h3
-rw-r--r--libpthread/nptl/sysdeps/pthread/sigaction.c19
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c8
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h55
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c4
25 files changed, 215 insertions, 10 deletions
diff --git a/include/alloca.h b/include/alloca.h
index 0dd291f1b..df1b8f099 100644
--- a/include/alloca.h
+++ b/include/alloca.h
@@ -36,6 +36,41 @@ extern void *alloca (size_t __size) __THROW;
# define alloca(size) __builtin_alloca (size)
#endif /* GCC. */
+#define __MAX_ALLOCA_CUTOFF 65536
+
+#ifdef __UCLIBC__
+#include <bits/stackinfo.h>
+#else
+#include <allocalim.h>
+#endif
+
+#if _STACK_GROWS_DOWN
+# define extend_alloca(buf, len, newlen) \
+ (__typeof (buf)) ({ size_t __newlen = (newlen); \
+ char *__newbuf = alloca (__newlen); \
+ if (__newbuf + __newlen == (char *) buf) \
+ len += __newlen; \
+ else \
+ len = __newlen; \
+ __newbuf; })
+#elif _STACK_GROWS_UP
+# define extend_alloca(buf, len, newlen) \
+ (__typeof (buf)) ({ size_t __newlen = (newlen); \
+ char *__newbuf = alloca (__newlen); \
+ char *__buf = (buf); \
+ if (__buf + __newlen == __newbuf) \
+ { \
+ len += __newlen; \
+ __newbuf = __buf; \
+ } \
+ else \
+ len = __newlen; \
+ __newbuf; })
+#else
+# define extern_alloca(buf, len, newlen) \
+ alloca (((len) = (newlen)))
+#endif
+
__END_DECLS
#endif /* alloca.h */
diff --git a/include/link.h b/include/link.h
index f5958e86e..e50b8317a 100644
--- a/include/link.h
+++ b/include/link.h
@@ -114,6 +114,12 @@ struct link_map
ptrdiff_t l_tls_offset;
/* Index of the module in the dtv array. */
size_t l_tls_modid;
+ enum /* Where this object came from. */
+ {
+ lt_executable, /* The main executable program. */
+ lt_library, /* Library needed by main executable. */
+ lt_loaded /* Extra run-time loaded shared object. */
+ } l_type:2;
#endif
};
diff --git a/include/time.h b/include/time.h
index e8e514ca5..7f6eb60e8 100644
--- a/include/time.h
+++ b/include/time.h
@@ -191,6 +191,10 @@ extern double difftime (time_t __time1, time_t __time0)
__THROW __attribute__ ((__const__));
#endif /* __UCLIBC_HAS_FLOATS__ */
+#ifdef __PTHREADS_NATIVE__
+# define CLOCK_IDFIELD_SIZE 3
+#endif
+
/* Return the `time_t' representation of TP and normalize TP. */
extern time_t mktime (struct tm *__tp) __THROW;
diff --git a/ldso/ldso/mips/dl-sysdep.h b/ldso/ldso/mips/dl-sysdep.h
index ed11ae980..e680421db 100644
--- a/ldso/ldso/mips/dl-sysdep.h
+++ b/ldso/ldso/mips/dl-sysdep.h
@@ -5,6 +5,9 @@
* so that we can minimize the amount of platform specific code.
*/
+#ifndef _ARCH_DL_SYSDEP
+#define _ARCH_DL_SYSDEP
+
/* Define this if the system uses RELOCA. */
#undef ELF_USES_RELOCA
#include <elf.h>
@@ -122,3 +125,5 @@ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
{
/* No REALTIVE relocs in MIPS? */
}
+#endif /* !_ARCH_DL_SYSDEP */
+
diff --git a/libc/sysdeps/linux/mips/sysdep.h b/libc/sysdeps/linux/mips/sysdep.h
index dca9cfa7c..0a92afd71 100644
--- a/libc/sysdeps/linux/mips/sysdep.h
+++ b/libc/sysdeps/linux/mips/sysdep.h
@@ -308,7 +308,6 @@ L(syse1):
long result_var = INTERNAL_SYSCALL (name, err, nr, args); \
if ( INTERNAL_SYSCALL_ERROR_P (result_var, err) ) \
{ \
- __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, err)); \
result_var = -1L; \
} \
result_var; })
diff --git a/libpthread/nptl/compat/libc-symbols.h b/libpthread/nptl/compat/libc-symbols.h
index 9c7cc6238..777cafb3e 100644
--- a/libpthread/nptl/compat/libc-symbols.h
+++ b/libpthread/nptl/compat/libc-symbols.h
@@ -1,6 +1,14 @@
#ifndef _LIBC_SYMBOLS_H
#define _LIBC_SYMBOLS_H 1
+#ifndef __SYMBOL_PREFIX
+# ifdef NO_UNDERSCORES
+# define __SYMBOL_PREFIX
+# else
+# define __SYMBOL_PREFIX "_"
+# endif
+#endif
+
/* Handling on non-exported internal names. We have to do this only
for shared code. */
#ifdef SHARED
@@ -26,6 +34,29 @@
# define INTVARDEF2(name, newname)
#endif
+/* These are all done the same way in ELF.
+ There is a new section created for each set. */
+# ifdef SHARED
+/* When building a shared library, make the set section writable,
+ because it will need to be relocated at run time anyway. */
+# define _elf_set_element(set, symbol) \
+ static const void *__elf_set_##set##_element_##symbol##__ \
+ __attribute__ ((used, section (#set))) = &(symbol)
+# else
+# define _elf_set_element(set, symbol) \
+ static const void *const __elf_set_##set##_element_##symbol##__ \
+ __attribute__ ((used, section (#set))) = &(symbol)
+# endif
+
+#define text_set_element(set, symbol) _elf_set_element(set, symbol)
+#define __sec_comment "\n\t#"
+#define __libc_freeres_fn_section \
+ __attribute__ ((section ("__libc_freeres_fn")))
+#define libc_freeres_fn(name) \
+ static void name (void) __attribute_used__ __libc_freeres_fn_section; \
+ text_set_element (__libc_subfreeres, name); \
+ static void name (void)
+
#if 0
# ifndef __ASSEMBLER__
# if !defined HAVE_VISIBILITY_ATTRIBUTE \
diff --git a/libpthread/nptl/descr.h b/libpthread/nptl/descr.h
index 454bb2a54..77251d5e4 100644
--- a/libpthread/nptl/descr.h
+++ b/libpthread/nptl/descr.h
@@ -254,6 +254,13 @@ struct pthread
/* Resolver state. */
struct __res_state res;
+
+ /* If you add fields after the res field above, please adjust
+ the following macro. */
+#define PTHREAD_STRUCT_END_PADDING \
+ (sizeof (struct pthread) - offsetof (struct pthread, res) \
+ - sizeof (((struct pthread *) 0)->res))
+
} __attribute ((aligned (TCB_ALIGNMENT)));
diff --git a/libpthread/nptl/forward.c b/libpthread/nptl/forward.c
index e5f93d475..e3b8a4f23 100644
--- a/libpthread/nptl/forward.c
+++ b/libpthread/nptl/forward.c
@@ -191,6 +191,7 @@ FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate),
FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
+#ifndef __UCLIBC__
#define return /* value is void */
FORWARD2(__pthread_unwind,
void attribute_hidden __attribute ((noreturn)) __cleanup_fct_attribute
@@ -201,3 +202,4 @@ FORWARD2(__pthread_unwind,
INTERNAL_SYSCALL (kill, err, 1, SIGKILL);
})
#undef return
+#endif
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index 003dd7bbf..e48f8ae35 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -324,6 +324,12 @@ __pthread_initialize_minimal_internal (void)
__static_tls_size = roundup (__static_tls_size, static_tls_align);
+/*
+ * For now, we are not going to be concerend about locking inside
+ * the dynamic loader proper. Maybe later. We also disable stack
+ * execution.
+ */
+#ifndef __UCLIBC__
#ifdef SHARED
/* Transfer the old value from the dynamic linker's internal location. */
*__libc_dl_error_tsd () = *(*GL(dl_error_catch_tsd)) ();
@@ -340,6 +346,7 @@ __pthread_initialize_minimal_internal (void)
GL(dl_make_stack_executable_hook) = &__make_stacks_executable;
#endif
+#endif
GL(dl_init_static_tls) = &__pthread_init_static_tls;
diff --git a/libpthread/nptl/pt-system.c b/libpthread/nptl/pt-system.c
index c43c1edbb..2d7f5d172 100644
--- a/libpthread/nptl/pt-system.c
+++ b/libpthread/nptl/pt-system.c
@@ -24,7 +24,6 @@
/* Compatibility define. */
#ifdef __UCLIBC__
-#include <sysdep-cancel.h>
#define __libc_system system
#endif
diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h
index 667802fad..a10444b78 100644
--- a/libpthread/nptl/pthreadP.h
+++ b/libpthread/nptl/pthreadP.h
@@ -28,6 +28,7 @@
#include <tls.h>
#include <lowlevellock.h>
#ifdef __UCLIBC__
+#include <libc-symbols.h>
#include <bits/stackinfo.h>
#else
#include <stackinfo.h>
diff --git a/libpthread/nptl/pthread_attr_init.c b/libpthread/nptl/pthread_attr_init.c
index c84b33f31..b31c08686 100644
--- a/libpthread/nptl/pthread_attr_init.c
+++ b/libpthread/nptl/pthread_attr_init.c
@@ -45,7 +45,11 @@ __pthread_attr_init_2_1 (attr)
iattr = (struct pthread_attr *) attr;
/* Default guard size specified by the standard. */
+#ifdef __UCLIBC__
+ iattr->guardsize = getpagesize ();
+#else
iattr->guardsize = __getpagesize ();
+#endif
return 0;
}
diff --git a/libpthread/nptl/pthread_getschedparam.c b/libpthread/nptl/pthread_getschedparam.c
index 434d86777..b9808bb68 100644
--- a/libpthread/nptl/pthread_getschedparam.c
+++ b/libpthread/nptl/pthread_getschedparam.c
@@ -51,7 +51,11 @@ __pthread_getschedparam (threadid, policy, param)
not yet been retrieved do it now. */
if ((pd->flags & ATTR_FLAG_SCHED_SET) == 0)
{
+#ifdef __UCLIBC__
+ if (sched_getparam (pd->tid, &pd->schedparam) != 0)
+#else
if (__sched_getparam (pd->tid, &pd->schedparam) != 0)
+#endif
result = 1;
else
pd->flags |= ATTR_FLAG_SCHED_SET;
@@ -59,7 +63,11 @@ __pthread_getschedparam (threadid, policy, param)
if ((pd->flags & ATTR_FLAG_POLICY_SET) == 0)
{
+#ifdef __UCLIBC__
+ pd->schedpolicy = sched_getscheduler (pd->tid);
+#else
pd->schedpolicy = __sched_getscheduler (pd->tid);
+#endif
if (pd->schedpolicy == -1)
result = 1;
else
diff --git a/libpthread/nptl/pthread_setschedparam.c b/libpthread/nptl/pthread_setschedparam.c
index 5889cc98a..a3947ba25 100644
--- a/libpthread/nptl/pthread_setschedparam.c
+++ b/libpthread/nptl/pthread_setschedparam.c
@@ -46,7 +46,11 @@ __pthread_setschedparam (threadid, policy, param)
lll_lock (pd->lock);
/* Try to set the scheduler information. */
+#ifdef __UCLIBC__
+ if (__builtin_expect (sched_setscheduler (pd->tid, policy,
+#else
if (__builtin_expect (__sched_setscheduler (pd->tid, policy,
+#endif
param) == -1, 0))
result = errno;
else
diff --git a/libpthread/nptl/sem_open.c b/libpthread/nptl/sem_open.c
index 1fb72d2d4..8727bd057 100644
--- a/libpthread/nptl/sem_open.c
+++ b/libpthread/nptl/sem_open.c
@@ -18,9 +18,6 @@
02111-1307 USA. */
#include <errno.h>
-#ifdef __PTHREADS_NATIVE__
-#define __USE_GNU
-#endif
#include <fcntl.h>
#include <mntent.h>
#include <paths.h>
diff --git a/libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h b/libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h
index 67cc96966..e882f13b2 100644
--- a/libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h
+++ b/libpthread/nptl/sysdeps/mips/jmpbuf-unwind.h
@@ -27,4 +27,8 @@
((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[0].__sp - (_adj))
/* We use the normal longjmp for unwinding. */
+#ifdef __UCLIBC__
+#define __libc_unwind_longjmp(buf, val) longjmp (buf, val)
+#else
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
+#endif
diff --git a/libpthread/nptl/sysdeps/mips/tls.h b/libpthread/nptl/sysdeps/mips/tls.h
index 3adfebccf..2a9dde161 100644
--- a/libpthread/nptl/sysdeps/mips/tls.h
+++ b/libpthread/nptl/sysdeps/mips/tls.h
@@ -61,7 +61,7 @@ typedef union dtv
* NPTL - These defines would normally be handled by the top-level
* configure script in glibc.
*/
-#ifdef __PTHREADS_NATIVE__
+#ifdef __UCLIBC__
#define HAVE_TLS_SUPPORT 1
#define HAVE_TLS_MODEL_ATTRIBUTE 1
#define HAVE___THREAD 1
@@ -84,6 +84,7 @@ typedef union dtv
/* Get the thread descriptor definition. */
#ifdef __UCLIBC__
+# include <libc-symbols.h>
# include <../../descr.h>
#else
# include <nptl/descr.h>
diff --git a/libpthread/nptl/sysdeps/pthread/sigaction.c b/libpthread/nptl/sysdeps/pthread/sigaction.c
index 4d36150a9..62f9daa3c 100644
--- a/libpthread/nptl/sysdeps/pthread/sigaction.c
+++ b/libpthread/nptl/sysdeps/pthread/sigaction.c
@@ -22,12 +22,21 @@
exact file anyway. */
#ifndef LIBC_SIGACTION
+#include <features.h>
+
+#ifdef __UCLIBC__
+#include <errno.h>
+#include <signal.h>
+#include <pthreadP.h>
+#else
#include <nptl/pthreadP.h>
+#endif
/* We use the libc implementation but we tell it to not allow
SIGCANCEL or SIGTIMER to be handled. */
# define LIBC_SIGACTION 1
+#ifndef __UCLIBC__
# include <nptl/sysdeps/pthread/sigaction.c>
int
@@ -35,6 +44,10 @@ __sigaction (sig, act, oact)
int sig;
const struct sigaction *act;
struct sigaction *oact;
+#else
+int
+__sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
+#endif
{
if (__builtin_expect (sig == SIGCANCEL || sig == SIGSETXID, 0))
{
@@ -42,10 +55,16 @@ __sigaction (sig, act, oact)
return -1;
}
+#ifdef __UCLIBC__
+ return sigaction (sig, act, oact);
+#else
return __libc_sigaction (sig, act, oact);
+#endif
}
libc_hidden_weak (__sigaction)
+#ifndef __UCLIBC__
weak_alias (__sigaction, sigaction)
+#endif
#else
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
index 932e27300..8fdccac70 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c
@@ -50,7 +50,11 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime)
struct timespec rt;
/* Get the current time. */
+#ifdef __UCLIBC__
+ (void) gettimeofday (&tv, NULL);
+#else
(void) __gettimeofday (&tv, NULL);
+#endif
/* Compute relative timeout. */
rt.tv_sec = abstime->tv_sec - tv.tv_sec;
@@ -105,7 +109,11 @@ __lll_timedwait_tid (int *tidp, const struct timespec *abstime)
struct timespec rt;
/* Get the current time. */
+#ifdef __UCLIBC__
+ (void) gettimeofday (&tv, NULL);
+#else
(void) __gettimeofday (&tv, NULL);
+#endif
/* Compute relative timeout. */
rt.tv_sec = abstime->tv_sec - tv.tv_sec;
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h
index acf1a617e..f79953d88 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h
@@ -1 +1,54 @@
-#include "../i386/not-cancel.h"
+/* Uncancelable versions of cancelable interfaces. Generic version.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ 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. */
+
+/* By default we have none. Map the name to the normal functions. */
+#define open_not_cancel(name, flags, mode) \
+ __libc_open (name, flags, mode)
+#ifdef __UCLIBC__
+extern int __libc_open(__const char *__file, int __oflag, ...) __THROW;
+#define open_not_cancel_2(name, flags) \
+ __libc_open (name, flags, 0)
+#else
+#define open_not_cancel_2(name, flags) \
+ __libc_open (name, flags)
+#endif
+#define close_not_cancel(fd) \
+ __close (fd)
+#ifdef __UCLIBC__
+#define close_not_cancel_no_status(fd) \
+ (void) close (fd)
+#define read_not_cancel(fd, buf, n) \
+ read (fd, buf, n)
+#define write_not_cancel(fd, buf, n) \
+ write (fd, buf, n)
+#else
+#define close_not_cancel_no_status(fd) \
+ (void) __close (fd)
+#define read_not_cancel(fd, buf, n) \
+ __read (fd, buf, n)
+#define write_not_cancel(fd, buf, n) \
+ __write (fd, buf, n)
+#endif
+#define writev_not_cancel_no_status(fd, iov, n) \
+ (void) __writev (fd, iov, n)
+#define fcntl_not_cancel(fd, cmd, val) \
+ __fcntl (fd, cmd, val)
+# define waitpid_not_cancel(pid, stat_loc, options) \
+ __waitpid (pid, stat_loc, options)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c
index 1c92f314d..48d5a62a7 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_getaffinity.c
@@ -39,7 +39,8 @@ __pthread_attr_getaffinity_new (const pthread_attr_t *attr, size_t cpusetsize,
{
/* Check whether there are any bits set beyond the limits
the user requested. */
- for (size_t cnt = cpusetsize; cnt < iattr->cpusetsize; ++cnt)
+ size_t cnt;
+ for (cnt = cpusetsize; cnt < iattr->cpusetsize; ++cnt)
if (((char *) iattr->cpuset)[cnt] != 0)
return EINVAL;
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c
index ca84f1c9b..1842b275a 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_attr_setaffinity.c
@@ -58,7 +58,8 @@ __pthread_attr_setaffinity_new (pthread_attr_t *attr, size_t cpusetsize,
/* Check whether the new bitmask has any bit set beyond the
last one the kernel accepts. */
- for (size_t cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt)
+ size_t cnt;
+ for (cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt)
if (((char *) cpuset)[cnt] != '\0')
/* Found a nonzero byte. This means the user request cannot be
fulfilled. */
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c
index 990db8741..9e1abd983 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c
@@ -5,4 +5,8 @@
#define __pthread_mutex_lock __pthread_mutex_cond_lock
#define NO_INCR
+#ifdef __UCLIBC__
+#include <pthread_mutex_lock.c>
+#else
#include <nptl/pthread_mutex_lock.c>
+#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
index 5b24c694a..01e21d3ce 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_setaffinity.c
@@ -71,7 +71,8 @@ __pthread_setaffinity_new (pthread_t th, size_t cpusetsize,
/* We now know the size of the kernel cpumask_t. Make sure the user
does not request to set a bit beyond that. */
- for (size_t cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt)
+ size_t cnt;
+ for (cnt = __kernel_cpumask_size; cnt < cpusetsize; ++cnt)
if (((char *) cpuset)[cnt] != '\0')
/* Found a nonzero byte. This means the user request cannot be
fulfilled. */
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
index ef897c1e9..d4ed1caba 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
@@ -56,7 +56,11 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime)
int sec, nsec;
/* Get the current time. */
+#ifdef __UCLIBC__
+ gettimeofday (&tv, NULL);
+#else
__gettimeofday (&tv, NULL);
+#endif
/* Compute relative timeout. */
sec = abstime->tv_sec - tv.tv_sec;