From patchwork Mon Feb 10 19:20:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 183262 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp4418706ile; Mon, 10 Feb 2020 11:23:18 -0800 (PST) X-Google-Smtp-Source: APXvYqwTAQHU8k07ICZ9AOz/FkIaDzud+d5dKNlLk1sKHm/FMu881o4qdV/zKcgCeH2JPX0VRS3D X-Received: by 2002:a9d:6289:: with SMTP id x9mr2268619otk.8.1581362598416; Mon, 10 Feb 2020 11:23:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581362598; cv=none; d=google.com; s=arc-20160816; b=GUY8WbgpFSDA1SpLlY6rlgNOMBj4I6GzZ3jHQ8FRl/g68DPYfXKP69gvBLydWqc3YU KlxbREsvnM/WsvKScZjtYwlC65L28ulfRZzhg47HniQxQVcXagTZAmhkOBtlo/aqYkEs ew1NwzBQrod+JOUghPIebiqDbFXGd9b/PJUSbKXTaCt4TPNxve33R4hi3uMMXDTuPYMK zmJm226BKLW7LcVs+KvGZnH0fjegMv9k0RgCHk8mhc3OkwXJaQ248+BGS2aw7s89x/SP lwC8XFc0nNW0MTZvBNxmL+zRTJX32U1UzPST8m2G5q5MtvrjvzkJ65iwsKFsCqWch+tZ 04+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=YV99MR1OXuiP+poOM7j7QPjB2FAKTksjn7eeOdQLfOM=; b=CoyzIwppghkcymh9YFqXAvNtiw47Bl2vAz/4Sn7+xw1LOce/fIBRxLBjN/p682WbVA crhx+imjU59VzAJi+gMs8QxlW0SxiEsghnRyDc70EsRLOLPiPuwKnhx9itnm3Lr4u2Jq H3OMl3eMCV6ig0Zbc+AsPqH8JY4LA3ToXWvIRwIGI4tcvE0jNJyCIEn6QBbt58BTmPux NmfcMD9MAjlvacqg2Td/pHJdXNuKzPMQI+8PIVpOHDmk1L6a5irbnMMaMytfKeQv3E8s Qtx+kDarQ4rZJb82XcEkN/8qV1ObUN2JVbKn2jesz4a/uNxElYgLKemQ1e8oFhsgJZv3 q/nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=QtxRMoBx; dkim=pass header.i=@linaro.org header.s=google header.b=UuSHdMgy; spf=pass (google.com: domain of libc-alpha-return-109399-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109399-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id u8si639150otq.262.2020.02.10.11.23.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Feb 2020 11:23:18 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-109399-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=QtxRMoBx; dkim=pass header.i=@linaro.org header.s=google header.b=UuSHdMgy; spf=pass (google.com: domain of libc-alpha-return-109399-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-109399-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=FE4WS9MS3qXM7LS7a/gYtOhOUXBCYtT wXCtPm5rVesxSv1BPaOzE9/1AbIKgEAj8eARxTKVftGGFLQbeYHFyAGUft00z596 Crw6c86UG+uA+ug8WaSYUaWqYjW4Ul+sv7FSSaL79OpJAJOfo1xooZw7xrAi6P0w 51bxiLL8ad4I= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:in-reply-to :references; s=default; bh=/KjukjtV+2ctRZH1DHqagAlP0Ms=; b=QtxRM oBx3kTU926j5OIt18zuqOsHFEO74nmQKILplmA40XesMc4C6VX3WgP6m98OiTwT2 zDd7zzCwryKogHQWuCIZY+kUVq2G5p/ab4Z0cKG+Q+0iEAhfCLacuNTCuPfklXdD 2CWggiCVr9wq/QQIJYqF0GZY9vX8NyooJfX4r4= Received: (qmail 101891 invoked by alias); 10 Feb 2020 19:21:09 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 101824 invoked by uid 89); 10 Feb 2020 19:21:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=4.5 X-HELO: mail-qk1-f196.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=YV99MR1OXuiP+poOM7j7QPjB2FAKTksjn7eeOdQLfOM=; b=UuSHdMgypFAIb6bzMAo9spgvYn9oVx3kY/FxbZTUDfFQyX8yPW7MgyEvwT3sZSqHID njR7fbmM/6S6bek4QVMJYXfEx7G8infK212odZ9bKMOXiVx1bRws3h6gBKCAYKKs8L0w IA5GHuR5Kocy4taV644Cb1aIftDmPsEaJNh62fWIDaPLhtEggGZWF0HsvuZOUyIxsgL9 AlEkETJfJEPXqyON0Z0ALnMdwVnRtciBEfVKPX1qV1hgHCmh9XB+D6wc1pfiYY7VyTg9 YNfncAUjUyvcwM9VHTwMfoYG7TrKjCgC+cDtzFGCW/twhsuJzwMCWjdKMaDNvmzBttTA c9Cw== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 13/15] linux: Consolidate INLINE_SYSCALL Date: Mon, 10 Feb 2020 16:20:36 -0300 Message-Id: <20200210192038.23588-13-adhemerval.zanella@linaro.org> In-Reply-To: <20200210192038.23588-1-adhemerval.zanella@linaro.org> References: <20200210192038.23588-1-adhemerval.zanella@linaro.org> With all Linux ABIs using the expected Linux kABI to indicate syscalls errors, there is no need to replicate the INLINE_SYSCALL. The generic Linux sysdep.h includes errno.h even for !__ASSEMBLER__, which is ok now and it allows cleanup some archaic code that assume otherwise. Checked with a build against all affected ABIs. --- sysdeps/i386/pthread_spin_trylock.S | 2 +- sysdeps/mips/nptl/tls.h | 2 +- sysdeps/sh/nptl/pthread_spin_trylock.S | 2 +- sysdeps/sparc/sparc32/pthread_spin_trylock.S | 2 +- sysdeps/sparc/sparc64/pthread_spin_trylock.S | 2 +- sysdeps/unix/arm/sysdep.S | 3 +- sysdeps/unix/mips/sysdep.S | 3 +- sysdeps/unix/sh/sysdep.S | 3 +- sysdeps/unix/sysv/linux/aarch64/sysdep.h | 22 ---------- sysdeps/unix/sysv/linux/alpha/brk.S | 3 +- sysdeps/unix/sysv/linux/alpha/sysdep.h | 24 ----------- sysdeps/unix/sysv/linux/arm/sysdep.h | 27 ------------- sysdeps/unix/sysv/linux/csky/sysdep.h | 22 ---------- sysdeps/unix/sysv/linux/hppa/sysdep.h | 30 -------------- sysdeps/unix/sysv/linux/i386/sysdep.h | 40 +------------------ sysdeps/unix/sysv/linux/ia64/sysdep.h | 20 ---------- sysdeps/unix/sysv/linux/m68k/sysdep.h | 22 ---------- sysdeps/unix/sysv/linux/microblaze/sysdep.h | 24 ----------- sysdeps/unix/sysv/linux/mips/mips32/sysdep.h | 28 ------------- sysdeps/unix/sysv/linux/mips/mips64/sysdep.h | 28 ------------- sysdeps/unix/sysv/linux/nios2/sysdep.h | 24 +---------- sysdeps/unix/sysv/linux/powerpc/sysdep.h | 30 -------------- sysdeps/unix/sysv/linux/riscv/sysdep.h | 20 ---------- sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h | 5 --- sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 5 --- sysdeps/unix/sysv/linux/s390/sysdep.h | 21 ---------- sysdeps/unix/sysv/linux/sh/sysdep.h | 21 ---------- sysdeps/unix/sysv/linux/sparc/sparc64/brk.S | 3 +- sysdeps/unix/sysv/linux/sparc/sysdep.h | 22 ---------- sysdeps/unix/sysv/linux/sysdep.h | 40 +++++++++++++++++++ sysdeps/unix/sysv/linux/x86_64/sysdep.h | 35 ---------------- sysdeps/unix/x86_64/sysdep.S | 3 +- sysdeps/x86_64/nptl/pthread_spin_trylock.S | 2 +- 33 files changed, 54 insertions(+), 486 deletions(-) -- 2.17.1 diff --git a/sysdeps/i386/pthread_spin_trylock.S b/sysdeps/i386/pthread_spin_trylock.S index 949879c603..8edb676381 100644 --- a/sysdeps/i386/pthread_spin_trylock.S +++ b/sysdeps/i386/pthread_spin_trylock.S @@ -17,7 +17,7 @@ . */ #include -#include +#include #ifdef UP diff --git a/sysdeps/mips/nptl/tls.h b/sysdeps/mips/nptl/tls.h index ba0efe8af6..ae85984f95 100644 --- a/sysdeps/mips/nptl/tls.h +++ b/sysdeps/mips/nptl/tls.h @@ -35,7 +35,7 @@ # define READ_THREAD_POINTER() (__builtin_thread_pointer ()) #else /* Note: rd must be $v1 to be ABI-conformant. */ -# if __mips_isa_rev >= 2 +# if defined (__mips_isa_rev) && __mips_isa_rev >= 2 # define READ_THREAD_POINTER() \ ({ void *__result; \ asm volatile ("rdhwr\t%0, $29" : "=v" (__result)); \ diff --git a/sysdeps/sh/nptl/pthread_spin_trylock.S b/sysdeps/sh/nptl/pthread_spin_trylock.S index c8c453ca9f..142908cf32 100644 --- a/sysdeps/sh/nptl/pthread_spin_trylock.S +++ b/sysdeps/sh/nptl/pthread_spin_trylock.S @@ -15,7 +15,7 @@ License along with the GNU C Library; if not, see . */ -#include +#include .globl pthread_spin_trylock .type pthread_spin_trylock,@function diff --git a/sysdeps/sparc/sparc32/pthread_spin_trylock.S b/sysdeps/sparc/sparc32/pthread_spin_trylock.S index bd31fad711..4b992e78bf 100644 --- a/sysdeps/sparc/sparc32/pthread_spin_trylock.S +++ b/sysdeps/sparc/sparc32/pthread_spin_trylock.S @@ -16,7 +16,7 @@ . */ #include -#include +#include .text ENTRY(pthread_spin_trylock) diff --git a/sysdeps/sparc/sparc64/pthread_spin_trylock.S b/sysdeps/sparc/sparc64/pthread_spin_trylock.S index fd33946aec..b6cfa52b51 100644 --- a/sysdeps/sparc/sparc64/pthread_spin_trylock.S +++ b/sysdeps/sparc/sparc64/pthread_spin_trylock.S @@ -16,7 +16,7 @@ . */ #include -#include +#include .text ENTRY(pthread_spin_trylock) diff --git a/sysdeps/unix/arm/sysdep.S b/sysdeps/unix/arm/sysdep.S index 514937bd4b..5c9022a869 100644 --- a/sysdeps/unix/arm/sysdep.S +++ b/sysdeps/unix/arm/sysdep.S @@ -16,8 +16,7 @@ . */ #include -#define _ERRNO_H -#include +#include #if IS_IN (rtld) # include /* Defines RTLD_PRIVATE_ERRNO. */ diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S index fca1091cda..744d1620b3 100644 --- a/sysdeps/unix/mips/sysdep.S +++ b/sysdeps/unix/mips/sysdep.S @@ -17,8 +17,7 @@ . */ #include -#define _ERRNO_H -#include +#include #include .set nomips16 diff --git a/sysdeps/unix/sh/sysdep.S b/sysdeps/unix/sh/sysdep.S index 7facc028d6..dc9a230ee0 100644 --- a/sysdeps/unix/sh/sysdep.S +++ b/sysdeps/unix/sh/sysdep.S @@ -16,8 +16,7 @@ . */ #include -#define _ERRNO_H -#include +#include ENTRY(__syscall_error) #if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h index 00b8e241c8..79fa0bda27 100644 --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h @@ -170,21 +170,6 @@ # define SINGLE_THREAD_BY_GLOBAL 1 -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned long) -1; \ - } \ - (long) _sys_result; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - # undef INTERNAL_SYSCALL_RAW # define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ ({ long _sys_result; \ @@ -205,13 +190,6 @@ # define INTERNAL_SYSCALL_AARCH64(name, err, nr, args...) \ INTERNAL_SYSCALL_RAW(__ARM_NR_##name, err, nr, args) -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - # define LOAD_ARGS_0() \ register long _x0 asm ("x0"); # define LOAD_ARGS_1(x0) \ diff --git a/sysdeps/unix/sysv/linux/alpha/brk.S b/sysdeps/unix/sysv/linux/alpha/brk.S index 45ecbbea1b..5596b346d8 100644 --- a/sysdeps/unix/sysv/linux/alpha/brk.S +++ b/sysdeps/unix/sysv/linux/alpha/brk.S @@ -21,8 +21,7 @@ break value (instead of the new, requested one). */ #include -#define _ERRNO_H -#include +#include #ifdef PIC .section .bss diff --git a/sysdeps/unix/sysv/linux/alpha/sysdep.h b/sysdeps/unix/sysv/linux/alpha/sysdep.h index ca0b4e475c..679d6169de 100644 --- a/sysdeps/unix/sysv/linux/alpha/sysdep.h +++ b/sysdeps/unix/sysv/linux/alpha/sysdep.h @@ -169,42 +169,18 @@ __LABEL(name) \ #else /* !ASSEMBLER */ -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#include - -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ -({ \ - INTERNAL_SYSCALL_DECL (_sc_err); \ - long int _sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (_sc_ret, _sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sc_ret, _sc_err)); \ - _sc_ret = -1L; \ - } \ - _sc_ret; \ -}) - #define INTERNAL_SYSCALL(name, err_out, nr, args...) \ internal_syscall##nr(__NR_##name, args) #define INTERNAL_SYSCALL_NCS(name, err_out, nr, args...) \ internal_syscall##nr(name, args) -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - /* The normal Alpha calling convention sign-extends 32-bit quantties no matter what the "real" sign of the 32-bit type. We want to preserve that when filling in values for the kernel. */ #define syscall_promote(arg) \ (sizeof (arg) == 4 ? (long)(int)(long)(arg) : (long)(arg)) -/* Make sure and "use" the variable that we're not returning, - in order to suppress unused variable warnings. */ -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define internal_syscall_clobbers \ "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ "$22", "$23", "$24", "$25", "$27", "$28", "memory" diff --git a/sysdeps/unix/sysv/linux/arm/sysdep.h b/sysdeps/unix/sysv/linux/arm/sysdep.h index 0c5f498583..f6e6b63959 100644 --- a/sysdeps/unix/sysv/linux/arm/sysdep.h +++ b/sysdeps/unix/sysv/linux/arm/sysdep.h @@ -29,11 +29,6 @@ #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -317,21 +312,6 @@ __local_syscall_error: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ - } \ - (int) _sys_result; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #if defined(__thumb__) /* We can not expose the use of r7 to the compiler. GCC (as of 4.5) uses r7 as the hard frame pointer for Thumb - although @@ -377,13 +357,6 @@ __local_syscall_error: \ #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_RAW(SYS_ify(name), err, nr, args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define VDSO_NAME "LINUX_2.6" #define VDSO_HASH 61765110 diff --git a/sysdeps/unix/sysv/linux/csky/sysdep.h b/sysdeps/unix/sysv/linux/csky/sysdep.h index fa1dbd6614..7ebb19dce8 100644 --- a/sysdeps/unix/sysv/linux/csky/sysdep.h +++ b/sysdeps/unix/sysv/linux/csky/sysdep.h @@ -293,28 +293,6 @@ __local_syscall_error: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result,), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ - } \ - (int) _sys_result; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xffffff01u) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - # undef INTERNAL_SYSCALL_RAW # define INTERNAL_SYSCALL_RAW0(name, err, dummy...) \ ({unsigned int __sys_result; \ diff --git a/sysdeps/unix/sysv/linux/hppa/sysdep.h b/sysdeps/unix/sysv/linux/hppa/sysdep.h index 6c34189eca..88e368db4d 100644 --- a/sysdeps/unix/sysv/linux/hppa/sysdep.h +++ b/sysdeps/unix/sysv/linux/hppa/sysdep.h @@ -360,36 +360,6 @@ L(pre_end): ASM_LINE_SEP \ #define CALL_CLOB_REGS "%r1", "%r2", CLOB_TREG \ "%r20", "%r29", "%r31" -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ -({ \ - long __sys_res = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_res, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_res, )); \ - __sys_res = -1; \ - } \ - __sys_res; \ -}) - -/* INTERNAL_SYSCALL_DECL - Allows us to setup some function static - value to use within the context of the syscall - INTERNAL_SYSCALL_ERROR_P - Returns 0 if it wasn't an error, 1 otherwise - You are allowed to use the syscall result (val) and the DECL error - variable to determine what went wrong. - INTERLAL_SYSCALL_ERRNO - Munges the val/err pair into the error number. - In our case we just flip the sign. */ - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((val < 0) && (val > -4095)) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - /* Similar to INLINE_SYSCALL but we don't set errno */ #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index 4aa7bb496a..d975683749 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -67,6 +67,7 @@ /* We don't want the label for the error handle to be global when we define it here. */ +#undef SYSCALL_ERROR_LABEL #define SYSCALL_ERROR_LABEL __syscall_error #undef PSEUDO @@ -280,35 +281,6 @@ struct libc_do_syscall_args }; #endif -/* Define a macro which expands inline into the wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#if IS_IN (libc) -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, )) \ - ? __syscall_error (-INTERNAL_SYSCALL_ERRNO (resultvar, )) \ - : (int) resultvar; }) -#else -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = 0xffffffff; \ - } \ - (int) resultvar; }) -#endif - -/* Set error number and return -1. Return the internal function, - __syscall_error, which sets errno from the negative error number - and returns -1, to avoid PIC. */ -#undef INLINE_SYSCALL_ERROR_RETURN_VALUE -#define INLINE_SYSCALL_ERROR_RETURN_VALUE(resultvar) \ - __syscall_error (-(resultvar)) - # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 @@ -490,16 +462,6 @@ struct libc_do_syscall_args # endif /* GCC 5 */ #endif -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define LOADARGS_0 #ifdef __PIC__ # if I386_USE_SYSENTER && defined PIC diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index 729bfadad0..fab8ca2359 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -231,29 +231,9 @@ #endif /* !IA64_USE_NEW_STUB */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned long _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned long) -1; \ - } \ - (long) _sys_result; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define LOAD_ARGS_0() #define LOAD_REGS_0 #define LOAD_ARGS_1(a1) \ diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h index 5cd35fffcf..f6793d34fa 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -221,21 +221,6 @@ SYSCALL_ERROR_LABEL: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ unsigned int _sys_result = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_sys_result, ), 0))\ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_sys_result, )); \ - _sys_result = (unsigned int) -1; \ - } \ - (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 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 @@ -260,13 +245,6 @@ SYSCALL_ERROR_LABEL: \ #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= -4095U) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define LOAD_ARGS_0() #define LOAD_REGS_0 #define ASM_ARGS_0 diff --git a/sysdeps/unix/sysv/linux/microblaze/sysdep.h b/sysdeps/unix/sysv/linux/microblaze/sysdep.h index b4a6ee89f1..6eeae33df5 100644 --- a/sysdeps/unix/sysv/linux/microblaze/sysdep.h +++ b/sysdeps/unix/sysv/linux/microblaze/sysdep.h @@ -163,23 +163,6 @@ SYSCALL_ERROR_LABEL_DCL: \ #else /* not __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ -({ INTERNAL_SYSCALL_DECL(err); \ - unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ - resultvar = (unsigned long) -1; \ - } \ - (long) resultvar; \ -}) - -# 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 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 @@ -192,13 +175,6 @@ SYSCALL_ERROR_LABEL_DCL: \ # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ inline_syscall##nr(name, args) -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= -4095U) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - # define SYSCALL_CLOBBERS_6 "r11", "r4", "memory" # define SYSCALL_CLOBBERS_5 "r10", SYSCALL_CLOBBERS_6 # define SYSCALL_CLOBBERS_4 "r9", SYSCALL_CLOBBERS_5 diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h index 6842ff5211..75d483c59b 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips32/sysdep.h @@ -25,11 +25,6 @@ #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -47,29 +42,6 @@ #else /* ! __ASSEMBLER__ */ -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (_sc_err); \ - long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \ - result_var = -1L; \ - } \ - result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the syscall number. Then if a restart triggered, $v0 would have been diff --git a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h index 072016f07e..03873ce2c2 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h +++ b/sysdeps/unix/sysv/linux/mips/mips64/sysdep.h @@ -25,11 +25,6 @@ #include -/* In order to get __set_errno() definition in INLINE_SYSCALL. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax @@ -55,29 +50,6 @@ typedef long long int __syscall_arg_t; typedef long int __syscall_arg_t; #endif -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (_sc_err); \ - long result_var = INTERNAL_SYSCALL (name, _sc_err, nr, args); \ - if ( INTERNAL_SYSCALL_ERROR_P (result_var, _sc_err) ) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (result_var, _sc_err)); \ - result_var = -1L; \ - } \ - result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - /* Note that the original Linux syscall restart convention required the instruction immediately preceding SYSCALL to initialize $v0 with the syscall number. Then if a restart triggered, $v0 would have been diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h index eab888df32..45ef817ab5 100644 --- a/sysdeps/unix/sysv/linux/nios2/sysdep.h +++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h @@ -37,6 +37,7 @@ #ifdef __ASSEMBLER__ +#undef SYSCALL_ERROR_LABEL #define SYSCALL_ERROR_LABEL __local_syscall_error #undef PSEUDO @@ -143,29 +144,6 @@ which lead in a non existent __send symbol in libc.so. */ # undef HAVE_INTERNAL_SEND_SYMBOL -/* Define a macro which expands into the inline wrapper code for a system - call. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL(err); \ - unsigned int 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; \ - } \ - (int) result_var; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #undef INTERNAL_SYSCALL_RAW #define INTERNAL_SYSCALL_RAW(name, err, nr, args...) \ ({ unsigned int _sys_result; \ diff --git a/sysdeps/unix/sysv/linux/powerpc/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/sysdep.h index abdcfd4a63..92503ee20f 100644 --- a/sysdeps/unix/sysv/linux/powerpc/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/sysdep.h @@ -67,26 +67,6 @@ #define INTERNAL_VSYSCALL_CALL(funcptr, err, nr, args...) \ INTERNAL_VSYSCALL_CALL_TYPE(funcptr, err, long int, nr, args) -/* This version is for kernels that implement system calls that - behave like function calls as far as register saving. */ -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - INTERNAL_SYSCALL_DECL (sc_err); \ - long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ - if (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)); \ - sc_ret = -1L; \ - } \ - sc_ret; \ - }) - -/* 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 - normally. It will never touch errno. This returns just what the kernel - 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. */ #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ @@ -114,16 +94,6 @@ #define INTERNAL_SYSCALL(name, err, nr, args...) \ INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, args) -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #if defined(__PPC64__) || defined(__powerpc64__) # define SYSCALL_ARG_SIZE 8 #else diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 2bd9b16f32..e46160f3f6 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -130,26 +130,6 @@ # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" # define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" -/* Define a macro which expands into the inline wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ INTERNAL_SYSCALL_DECL (err); \ - long int __sys_result = INTERNAL_SYSCALL (name, err, nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (__sys_result, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (__sys_result, )); \ - __sys_result = (unsigned long) -1; \ - } \ - __sys_result; }) - -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long int) (val) > -4096UL) - -# define INTERNAL_SYSCALL_ERRNO(val, err) (-val) - # define INTERNAL_SYSCALL(name, err, nr, args...) \ internal_syscall##nr (SYS_ify (name), err, args) diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h index 520c9356c6..7d31abbb6f 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h @@ -26,11 +26,6 @@ #include /* For RTLD_PRIVATE_ERRNO. */ #include -/* Define __set_errno() for INLINE_SYSCALL macro below. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h index 623059135e..aba3999315 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h @@ -27,11 +27,6 @@ #include /* For RTLD_PRIVATE_ERRNO. */ #include -/* Define __set_errno() for INLINE_SYSCALL macro below. */ -#ifndef __ASSEMBLER__ -#include -#endif - /* For Linux we can use the system call table in the header file /usr/include/asm/unistd.h of the kernel. But these symbols do not follow the SYS_* syntax diff --git a/sysdeps/unix/sysv/linux/s390/sysdep.h b/sysdeps/unix/sysv/linux/s390/sysdep.h index 1df0462cc4..3802e07277 100644 --- a/sysdeps/unix/sysv/linux/s390/sysdep.h +++ b/sysdeps/unix/sysv/linux/s390/sysdep.h @@ -21,20 +21,6 @@ #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - long _ret = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (_ret, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (_ret, )); \ - _ret = -1; \ - } \ - _ret; }) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #undef INTERNAL_SYSCALL_DIRECT #define INTERNAL_SYSCALL_DIRECT(name, err, nr, args...) \ ({ \ @@ -79,13 +65,6 @@ ? INTERNAL_SYSCALL_DIRECT(name, nr, args) \ : INTERNAL_SYSCALL_SVC0(name, nr, args)) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= -4095UL) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define DECLARGS_0() #define DECLARGS_1(arg1) \ register unsigned long gpr2 __asm__ ("2") = (unsigned long)(arg1); diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h index 703b042f4f..c0e52af65a 100644 --- a/sysdeps/unix/sysv/linux/sh/sysdep.h +++ b/sysdeps/unix/sysv/linux/sh/sysdep.h @@ -287,17 +287,6 @@ register long int r1 asm ("%r1") = (long int) (_arg6); \ register long int r2 asm ("%r2") = (long int) (_arg7) -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = 0xffffffff; \ - } \ - (int) resultvar; }) - #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ ({ \ @@ -326,16 +315,6 @@ \ (int) resultvar; }) -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned int) (val) >= 0xfffff001u) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #endif /* __ASSEMBLER__ */ /* Pointer mangling support. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S index 0bcd882532..471da3d268 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S @@ -21,8 +21,7 @@ break value (instead of the new, requested one). */ #include -#define _ERRNO_H -#include +#include #ifdef PIC .section .bss diff --git a/sysdeps/unix/sysv/linux/sparc/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sysdep.h index e2a12349a1..46f4e06844 100644 --- a/sysdeps/unix/sysv/linux/sparc/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sysdep.h @@ -45,21 +45,6 @@ # endif # define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" -#undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ -({ INTERNAL_SYSCALL_DECL(err); \ - unsigned long resultvar = INTERNAL_SYSCALL(name, err, nr, args);\ - if (INTERNAL_SYSCALL_ERROR_P (resultvar, err)) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, err)); \ - resultvar = (unsigned long) -1; \ - } \ - (long) resultvar; \ -}) - -#undef INTERNAL_SYSCALL_DECL -#define INTERNAL_SYSCALL_DECL(err) do { } while (0) - #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL(name, err, nr, args...) \ internal_syscall##nr(__SYSCALL_STRING, err, __NR_##name, args) @@ -68,13 +53,6 @@ #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ internal_syscall##nr(__SYSCALL_STRING, err, name, args) -#undef INTERNAL_SYSCALL_ERROR_P -#define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long) (val) >= (unsigned long) -4095) - -#undef INTERNAL_SYSCALL_ERRNO -#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) - #define internal_syscall0(string,err,name,dummy...) \ ({ \ register long __err __asm__("g1") = (name); \ diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h index c7f3e54d37..389c94cfda 100644 --- a/sysdeps/unix/sysv/linux/sysdep.h +++ b/sysdeps/unix/sysv/linux/sysdep.h @@ -15,8 +15,44 @@ License along with the GNU C Library; if not, see . */ +#ifndef _SYSDEP_LINUX_H +#define _SYSDEP_LINUX_H + #include #include +#include + +#ifndef __ASSEMBLER__ + +#undef INTERNAL_SYSCALL_DECL +#define INTERNAL_SYSCALL_DECL(err) do { } while (0) + +#undef INTERNAL_SYSCALL_ERROR_P +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned long) (val) > -4096UL) + +#ifndef SYSCALL_ERROR_LABEL +# define SYSCALL_ERROR_LABEL(sc_err) \ + ({ \ + __set_errno (sc_err); \ + -1L; \ + }) +#endif + +/* This version is for kernels that implement system calls that + behave like function calls as far as register saving. */ +#undef INLINE_SYSCALL +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + INTERNAL_SYSCALL_DECL (sc_err); \ + long int sc_ret = INTERNAL_SYSCALL (name, sc_err, nr, args); \ + __glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (sc_ret, sc_err)) \ + ? SYSCALL_ERROR_LABEL (INTERNAL_SYSCALL_ERRNO (sc_ret, sc_err)) \ + : sc_ret; \ + }) + +#undef INTERNAL_SYSCALL_ERRNO +#define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) /* Set error number and return -1. A target may choose to return the internal function, __syscall_error, which sets errno and returns -1. @@ -66,3 +102,7 @@ /* Exports the __send symbol on send.c linux implementation (some ABI have it missing due the usage of a old generic version without it). */ #define HAVE_INTERNAL_SEND_SYMBOL 1 + +#endif /* __ASSEMBLER__ */ + +#endif /* _SYSDEP_LINUX_H */ diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index c2eb37e575..d91e00572c 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -177,35 +177,6 @@ # define DOARGS_6 DOARGS_5 #else /* !__ASSEMBLER__ */ -/* Define a macro which expands inline into the wrapper code for a system - call. */ -# undef INLINE_SYSCALL -# define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = (unsigned long int) -1; \ - } \ - (long int) resultvar; }) - -/* Define a macro with explicit types for arguments, which expands inline - into the wrapper code for a system call. It should be used when size - of any argument > size of long int. */ -# undef INLINE_SYSCALL_TYPES -# define INLINE_SYSCALL_TYPES(name, nr, args...) \ - ({ \ - unsigned long int resultvar = INTERNAL_SYSCALL_TYPES (name, , nr, args); \ - if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (resultvar, ))) \ - { \ - __set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, )); \ - resultvar = (unsigned long int) -1; \ - } \ - (long int) resultvar; }) - -# undef INTERNAL_SYSCALL_DECL -# define INTERNAL_SYSCALL_DECL(err) do { } while (0) /* Registers clobbered by syscall. */ # define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx" @@ -353,12 +324,6 @@ (long int) resultvar; \ }) -# undef INTERNAL_SYSCALL_ERROR_P -# define INTERNAL_SYSCALL_ERROR_P(val, err) \ - ((unsigned long int) (long int) (val) >= -4095L) - -# undef INTERNAL_SYSCALL_ERRNO -# define INTERNAL_SYSCALL_ERRNO(val, err) (-(val)) # define VDSO_NAME "LINUX_2.6" # define VDSO_HASH 61765110 diff --git a/sysdeps/unix/x86_64/sysdep.S b/sysdeps/unix/x86_64/sysdep.S index f617627eb8..2278fce9e4 100644 --- a/sysdeps/unix/x86_64/sysdep.S +++ b/sysdeps/unix/x86_64/sysdep.S @@ -16,8 +16,7 @@ . */ #include -#define _ERRNO_H -#include +#include #include #if IS_IN (rtld) diff --git a/sysdeps/x86_64/nptl/pthread_spin_trylock.S b/sysdeps/x86_64/nptl/pthread_spin_trylock.S index 24981fe717..c084577755 100644 --- a/sysdeps/x86_64/nptl/pthread_spin_trylock.S +++ b/sysdeps/x86_64/nptl/pthread_spin_trylock.S @@ -16,8 +16,8 @@ License along with the GNU C Library; if not, see . */ -#include #include +#include #ifdef UP