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>
* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h (SA_NOCLDWAIT): Define.

View file

@ -82,6 +82,8 @@ distribute := rtld-Rules \
tst-array2dep.c \
check-textrel.c dl-sysdep.h
CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
include ../Makeconfig
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
@code{wcpncpy} copies just the first @var{size} wide characters and
returns a pointer to the wide character directly following the one which
was copied last. Note that in this case there is no null terminator
written into @var{wto}.
returns a pointer to the wide character directly following the last
non-null wide character which was copied last. Note that in this case
there is no null terminator written into @var{wto}.
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

View file

@ -12,6 +12,10 @@
Likewise.
* sysdeps/unix/sysv/linux/s390/sem_timedwait.c (sem_timedwait):
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.
* tst-sem8.c: New file.

View file

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

View file

@ -319,7 +319,7 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime)
int __result = 0; \
if (tid != 0) \
{ \
if (abstime == NULL || abstime->tv_nsec >= 1000000000) \
if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) \
__result = EINVAL; \
else \
__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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
@ -58,9 +58,7 @@ __wcpncpy (dest, src, n)
if (--n4 == 0)
goto last_chars;
}
n = n - (dest - s) - 1;
if (n == 0)
return dest;
n -= dest - s;
goto zero_fill;
}
@ -69,21 +67,22 @@ __wcpncpy (dest, src, n)
if (n == 0)
return dest;
do
for (;;)
{
c = *src++;
*++dest = c;
if (--n == 0)
--n;
*dest++ = c;
if (c == L'\0')
break;
if (n == 0)
return dest;
}
while (c != L'\0');
zero_fill:
do
*++dest = L'\0';
while (--n > 0);
while (n-- > 0)
dest[n] = L'\0';
return dest;
return dest - 1;
}
weak_alias (__wcpncpy, wcpncpy)