From patchwork Thu Jan 9 09:35:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 308533 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 48F192C00A8 for ; Thu, 9 Jan 2014 20:36:12 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 943C69427F; Thu, 9 Jan 2014 09:36:11 +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 XIIRWlRlauPb; Thu, 9 Jan 2014 09:36:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4953394189; Thu, 9 Jan 2014 09:36:10 +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 1C0641BF9AE for ; Thu, 9 Jan 2014 09:36:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 16B488D6E9 for ; Thu, 9 Jan 2014 09:36:09 +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 w96aYRYlRP2A for ; Thu, 9 Jan 2014 09:36:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-relay.synopsys.com (smtp-relay.synopsys.com [198.182.44.80]) by whitealder.osuosl.org (Postfix) with ESMTP id B366D8D523 for ; Thu, 9 Jan 2014 09:36:07 +0000 (UTC) Received: from WBSNus02mta1 (us02secmta1.synopsys.com [10.12.235.96]) by smtp-relay.synopsys.com (Postfix) with ESMTP id 01254F2A4; Thu, 9 Jan 2014 01:36:06 -0800 (PST) Received: from us02secmta1.internal.synopsys.com (us02secmta1.internal.synopsys.com [127.0.0.1]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id DFF924E213; Thu, 9 Jan 2014 01:36:06 -0800 (PST) Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by us02secmta1.internal.synopsys.com (Service) with ESMTP id 9EE784E202; Thu, 9 Jan 2014 01:36:06 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 8DB744F78; Thu, 9 Jan 2014 01:36:06 -0800 (PST) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 494E74F76; Thu, 9 Jan 2014 01:36:06 -0800 (PST) Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by us01wehtc1.internal.synopsys.com (10.12.239.235) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 9 Jan 2014 01:36:06 -0800 Received: from vg-E6520.internal.synopsys.com (10.12.197.70) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 9 Jan 2014 15:06:01 +0530 From: Vineet Gupta To: Subject: [PATCH] libc: posix_fadvise: Fix build breakage for !LFS Date: Thu, 9 Jan 2014 15:05:45 +0530 Message-ID: <1389260145-8810-1-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 1.8.3.2 MIME-Version: 1.0 X-Originating-IP: [10.12.197.70] Cc: Francois.Bedard@synopsys.com, Vineet Gupta , markos Chandras 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 commit 00571b43df2e "libc: posix_fadvise: restore implementation for xtensa" enabled posix_fadvise() for all arches (it was just not generated before). However this also unearthed an issue introduced by ee84b8b400 "linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT" which is to referencing LFS'ish code (off64_t) w/o proper checks which causes build to break for !LFS. Fix this by calling posix_fadvise64() only for LFS case and open-code it's equivalent for !LFS. Signed-off-by: Vineet Gupta Cc: Mike Frysinger Cc: Baruch Siach Cc: Khem Raj Cc: markos Chandras Cc: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/posix_fadvise.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c index 25c294178e5e..14bbeeea13bc 100644 --- a/libc/sysdeps/linux/common/posix_fadvise.c +++ b/libc/sysdeps/linux/common/posix_fadvise.c @@ -22,17 +22,34 @@ # include # include -# ifdef __NR_fadvise64_64 -int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice); -# endif +# if defined(__NR_fadvise64_64) && defined(__UCLIBC_HAS_LFS__) +#include <_lfs_64.h> +int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice); int posix_fadvise(int fd, off_t offset, off_t len, int advice) { -# ifdef __NR_fadvise64_64 return posix_fadvise64(fd, offset, len, advice); -# else +} +#else + +int posix_fadvise(int fd, off_t offset, off_t len, int advice) +{ int ret; INTERNAL_SYSCALL_DECL(err); + +# ifdef __NR_fadvise64_64 +# if __WORDSIZE == 64 + ret = INTERNAL_SYSCALL(fadvise64_64, err, 4, fd, offset, len, advice); +# else +# if defined(__UCLIBC_SYSCALL_ALIGN_64BIT__) || defined(__arm__) + ret = INTERNAL_SYSCALL(fadvise64_64, err, 6, fd, advice, + OFF_HI_LO (offset), OFF_HI_LO (len)); +# else + ret = INTERNAL_SYSCALL(fadvise64_64, err, 6, fd, + OFF_HI_LO (offset), OFF_HI_LO (len), advice); +# endif +# endif +# else /* __NR_fadvise64 */ # if __WORDSIZE == 64 ret = INTERNAL_SYSCALL(fadvise64, err, 4, fd, offset, len, advice); # else @@ -43,12 +60,13 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice) # endif OFF_HI_LO (offset), len, advice); # endif +# endif if (INTERNAL_SYSCALL_ERROR_P (ret, err)) return INTERNAL_SYSCALL_ERRNO (ret, err); return 0; -# endif } # if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || __WORDSIZE == 64) strong_alias(posix_fadvise,posix_fadvise64) # endif #endif +#endif