From patchwork Mon Sep 25 13:15:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guo Ren X-Patchwork-Id: 818239 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y14Rn4M1Cz9s72 for ; Mon, 25 Sep 2017 23:19:15 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 33A28106D2; Mon, 25 Sep 2017 15:19:11 +0200 (CEST) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org Received: from smtp2200-217.mail.aliyun.com (smtp2200-217.mail.aliyun.com [121.197.200.217]) by helium.openadk.org (Postfix) with ESMTPS id 384961070C; Mon, 25 Sep 2017 15:19:07 +0200 (CEST) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.0444518|-1; FP=0|0|0|0|0|-1|-1|-1; HT=e01l10421; MF=ren_guo@c-sky.com; NM=1; PH=DS; RN=3; RT=3; SR=0; TI=SMTPD_---.9-.ljRQ_1506345458; Received: from localhost.localdomain(mailfrom:ren_guo@c-sky.com ip:223.93.147.148) by smtp.aliyun-inc.com(10.147.44.129); Mon, 25 Sep 2017 21:18:57 +0800 From: Guo Ren To: devel@uclibc-ng.org, wbx@uclibc-ng.org Date: Mon, 25 Sep 2017 21:15:04 +0800 Message-Id: <1506345304-3222-1-git-send-email-ren_guo@c-sky.com> X-Mailer: git-send-email 2.7.4 Cc: Guo Ren Subject: [uclibc-ng-devel] [PATCH 1/1] preadv/pwritev: bugfix preadv/pwritev syscall should be 5 args X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" The current uclibc-ng use 4 arguments, and this will cause ltp-testsuite's preadv/pwritev case failed. The syscall of preadv/pwritev in current linux-kernel is 5 arguments: linux/fs/read_write.c: SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec, unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h) SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec, unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h) So just update to 5-args-syscall, and off_t could be 32bit or 64bit. Signed-off-by: Guo Ren --- libc/sysdeps/linux/common/preadv.c | 7 ++++++- libc/sysdeps/linux/common/pwritev.c | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/preadv.c b/libc/sysdeps/linux/common/preadv.c index b90291b..fd9dde4 100644 --- a/libc/sysdeps/linux/common/preadv.c +++ b/libc/sysdeps/linux/common/preadv.c @@ -23,6 +23,11 @@ ssize_t preadv (int fd, const struct iovec *vector, int count, off_t offset) { - return INLINE_SYSCALL (preadv, 4, fd, vector, count, offset); + unsigned long pos_l, pos_h; + + pos_h = (unsigned long)((long long)offset >> 32); + pos_l = (unsigned long)((long long)offset); + + return INLINE_SYSCALL (preadv, 5, fd, vector, count, pos_l, pos_h); } #endif diff --git a/libc/sysdeps/linux/common/pwritev.c b/libc/sysdeps/linux/common/pwritev.c index a1880ed..bef5bcf 100644 --- a/libc/sysdeps/linux/common/pwritev.c +++ b/libc/sysdeps/linux/common/pwritev.c @@ -23,6 +23,11 @@ ssize_t pwritev (int fd, const struct iovec *vector, int count, off_t offset) { - return INLINE_SYSCALL (pwritev, 4, fd, vector, count, offset); + unsigned long pos_l, pos_h; + + pos_h = (unsigned long)((long long)offset >> 32); + pos_l = (unsigned long)((long long)offset); + + return INLINE_SYSCALL (pwritev, 5, fd, vector, count, pos_l, pos_h); } #endif