From patchwork Thu Jun 26 06:03:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 364256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 578BF14008B for ; Thu, 26 Jun 2014 16:04:23 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 963788725E; Thu, 26 Jun 2014 06:04:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9fVW8SJgeXph; Thu, 26 Jun 2014 06:04:22 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2423087462; Thu, 26 Jun 2014 06:04:22 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 753E11C21EA for ; Thu, 26 Jun 2014 06:04:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 71D7E8C15E for ; Thu, 26 Jun 2014 06:04:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id J5FRMdoFbuAn for ; Thu, 26 Jun 2014 06:04:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtprelay.synopsys.com (smtprelay4.synopsys.com [198.182.44.111]) by whitealder.osuosl.org (Postfix) with ESMTPS id D08D58C15D for ; Thu, 26 Jun 2014 06:04:20 +0000 (UTC) Received: from us01secmta2.synopsys.com (us01secmta2.synopsys.com [10.9.203.102]) by smtprelay.synopsys.com (Postfix) with ESMTP id 6496824E10A3 for ; Wed, 25 Jun 2014 23:04:20 -0700 (PDT) Received: from us01secmta2.internal.synopsys.com (us01secmta2.internal.synopsys.com [127.0.0.1]) by us01secmta2.internal.synopsys.com (Service) with ESMTP id 58949A4114 for ; Wed, 25 Jun 2014 23:04:20 -0700 (PDT) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by us01secmta2.internal.synopsys.com (Service) with ESMTP id 2AF29A4112 for ; Wed, 25 Jun 2014 23:04:20 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 1CF6172B for ; Wed, 25 Jun 2014 23:04:20 -0700 (PDT) Received: from US01WEHTC2.internal.synopsys.com (us01wehtc2.internal.synopsys.com [10.12.239.237]) by mailhost.synopsys.com (Postfix) with ESMTP id E6F19728 for ; Wed, 25 Jun 2014 23:04:19 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.105) by US01WEHTC2.internal.synopsys.com (10.12.239.237) with Microsoft SMTP Server (TLS) id 14.3.158.1; Wed, 25 Jun 2014 23:04:16 -0700 Received: from vg-E6520.internal.synopsys.com (10.12.196.93) by IN01WEHTCB.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 26 Jun 2014 11:34:12 +0530 From: Vineet Gupta To: Subject: [PATCH 2/6] ARC: syscalls.h: code-reuse/fix-arg-annotations Date: Thu, 26 Jun 2014 11:33:31 +0530 Message-ID: <1403762615-25145-3-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1403762615-25145-1-git-send-email-vgupta@synopsys.com> References: <1403762615-25145-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 X-Originating-IP: [10.12.196.93] Cc: Vineet Gupta , Francois Bedard X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: uclibc-bounces@uclibc.org Sender: uclibc-bounces@uclibc.org - Use syscalls-common.h vers of INTERNAL_SYSCALL / INLINE_SYSCALL_NOERR - INLINE_SYSCALL takes syscall name (e.g. write) - {INLINE,INTERNAL}_SYSCALL_NCS macros take syscall num (__NR_write) Signed-off-by: Vineet Gupta --- libc/sysdeps/linux/arc/bits/syscalls.h | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/libc/sysdeps/linux/arc/bits/syscalls.h b/libc/sysdeps/linux/arc/bits/syscalls.h index 06d2cf926e30..5da6aadb3216 100644 --- a/libc/sysdeps/linux/arc/bits/syscalls.h +++ b/libc/sysdeps/linux/arc/bits/syscalls.h @@ -56,22 +56,19 @@ extern int __syscall_error (int); #endif /* IS_IN_rtld */ -/* Invoke the syscall and return unprocessed kernel status */ -#define INTERNAL_SYSCALL(nm, err, nr, args...) \ - INTERNAL_SYSCALL_NCS(SYS_ify (nm), err, nr, args) - /* -1 to -1023 as valid error values will suffice for some time */ #define INTERNAL_SYSCALL_ERROR_P(val, err) \ ((unsigned int) (val) > (unsigned int) -1024) /* - * Standard sycall wrapper: - * -"const" syscall number @nm, sets errno, return success/error-codes + * Standard sycall wrapper + * -Gets syscall name (conv to __NR_xxx) + * -sets errno, return success/error-codes */ -#define INLINE_SYSCALL(nm, nr_args, args...) \ +#define INLINE_SYSCALL(name, nr_args, args...) \ ({ \ register int __res __asm__("r0"); \ - __res = INTERNAL_SYSCALL(nm, , nr_args, args); \ + __res = INTERNAL_SYSCALL_NCS(__NR_##name, , nr_args, args); \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P ((__res), ), 0)) \ { \ ERRNO_ERRANDS(__res); \ @@ -79,14 +76,12 @@ extern int __syscall_error (int); __res; \ }) -/* Non const syscall number @nm - * Ideally this could be folded within INLINE_SYSCALL with - * __builtin_constant_p in INTERNAL_SYSCALL but that fails for syscall.c +/* variant of INLINE_SYSCALL, gets syscall number */ -#define INLINE_SYSCALL_NCS(nm, nr_args, args...) \ +#define INLINE_SYSCALL_NCS(num, nr_args, args...) \ ({ \ register int __res __asm__("r0"); \ - __res = INTERNAL_SYSCALL_NCS(nm, , nr_args, args); \ + __res = INTERNAL_SYSCALL_NCS(num, , nr_args, args); \ if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P ((__res), ), 0)) \ { \ ERRNO_ERRANDS(__res); \ @@ -94,10 +89,6 @@ extern int __syscall_error (int); __res; \ }) -#define INLINE_SYSCALL_NOERR(name, nr, args...) \ - ({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args);\ - (int) _inline_sys_result; }) - /*------------------------------------------------------------------------- * Mechanics of Trap - specific to ARC700 *