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

	* sysdeps/unix/sysv/linux/arm/sysdep.h (INTERNAL_SYSCALL,
	INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Add err
	argument.
	(INTERNAL_SYSCALL_DECL): Define.

2003-01-06  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/ia64/sysdep.h (INTERNAL_SYSCALL,
	INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Add err
	argument.
	(INTERNAL_SYSCALL_DECL): Define.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise.
	(INLINE_SYSCALL): Adjust.
	* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
	* elf/dl-misc.c (_dl_debug_vdprintf): Add INTERNAL_SYSCALL_DECL,
	add err argument to INTERNAL_SYSCALL* macros.
	* sysdeps/unix/sysv/linux/i386/brk.c (__brk): Likewise.
	* sysdeps/unix/sysv/linux/i386/system.c (cancel_handler): Likewise.
	* sysdeps/unix/sysv/linux/m68k/brk.c (__brk): Likewise.
	* sysdeps/unix/sysv/linux/m68k/getpagesize.c  (__getpagesize):
	Likewise.
	* sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Likewise.
	* sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_sigaction): Use
	INLINE_SYSCALL instead of INTERNAL_SYSCALL and setting errno.
This commit is contained in:
Ulrich Drepper 2003-01-09 04:19:03 +00:00
parent f5bf21a780
commit 6aca81bb9d
23 changed files with 183 additions and 97 deletions

View File

@ -1,3 +1,35 @@
2003-01-08 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/arm/sysdep.h (INTERNAL_SYSCALL,
INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Add err
argument.
(INTERNAL_SYSCALL_DECL): Define.
2003-01-06 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/ia64/sysdep.h (INTERNAL_SYSCALL,
INTERNAL_SYSCALL_ERROR_P, INTERNAL_SYSCALL_ERRNO): Add err
argument.
(INTERNAL_SYSCALL_DECL): Define.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise.
(INLINE_SYSCALL): Adjust.
* sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/m68k/sysdep.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.
* elf/dl-misc.c (_dl_debug_vdprintf): Add INTERNAL_SYSCALL_DECL,
add err argument to INTERNAL_SYSCALL* macros.
* sysdeps/unix/sysv/linux/i386/brk.c (__brk): Likewise.
* sysdeps/unix/sysv/linux/i386/system.c (cancel_handler): Likewise.
* sysdeps/unix/sysv/linux/m68k/brk.c (__brk): Likewise.
* sysdeps/unix/sysv/linux/m68k/getpagesize.c (__getpagesize):
Likewise.
* sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Likewise.
* sysdeps/unix/sysv/linux/i386/sigaction.c (__libc_sigaction): Use
INLINE_SYSCALL instead of INTERNAL_SYSCALL and setting errno.
2003-01-07 Ulrich Drepper <drepper@redhat.com> 2003-01-07 Ulrich Drepper <drepper@redhat.com>
Unify symbols in user namespace exported by libc.so and libc.a. Unify symbols in user namespace exported by libc.so and libc.a.

View File

@ -248,7 +248,8 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
/* Finally write the result. */ /* Finally write the result. */
#ifdef INTERNAL_SYSCALL #ifdef INTERNAL_SYSCALL
INTERNAL_SYSCALL (writev, 3, fd, &iov, niov); INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL (writev, err, 3, fd, &iov, niov);
#elif RTLD_PRIVATE_ERRNO #elif RTLD_PRIVATE_ERRNO
/* We have to take this lock just to be sure we don't clobber the private /* We have to take this lock just to be sure we don't clobber the private
errno when it's being used by another thread that cares about it. errno when it's being used by another thread that cares about it.

View File

@ -1,3 +1,8 @@
2003-01-06 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/sigwait.c (do_sigwait): Add
INTERNAL_SYSCALL_DECL, add err argument to INTERNAL_SYSCALL* macros.
2003-01-06 Jakub Jelinek <jakub@redhat.com> 2003-01-06 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Use * sysdeps/unix/sysv/linux/alpha/sysdep-cancel.h (PSEUDO): Use

View File

@ -39,15 +39,16 @@ do_sigwait (const sigset_t *set, int *sig)
/* XXX The size argument hopefully will have to be changed to the /* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */ real size of the user-level sigset_t. */
#ifdef INTERNAL_SYSCALL #ifdef INTERNAL_SYSCALL
ret = INTERNAL_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), INTERNAL_SYSCALL_DECL (err);
ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set),
NULL, NULL, _NSIG / 8); NULL, NULL, _NSIG / 8);
if (! INTERNAL_SYSCALL_ERROR_P (ret)) if (! INTERNAL_SYSCALL_ERROR_P (ret, err))
{ {
*sig = ret; *sig = ret;
ret = 0; ret = 0;
} }
else else
ret = INTERNAL_SYSCALL_ERRNO (ret); ret = INTERNAL_SYSCALL_ERRNO (ret, err);
#else #else
ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
NULL, NULL, _NSIG / 8); NULL, NULL, _NSIG / 8);

