2003-06-01  Ulrich Drepper  <drepper@redhat.com>

	* elf/Makefile (CFLAGS-dl-runtime.c): Define.

	* wcsmbs/wcpncpy.c (__wcpncpy): Fix broken implementation to match
	stpncpy.
This commit is contained in:
Ulrich Drepper 2003-06-01 08:52:38 +00:00
parent 31195be25b
commit 80b5421740
7 changed files with 65 additions and 53 deletions

View File

@ -1,3 +1,10 @@
2003-06-01 Ulrich Drepper <drepper@redhat.com>
* elf/Makefile (CFLAGS-dl-runtime.c): Define.
* wcsmbs/wcpncpy.c (__wcpncpy): Fix broken implementation to match
stpncpy.
2003-05-31 Ulrich Drepper <drepper@redhat.com> 2003-05-31 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h (SA_NOCLDWAIT): Define. * sysdeps/unix/sysv/linux/ia64/bits/sigaction.h (SA_NOCLDWAIT): Define.

View File

@ -82,6 +82,8 @@ distribute := rtld-Rules \
tst-array2dep.c \ tst-array2dep.c \
check-textrel.c dl-sysdep.h check-textrel.c dl-sysdep.h
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
include ../Makeconfig include ../Makeconfig
ifeq ($(unwind-find-fde),yes) ifeq ($(unwind-find-fde),yes)

View File

@ -708,9 +708,9 @@ This function is similar to @code{wcpcpy} but copies always exactly
If the length of @var{wfrom} is more then @var{size}, then If the length of @var{wfrom} is more then @var{size}, then
@code{wcpncpy} copies just the first @var{size} wide characters and @code{wcpncpy} copies just the first @var{size} wide characters and
returns a pointer to the wide character directly following the one which returns a pointer to the wide character directly following the last
was copied last. Note that in this case there is no null terminator non-null wide character which was copied last. Note that in this case
written into @var{wto}. there is no null terminator written into @var{wto}.
If the length of @var{wfrom} is less than @var{size}, then @code{wcpncpy} If the length of @var{wfrom} is less than @var{size}, then @code{wcpncpy}
copies all of @var{wfrom}, followed by enough null characters to add up copies all of @var{wfrom}, followed by enough null characters to add up

View File

@ -12,6 +12,10 @@
Likewise. Likewise.
* sysdeps/unix/sysv/linux/s390/sem_timedwait.c (sem_timedwait): * sysdeps/unix/sysv/linux/s390/sem_timedwait.c (sem_timedwait):
Likewise. Likewise.
* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h (lll_timedwait_tid):
Likewise.
* sysdeps/unix/sysv/linux/sh/lowlevellock.h (lll_timedwait_tid):
Likewise.
* Makefile (tests): Add tst-sem8 and tst-sem9. * Makefile (tests): Add tst-sem8 and tst-sem9.
* tst-sem8.c: New file. * tst-sem8.c: New file.

View File

