From patchwork Tue Jul 4 19:53:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 21414 Received: (qmail 74589 invoked by alias); 4 Jul 2017 19:54:23 -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 74022 invoked by uid 89); 4 Jul 2017 19:54:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=3314 X-HELO: mail-qk0-f173.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=8sCDcwyNuEjO1BshqJo9954riFTBac5yeyrEGzulo2I=; b=nx7l4PDFyTsYiJQtVrOaK71Vtn66I8GLPesotv+rDGv+kYbgTQwa7yZYaZbA4s5CZ+ Ulcjc+1GI7pp528RWtr/xg7Z856N4O+m1MOjXVwseGvKW4j3nW65cp5mQhw6/KYiOskR 6y38utsj8QzyhSCseMHO/nyg7IdNWXk0VfyKiIqnzYxaoJteYD5O8WQwgfR687Zezl7g 4mkCmuXd8x0BFpu6FfdwGH4JIsfvmCNyTpnJlLllLiomKny6yP2gOWPU/zxD0X2VHFcb V2jlhdzpw+BZQ4Xf+qEcL1KRS6vrp3y92EPJHj4RrpeU0IKjxfdoZj0L6/pGQEmM+7XU TJBA== X-Gm-Message-State: AKS2vOwLlqZNc0tASt0JxfK8hm8KvQ9IA2B9lM4LNMAzm61BSn/NwBci sbbP5xQJZfS+km/kXOMILA== X-Received: by 10.55.204.133 with SMTP id n5mr50951946qkl.135.1499198053424; Tue, 04 Jul 2017 12:54:13 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 08/14] Consolidate non cancellable waitpid call Date: Tue, 4 Jul 2017 16:53:48 -0300 Message-Id: <1499198034-5837-9-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org> References: <1499198034-5837-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates all the non cancellable waitpid calls to use the __waitpid_nocancel identifier. For non cancellable targets it will be just a macro to call the default respective symbol while on Linux will be a internal one. Checked on x86_64-linux-gnu, x86_64-linux-gnu-x32, and i686-linux-gnu. * login/utmp_file.c (timeout_handler): Replace fcntl_not_cancel with __fcntl_nocancel. * sysdeps/generic/not-cancel.h (fcntl_not_cancel): Remove macro. * sysdeps/unix/sysv/linux/not-cancel.h (fcntl_not_cancel): Likewise. --- libio/iopopen.c | 2 +- sysdeps/generic/not-cancel.h | 2 +- sysdeps/unix/sysv/linux/not-cancel.h | 7 +++---- sysdeps/unix/sysv/linux/waitpid.c | 15 ++++++++++++++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/libio/iopopen.c b/libio/iopopen.c index 0c20cbb..a2ddebb 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -61,7 +61,7 @@ extern int _IO_dup2 (int fd, int fd2) __THROW; #ifndef _IO_waitpid #ifdef _LIBC -#define _IO_waitpid waitpid_not_cancel +#define _IO_waitpid __waitpid_nocancel #else #define _IO_waitpid waitpid #endif diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h index fa7b4d3..6c3afc2 100644 --- a/sysdeps/generic/not-cancel.h +++ b/sysdeps/generic/not-cancel.h @@ -36,7 +36,7 @@ __write (fd, buf, n) #define __writev_nocancel_nostatus(fd, iov, n) \ (void) __writev (fd, iov, n) -# define waitpid_not_cancel(pid, stat_loc, options) \ +# define __waitpid_nocancel(pid, stat_loc, options) \ __waitpid (pid, stat_loc, options) #define pause_not_cancel() \ __pause () diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index 625bbaa..3047848 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -25,6 +25,7 @@ #include #include #include +#include /* Non cancellable open syscall. */ __typeof (open) __open_nocancel; @@ -73,10 +74,8 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) } /* Uncancelable waitpid. */ -#define __waitpid_nocancel(pid, stat_loc, options) \ - INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) -#define waitpid_not_cancel(pid, stat_loc, options) \ - __waitpid_nocancel(pid, stat_loc, options) +__typeof (waitpid) __waitpid_nocancel; +libc_hidden_proto (__waitpid_nocancel) /* Uncancelable pause. */ #define pause_not_cancel() \ diff --git a/sysdeps/unix/sysv/linux/waitpid.c b/sysdeps/unix/sysv/linux/waitpid.c index 2fed421..052462d 100644 --- a/sysdeps/unix/sysv/linux/waitpid.c +++ b/sysdeps/unix/sysv/linux/waitpid.c @@ -16,10 +16,12 @@ . */ #include -#include #include #include +#include +#include + __pid_t __waitpid (__pid_t pid, int *stat_loc, int options) { @@ -31,3 +33,14 @@ __waitpid (__pid_t pid, int *stat_loc, int options) } libc_hidden_def (__waitpid) weak_alias (__waitpid, waitpid) + +__pid_t +__waitpid_nocancel (__pid_t pid, int *stat_loc, int options) +{ +#ifdef __NR_waitpid + return INLINE_SYSCALL_CALL (waitpid, pid, stat_loc, options); +#else + return INLINE_SYSCALL_CALL (wait4, pid, stat_loc, options, NULL); +#endif +} +libc_hidden_def (__waitpid_nocancel)