From patchwork Sun Jun 14 18:27:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1309035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49lNHN0kNSz9sQx for ; Mon, 15 Jun 2020 04:27:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 87E37395C82B; Sun, 14 Jun 2020 18:27:41 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [185.233.100.1]) by sourceware.org (Postfix) with ESMTPS id C46E6395C824 for ; Sun, 14 Jun 2020 18:27:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C46E6395C824 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id BB4ED34AB; Sun, 14 Jun 2020 20:27:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nH5qUa4LHKNL; Sun, 14 Jun 2020 20:27:36 +0200 (CEST) Received: from function (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id C8CAC30D2; Sun, 14 Jun 2020 20:27:36 +0200 (CEST) Received: from samy by function with local (Exim 4.94) (envelope-from ) id 1jkXM0-00HSkc-5b; Sun, 14 Jun 2020 20:27:36 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd,commited] hurd: Fix __writev_nocancel_nostatus Date: Sun, 14 Jun 2020 20:27:35 +0200 Message-Id: <20200614182735.4162053-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" * sysdeps/mach/hurd/Makefile [subdir=misc] (sysdep_routines): Add writev_nocancel writev_nocancel_nostatus. * sysdeps/mach/hurd/not-cancel.h (__writev_nocancel_nostatus): Replace macro with function declaration (with hidden prototype in libc). (__writev_nocancel): New function declaration (with hidden prototype in libc). * sysdeps/mach/hurd/writev_nocancel_nostatus.c: New file. * sysdeps/posix/writev_nocancel.c: New file, includes writev.c to make a nocancel variant that calls __write_nocancel. * sysdeps/posix/writev.c (writev): Do not define alias if __writev is renamed. --- sysdeps/mach/hurd/Makefile | 4 +++ sysdeps/mach/hurd/not-cancel.h | 10 +++++-- sysdeps/mach/hurd/writev_nocancel_nostatus.c | 28 ++++++++++++++++++++ sysdeps/posix/writev.c | 2 ++ sysdeps/posix/writev_nocancel.c | 4 +++ 5 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 sysdeps/mach/hurd/writev_nocancel_nostatus.c create mode 100644 sysdeps/posix/writev_nocancel.c diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 8b74d3f002..daa69c0dae 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -200,6 +200,10 @@ sysdep_routines += f_setlk close_nocancel_nostatus read_nocancel \ pread64_nocancel write_nocancel pwrite64_nocancel endif +ifeq (misc, $(subdir)) +sysdep_routines += writev_nocancel writev_nocancel_nostatus +endif + ifeq ($(subdir),sunrpc) sysdep_headers += nfs/nfs.h endif diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h index d2c3e20019..202dca8792 100644 --- a/sysdeps/mach/hurd/not-cancel.h +++ b/sysdeps/mach/hurd/not-cancel.h @@ -54,8 +54,12 @@ __typeof (__write) __write_nocancel; /* Non cancellable pwrite syscall (LFS version). */ __typeof (__pwrite64) __pwrite64_nocancel; -#define __writev_nocancel_nostatus(fd, iov, n) \ - (void) __writev (fd, iov, n) +/* Non cancellable writev syscall. */ +__typeof (__writev) __writev_nocancel; + +/* Non cancellable writev syscall with no status. */ +void __writev_nocancel_nostatus (int fd, const struct iovec *vector, int count); + # define __waitpid_nocancel(pid, stat_loc, options) \ __waitpid (pid, stat_loc, options) #define __fcntl64_nocancel(fd, cmd, ...) \ @@ -66,6 +70,8 @@ hidden_proto (__read_nocancel) hidden_proto (__pread64_nocancel) hidden_proto (__write_nocancel) hidden_proto (__pwrite64_nocancel) +hidden_proto (__writev_nocancel) +hidden_proto (__writev_nocancel_nostatus) hidden_proto (__close_nocancel_nostatus) #endif diff --git a/sysdeps/mach/hurd/writev_nocancel_nostatus.c b/sysdeps/mach/hurd/writev_nocancel_nostatus.c new file mode 100644 index 0000000000..6db24d1b53 --- /dev/null +++ b/sysdeps/mach/hurd/writev_nocancel_nostatus.c @@ -0,0 +1,28 @@ +/* Copyright (C) 1991-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +void +__writev_nocancel_nostatus (int fd, const struct iovec *vector, int count) +{ + int save = errno; + __writev_nocancel (fd, vector, count); + __set_errno (save); +} +libc_hidden_weak (__writev_nocancel_nostatus) diff --git a/sysdeps/posix/writev.c b/sysdeps/posix/writev.c index a9942e4b99..1a45779a9a 100644 --- a/sysdeps/posix/writev.c +++ b/sysdeps/posix/writev.c @@ -89,4 +89,6 @@ __writev (int fd, const struct iovec *vector, int count) return bytes_written; } libc_hidden_def (__writev) +#ifndef __writev weak_alias (__writev, writev) +#endif diff --git a/sysdeps/posix/writev_nocancel.c b/sysdeps/posix/writev_nocancel.c new file mode 100644 index 0000000000..5379e9e491 --- /dev/null +++ b/sysdeps/posix/writev_nocancel.c @@ -0,0 +1,4 @@ +#include +#define __writev __writev_nocancel +#define __write __write_nocancel +#include