View File

@ -1,3 +1,10 @@
2003-01-06 Jakub Jelinek <jakub@redhat.com>
* sysdeps/pthread/pthread_sigmask.c (pthread_sigmask): Add
INTERNAL_SYSCALL_DECL, add err argument to INTERNAL_SYSCALL* macros.
* sysdeps/unix/sysv/linux/raise.c (raise): Likewise.
* init.c (__pthread_initialize_minimal_internal): Likewise.
2003-01-07 Jakub Jelinek <jakub@redhat.com> 2003-01-07 Jakub Jelinek <jakub@redhat.com>
* pthreadP.h (__pthread_cond_timedwait): Add prototype. * pthreadP.h (__pthread_cond_timedwait): Add prototype.

View File

@ -172,7 +172,8 @@ __pthread_initialize_minimal_internal (void)
/* Minimal initialization of the thread descriptor. */ /* Minimal initialization of the thread descriptor. */
struct pthread *pd = THREAD_SELF; struct pthread *pd = THREAD_SELF;
pd->tid = INTERNAL_SYSCALL (set_tid_address, 1, &pd->tid); INTERNAL_SYSCALL_DECL (err);
pd->tid = INTERNAL_SYSCALL (set_tid_address, err, 1, &pd->tid);
THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]); THREAD_SETMEM (pd, specific[0], &pd->specific_1stblock[0]);
THREAD_SETMEM (pd, user_stack, true); THREAD_SETMEM (pd, user_stack, true);
if (LLL_LOCK_INITIALIZER != 0) if (LLL_LOCK_INITIALIZER != 0)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc. /* Copyright (C) 2002, 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@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -44,11 +44,12 @@ pthread_sigmask (how, newmask, oldmask)
#ifdef INTERNAL_SYSCALL #ifdef INTERNAL_SYSCALL
/* We know that realtime signals are available if NPTL is used. */ /* We know that realtime signals are available if NPTL is used. */
int result = INTERNAL_SYSCALL (rt_sigprocmask, 4, how, newmask, oldmask, INTERNAL_SYSCALL_DECL (err);
_NSIG / 8); int result = INTERNAL_SYSCALL (rt_sigprocmask, err, 4, how, newmask,
oldmask, _NSIG / 8);
return (INTERNAL_SYSCALL_ERROR_P (result) return (INTERNAL_SYSCALL_ERROR_P (result, err)
? INTERNAL_SYSCALL_ERRNO (result) ? INTERNAL_SYSCALL_ERRNO (result, err)
: 0); : 0);
#else #else
return sigprocmask (how, newmask, oldmask) == -1 ? errno : 0; return sigprocmask (how, newmask, oldmask) == -1 ? errno : 0;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc. /* Copyright (C) 2002, 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@redhat.com>, 2002. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@ -33,7 +33,8 @@ raise (sig)
{ {
/* This system call is not supposed to fail. */ /* This system call is not supposed to fail. */
#ifdef INTERNAL_SYSCALL #ifdef INTERNAL_SYSCALL
selftid = INTERNAL_SYSCALL (gettid, 0); INTERNAL_SYSCALL_DECL (err);
selftid = INTERNAL_SYSCALL (gettid, err, 0);
#else #else
selftid = INLINE_SYSCALL (gettid, 0); selftid = INLINE_SYSCALL (gettid, 0);
#endif #endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992,93,95-99,2000,02 Free Software Foundation, Inc. /* Copyright (C) 1992, 93, 1995-2000, 2002, 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>, August 1995. Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>, August 1995.
ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997. ARM changes by Philip Blundell, <pjb27@cam.ac.uk>, May 1997.
@ -146,8 +146,11 @@ __local_syscall_error: \
} \ } \
(int) _sys_result; }) (int) _sys_result; })
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \ #define INTERNAL_SYSCALL(name, err, nr, args...) \
({ unsigned int _sys_result; \ ({ unsigned int _sys_result; \
{ \ { \
register int _a1 asm ("a1"); \ register int _a1 asm ("a1"); \
@ -161,10 +164,11 @@ __local_syscall_error: \
(int) _sys_result; }) (int) _sys_result; })
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) #define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
#define LOAD_ARGS_0() #define LOAD_ARGS_0()
#define ASM_ARGS_0 #define ASM_ARGS_0

View File

@ -1,5 +1,5 @@
/* brk system call for Linux/i386. /* brk system call for Linux/i386.
Copyright (C) 1995, 1996, 2000, 2002 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -36,7 +36,9 @@ __brk (void *addr)
{ {
void *__unbounded newbrk; void *__unbounded newbrk;
newbrk = (void *__unbounded) INTERNAL_SYSCALL (brk, 1, __ptrvalue (addr)); INTERNAL_SYSCALL_DECL (err);
newbrk = (void *__unbounded) INTERNAL_SYSCALL (brk, err, 1,
__ptrvalue (addr));
__curbrk = newbrk; __curbrk = newbrk;

View File

@ -131,15 +131,12 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
k_newact.sa_restorer = &restore; k_newact.sa_restorer = &restore;
} }
result = INTERNAL_SYSCALL (sigaction, 3, sig, result = INLINE_SYSCALL (sigaction, 3, sig,
act ? __ptrvalue (&k_newact) : 0, act ? __ptrvalue (&k_newact) : 0,
oact ? __ptrvalue (&k_oldact) : 0); oact ? __ptrvalue (&k_oldact) : 0);
if (result < 0) if (result < 0)
{ return -1;
__set_errno (-result);
return -1;
}
if (oact) if (oact)
{ {

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992,93,95,96,97,98,99,2000,02 Free Software Foundation, Inc. /* Copyright (C) 1992,1993,1995-2000,2002,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.org>, August 1995. Contributed by Ulrich Drepper, <drepper@gnu.org>, August 1995.
@ -313,10 +313,10 @@ asm (".L__X'%ebx = 1\n\t"
#undef INLINE_SYSCALL #undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \ #define INLINE_SYSCALL(name, nr, args...) \
({ \ ({ \
unsigned int resultvar = INTERNAL_SYSCALL (name, nr, args); \ unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar), 0)) \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
{ \ { \
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar)); \ __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
resultvar = 0xffffffff; \ resultvar = 0xffffffff; \
} \ } \
(int) resultvar; }) (int) resultvar; })
@ -328,7 +328,7 @@ asm (".L__X'%ebx = 1\n\t"
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#ifdef I386_USE_SYSENTER #ifdef I386_USE_SYSENTER
# ifdef SHARED # ifdef SHARED
# define INTERNAL_SYSCALL(name, nr, args...) \ # define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \ ({ \
unsigned int resultvar; \ unsigned int resultvar; \
asm volatile ( \ asm volatile ( \
@ -341,7 +341,7 @@ asm (".L__X'%ebx = 1\n\t"
ASMFMT_##nr(args) : "memory", "cc"); \ ASMFMT_##nr(args) : "memory", "cc"); \
(int) resultvar; }) (int) resultvar; })
# else # else
# define INTERNAL_SYSCALL(name, nr, args...) \ # define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \ ({ \
unsigned int resultvar; \ unsigned int resultvar; \
asm volatile ( \ asm volatile ( \
@ -354,7 +354,7 @@ asm (".L__X'%ebx = 1\n\t"
(int) resultvar; }) (int) resultvar; })
# endif # endif
#else #else
# define INTERNAL_SYSCALL(name, nr, args...) \ # define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \ ({ \
unsigned int resultvar; \ unsigned int resultvar; \
asm volatile ( \ asm volatile ( \
@ -367,11 +367,15 @@ asm (".L__X'%ebx = 1\n\t"
(int) resultvar; }) (int) resultvar; })
#endif #endif
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) #define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
#define LOADARGS_0 #define LOADARGS_0
#if defined I386_USE_SYSENTER && defined SHARED #if defined I386_USE_SYSENTER && defined SHARED

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2002 Free Software Foundation, Inc. /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -56,7 +56,8 @@ cancel_handler (void *arg)
{ {
pid_t child = *(pid_t *) arg; pid_t child = *(pid_t *) arg;
INTERNAL_SYSCALL (kill, 2, child, SIGKILL); INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL (kill, err, 2, child, SIGKILL);
TEMP_FAILURE_RETRY (__waitpid (child, NULL, 0)); TEMP_FAILURE_RETRY (__waitpid (child, NULL, 0));

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. /* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999. Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
Based on code originally written by David Mosberger-Tang Based on code originally written by David Mosberger-Tang
@ -134,8 +134,11 @@
} \ } \
_retval; }) _retval; })
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) long int err
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \ #define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \ ({ \
register long _r8 asm ("r8"); \ register long _r8 asm ("r8"); \
register long _r10 asm ("r10"); \ register long _r10 asm ("r10"); \
@ -148,15 +151,14 @@
ASM_ARGS_##nr \ ASM_ARGS_##nr \
: "memory" ASM_CLOBBERS_##nr); \ : "memory" ASM_CLOBBERS_##nr); \
_retval = _r8; \ _retval = _r8; \
if (_r10 == -1) \ err = _r10; \
_retval = -_retval; \
_retval; }) _retval; })
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned long) (val) >= -4095UL) #define INTERNAL_SYSCALL_ERROR_P(val, err) (err == -1)
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val, err) (val)
#define LOAD_ARGS_0() do { } while (0) #define LOAD_ARGS_0() do { } while (0)
#define LOAD_ARGS_1(out0) \ #define LOAD_ARGS_1(out0) \

View File

@ -1,5 +1,5 @@
/* brk system call for Linux/m68k. /* brk system call for Linux/m68k.
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.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -33,7 +33,8 @@ __brk (void *addr)
{ {
void *newbrk; void *newbrk;
newbrk = (void *) INTERNAL_SYSCALL (brk, 1, addr); INTERNAL_SYSCALL_DECL (err);
newbrk = (void *) INTERNAL_SYSCALL (brk, err, 1, addr);
__curbrk = newbrk; __curbrk = newbrk;
if (newbrk < addr) if (newbrk < addr)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. /* Copyright (C) 2000, 2002, 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 Andreas Schwab <schwab@suse.de>. Contributed by Andreas Schwab <schwab@suse.de>.
@ -37,9 +37,10 @@ __getpagesize ()
return GL(dl_pagesize); return GL(dl_pagesize);
#ifdef __NR_getpagesize #ifdef __NR_getpagesize
result = INTERNAL_SYSCALL (getpagesize, 0); INTERNAL_SYSCALL_DECL (err);
result = INTERNAL_SYSCALL (getpagesize, err, 0);
/* The only possible error is ENOSYS. */ /* The only possible error is ENOSYS. */
if (!INTERNAL_SYSCALL_ERROR_P (result)) if (!INTERNAL_SYSCALL_ERROR_P (result, err))
return result; return result;
#endif #endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc. /* Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>, Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>,
December 1995. December 1995.
@ -180,20 +180,23 @@ SYSCALL_ERROR_LABEL: \
call. */ call. */
#undef INLINE_SYSCALL #undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \ #define INLINE_SYSCALL(name, nr, args...) \
({ unsigned int _sys_result = INTERNAL_SYSCALL (name, nr, args); \ ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result), 0)) \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\
{ \ { \
__set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result)); \ __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \
_sys_result = (unsigned int) -1; \ _sys_result = (unsigned int) -1; \
} \ } \
(int) _sys_result; }) (int) _sys_result; })
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
/* Define a macro which expands inline into the wrapper code for a system /* Define a macro which expands inline into the wrapper code for a system
call. This use is for internal calls that do not need to handle errors call. This use is for internal calls that do not need to handle errors
normally. It will never touch errno. This returns just what the kernel normally. It will never touch errno. This returns just what the kernel
gave back. */ gave back. */
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \ #define INTERNAL_SYSCALL(name, err, nr, args...) \
({ unsigned int _sys_result; \ ({ unsigned int _sys_result; \
{ \ { \
LOAD_ARGS_##nr (args) \ LOAD_ARGS_##nr (args) \
@ -207,10 +210,11 @@ SYSCALL_ERROR_LABEL: \
(int) _sys_result; }) (int) _sys_result; })
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= -4095U) #define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= -4095U)
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
#define LOAD_ARGS_0() #define LOAD_ARGS_0()
#define ASM_ARGS_0 #define ASM_ARGS_0

View File

@ -99,8 +99,11 @@
gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set) gave back in the non-error (CR0.SO cleared) case, otherwise (CR0.SO set)
the negation of the return value in the kernel gets reverted. */ the negation of the return value in the kernel gets reverted. */
# undef INTERNAL_SYSCALL_DECL
# define INTERNAL_SYSCALL_DECL(err) do { } while (0)
# undef INTERNAL_SYSCALL # undef INTERNAL_SYSCALL
# define INTERNAL_SYSCALL(name, nr, args...) \ # define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \ ({ \
register long r0 __asm__ ("r0"); \ register long r0 __asm__ ("r0"); \
register long r3 __asm__ ("r3"); \ register long r3 __asm__ ("r3"); \
@ -128,10 +131,11 @@
}) })
# undef INTERNAL_SYSCALL_ERROR_P # undef INTERNAL_SYSCALL_ERROR_P
# define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned long) (val) >= 0xfffff001u) # define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned long) (val) >= 0xfffff001u)
# undef INTERNAL_SYSCALL_ERRNO # undef INTERNAL_SYSCALL_ERRNO
# define INTERNAL_SYSCALL_ERRNO(val) (-(val)) # define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
# define LOADARGS_0(name, dummy) \ # define LOADARGS_0(name, dummy) \
r0 = __NR_##name r0 = __NR_##name

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000,01,02 Free Software Foundation, Inc. /* Copyright (C) 2000,01,02,03 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -121,33 +121,37 @@
#undef INLINE_SYSCALL #undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \ #define INLINE_SYSCALL(name, nr, args...) \
({ \ ({ \
unsigned int err = INTERNAL_SYSCALL (name, nr, args); \ unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args); \
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (err), 0)) \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_ret, ), 0)) \
{ \ { \
__set_errno (INTERNAL_SYSCALL_ERRNO (err)); \ __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
err = 0xffffffff; \ _ret = 0xffffffff; \
} \ } \
(int) err; }) (int) _ret; })
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \ #define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \ ({ \
DECLARGS_##nr(args) \ DECLARGS_##nr(args) \
int err; \ int _ret; \
asm volatile ( \ asm volatile ( \
LOADARGS_##nr \ LOADARGS_##nr \
"svc %b1\n\t" \ "svc %b1\n\t" \
"lr %0,%%r2\n\t" \ "lr %0,%%r2\n\t" \
: "=d" (err) \ : "=d" (_ret) \
: "I" (__NR_##name) ASMFMT_##nr \ : "I" (__NR_##name) ASMFMT_##nr \
: "memory", "cc", "2", "3", "4", "5", "6"); \ : "memory", "cc", "2", "3", "4", "5", "6"); \
(int) err; }) (int) _ret; })
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) #define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
#define DECLARGS_0() #define DECLARGS_0()
#define DECLARGS_1(arg1) \ #define DECLARGS_1(arg1) \

View File

@ -115,33 +115,37 @@
#undef INLINE_SYSCALL #undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \ #define INLINE_SYSCALL(name, nr, args...) \
({ \ ({ \
unsigned int err = INTERNAL_SYSCALL (name, nr, args); \ unsigned int _ret = INTERNAL_SYSCALL (name, , nr, args); \
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (err), 0)) \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_ret, ), 0)) \
{ \ { \
__set_errno (INTERNAL_SYSCALL_ERRNO (err)); \ __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \
err = -1; \ _ret = -1; \
} \ } \
(int) err; }) (int) _ret; })
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \ #define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \ ({ \
DECLARGS_##nr(args) \ DECLARGS_##nr(args) \
int err; \ int _ret; \
asm volatile ( \ asm volatile ( \
LOADARGS_##nr \ LOADARGS_##nr \
"svc %b1\n\t" \ "svc %b1\n\t" \
"lgr %0,%%r2\n\t" \ "lgr %0,%%r2\n\t" \
: "=d" (err) \ : "=d" (_ret) \
: "I" (__NR_##name) ASMFMT_##nr \ : "I" (__NR_##name) ASMFMT_##nr \
: "memory", "cc", "2", "3", "4", "5", "6"); \ : "memory", "cc", "2", "3", "4", "5", "6"); \
(int) err; }) (int) _ret; })
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned int) (val) >= 0xfffff001u) #define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned int) (val) >= 0xfffff001u)
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
#define DECLARGS_0() #define DECLARGS_0()
#define DECLARGS_1(arg1) \ #define DECLARGS_1(arg1) \

View File

@ -39,15 +39,16 @@ do_sigwait (const sigset_t *set, int *sig)
/* XXX The size argument hopefully will have to be changed to the /* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */ real size of the user-level sigset_t. */
#ifdef INTERNAL_SYSCALL #ifdef INTERNAL_SYSCALL
ret = INTERNAL_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), INTERNAL_SYSCALL_DECL (err);
ret = INTERNAL_SYSCALL (rt_sigtimedwait, err, 4, CHECK_SIGSET (set),
NULL, NULL, _NSIG / 8); NULL, NULL, _NSIG / 8);
if (! INTERNAL_SYSCALL_ERROR_P (ret)) if (! INTERNAL_SYSCALL_ERROR_P (ret, err))
{ {
*sig = ret; *sig = ret;
ret = 0; ret = 0;
} }
else else
ret = INTERNAL_SYSCALL_ERRNO (ret); ret = INTERNAL_SYSCALL_ERRNO (ret, err);
#else #else
ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set),
NULL, NULL, _NSIG / 8); NULL, NULL, _NSIG / 8);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. /* Copyright (C) 2000, 2002, 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 Jakub Jelinek <jakub@redhat.com>, 2000. Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
@ -24,15 +24,19 @@
#define INLINE_SYSCALL(name, nr, args...) \ #define INLINE_SYSCALL(name, nr, args...) \
inline_syscall##nr(__SYSCALL_STRING, name, args) inline_syscall##nr(__SYSCALL_STRING, name, args)
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \ #define INTERNAL_SYSCALL(name, err, nr, args...) \
inline_syscall##nr(__INTERNAL_SYSCALL_STRING, name, args) inline_syscall##nr(__INTERNAL_SYSCALL_STRING, name, args)
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned long) (val) >= -515L) #define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned long) (val) >= -515L)
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
#define inline_syscall0(string,name,dummy...) \ #define inline_syscall0(string,name,dummy...) \
({ \ ({ \

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2001,02 Free Software Foundation, Inc. /* Copyright (C) 2001,02,03 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -186,16 +186,19 @@
#undef INLINE_SYSCALL #undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \ #define INLINE_SYSCALL(name, nr, args...) \
({ \ ({ \
unsigned long resultvar = INTERNAL_SYSCALL (name, nr, args); \ unsigned long resultvar = INTERNAL_SYSCALL (name, , nr, args); \
if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar), 0)) \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \
{ \ { \
__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar)); \ __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \
resultvar = (unsigned long) -1; \ resultvar = (unsigned long) -1; \
} \ } \
(long) resultvar; }) (long) resultvar; })
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
#undef INTERNAL_SYSCALL #undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, nr, args...) \ #define INTERNAL_SYSCALL(name, err, nr, args...) \
({ \ ({ \
unsigned long resultvar; \ unsigned long resultvar; \
LOAD_ARGS_##nr (args) \ LOAD_ARGS_##nr (args) \
@ -207,10 +210,11 @@
(long) resultvar; }) (long) resultvar; })
#undef INTERNAL_SYSCALL_ERROR_P #undef INTERNAL_SYSCALL_ERROR_P
#define INTERNAL_SYSCALL_ERROR_P(val) ((unsigned long) (val) >= -4095L) #define INTERNAL_SYSCALL_ERROR_P(val, err) \
((unsigned long) (val) >= -4095L)
#undef INTERNAL_SYSCALL_ERRNO #undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val) (-(val)) #define INTERNAL_SYSCALL_ERRNO(val, err) (-(val))
#define LOAD_ARGS_0() #define LOAD_ARGS_0()
#define ASM_ARGS_0 #define ASM_ARGS_0