@ -148,34 +148,34 @@ typedef int lll_lock_t;
# endif # endif
#define lll_futex_wait(futex, val) \ #define lll_futex_wait(futex, val) \
do { \ do { \
int __ignore; \ int __ignore; \
register unsigned long __r3 asm ("r3") = SYS_futex; \ register unsigned long __r3 asm ("r3") = SYS_futex; \
register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \ register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \ register unsigned long __r5 asm ("r5") = FUTEX_WAIT; \
register unsigned long __r6 asm ("r6") = (unsigned long) (val); \ register unsigned long __r6 asm ("r6") = (unsigned long) (val); \
register unsigned long __r7 asm ("r7") = 0; \ register unsigned long __r7 asm ("r7") = 0; \
__asm __volatile (SYSCALL_WITH_INST_PAD \ __asm __volatile (SYSCALL_WITH_INST_PAD \
: "=z" (__ignore) \ : "=z" (__ignore) \
: "r" (__r3), "r" (__r4), "r" (__r5), \ : "r" (__r3), "r" (__r4), "r" (__r5), \
"r" (__r6), "r" (__r7) \ "r" (__r6), "r" (__r7) \
: "memory", "t"); \ : "memory", "t"); \
} while (0) } while (0)
#define lll_futex_wake(futex, nr) \ #define lll_futex_wake(futex, nr) \
do { \ do { \
int __ignore; \ int __ignore; \
register unsigned long __r3 asm ("r3") = SYS_futex; \ register unsigned long __r3 asm ("r3") = SYS_futex; \
register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \ register unsigned long __r4 asm ("r4") = (unsigned long) (futex); \
register unsigned long __r5 asm ("r5") = FUTEX_WAKE; \ register unsigned long __r5 asm ("r5") = FUTEX_WAKE; \
register unsigned long __r6 asm ("r6") = (unsigned long) (nr); \ register unsigned long __r6 asm ("r6") = (unsigned long) (nr); \
register unsigned long __r7 asm ("r7") = 0; \ register unsigned long __r7 asm ("r7") = 0; \
__asm __volatile (SYSCALL_WITH_INST_PAD \ __asm __volatile (SYSCALL_WITH_INST_PAD \
: "=z" (__ignore) \ : "=z" (__ignore) \
: "r" (__r3), "r" (__r4), "r" (__r5), \ : "r" (__r3), "r" (__r4), "r" (__r5), \
"r" (__r6), "r" (__r7) \ "r" (__r6), "r" (__r7) \
: "memory", "t"); \ : "memory", "t"); \
} while (0) } while (0)
@ -252,24 +252,24 @@ extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
extern int __lll_wait_tid (int *tid) attribute_hidden; extern int __lll_wait_tid (int *tid) attribute_hidden;
#define lll_wait_tid(tid) \ #define lll_wait_tid(tid) \
do { \ do { \
__typeof (tid) *__tid = &(tid); \ __typeof (tid) *__tid = &(tid); \
if (*__tid != 0) \ if (*__tid != 0) \
__lll_wait_tid (__tid); \ __lll_wait_tid (__tid); \
} while (0) } while (0)
extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime) extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
attribute_hidden; attribute_hidden;
#define lll_timedwait_tid(tid, abstime) \ #define lll_timedwait_tid(tid, abstime) \
({ \ ({ \
int __result = 0; \ int __result = 0; \
if (tid != 0) \ if (tid != 0) \
{ \ { \
if (abstime == NULL || abstime->tv_nsec >= 1000000000) \ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) \
__result = EINVAL; \ __result = EINVAL; \
else \ else \
__result = __lll_timedwait_tid (&tid, abstime); \ __result = __lll_timedwait_tid (&tid, abstime); \
} \ } \
__result; }) __result; })

View File

@ -319,7 +319,7 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
int __result = 0; \ int __result = 0; \
if (tid != 0) \ if (tid != 0) \
{ \ { \
if (abstime == NULL || abstime->tv_nsec >= 1000000000) \ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) \
__result = EINVAL; \ __result = EINVAL; \
else \ else \
__result = __lll_timedwait_tid (&tid, abstime); \ __result = __lll_timedwait_tid (&tid, abstime); \

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. /* Copyright (C) 1996, 1997, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -58,9 +58,7 @@ __wcpncpy (dest, src, n)
if (--n4 == 0) if (--n4 == 0)
goto last_chars; goto last_chars;
} }
n = n - (dest - s) - 1; n -= dest - s;
if (n == 0)
return dest;
goto zero_fill; goto zero_fill;
} }
@ -69,21 +67,22 @@ __wcpncpy (dest, src, n)
if (n == 0) if (n == 0)
return dest; return dest;
do for (;;)
{ {
c = *src++; c = *src++;
*++dest = c; --n;
if (--n == 0) *dest++ = c;
if (c == L'\0')
break;
if (n == 0)
return dest; return dest;
} }
while (c != L'\0');
zero_fill: zero_fill:
do while (n-- > 0)
*++dest = L'\0'; dest[n] = L'\0';
while (--n > 0);
return dest; return dest - 1;
} }
weak_alias (__wcpncpy, wcpncpy) weak_alias (__wcpncpy, wcpncpy)