From patchwork Fri Oct 11 19:15:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 176027 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1171689ill; Fri, 11 Oct 2019 12:16:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8o10OT91vHZ3SJbeiwQCuUm30HshPt0JVJQEDcSuSKl7p2wbJV9fJAVfjvsf2NzbBHQdD X-Received: by 2002:a17:906:ce46:: with SMTP id se6mr15619725ejb.103.1570821376551; Fri, 11 Oct 2019 12:16:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570821376; cv=none; d=google.com; s=arc-20160816; b=nvKxkNq17Xhem4Yt66QukCpsr8RrEpyxhv/C9zZpnxSxrzypqJp+aaYAVTFpi7zNih 9Q69NrX0vOAcMr6q8/17Lxnx3QSZbbigujPji7yijfapSTGrnwbjZkuBD7HxULyMcsBy TNx9njeLWL6D4NuneaJm3k4dvRb+pO3xHFM/UKKC5oYgCqS/w+SBI1P0XUP5fqATo9RG gKmsqOmS3PP9WD4y9tc6AjLIQxmpTE7wGxyuuv/fP/T1zzT7KqdYujW+1g56FllxNSGf mcECMVuX6hwQlCFc3C30g4mjXqOgQdolncx9hNDIGZEF/2ytIhHKnqRRyajnBvQ266DK FMmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:delivered-to:sender:list-help:list-post:list-archive :list-subscribe:list-unsubscribe:list-id:precedence:mailing-list :dkim-signature:domainkey-signature; bh=Npi3AonLUAw/XPyH4gi//ZyctTSAs6KE8Zj2nE5RxmI=; b=ngQ4r0g+UGZScc6Ejw9o0oXxoSpnQsLAVxFsWcAWZ1H3+quWb3OOLKz0L7rIbTZAHD E5qFDTjeb8uFzGW8Nv8e1nf3+mknh3qD6o9mMhsn52/axpjYeh6r/EA1MeiUsotZfs60 Xn+M5GM3+eCGtJV1x0fN0qM2yyJkyyPb3QvsPunWgcjOSsZnvxTxCISjU3DStNT4wvnn f+2Gd6Ao/pVCe9Q3Aooik5d7V9KEWt6WTkF99Q1g/HX9FWhUxlRT6qOAs3ueBmMFsGNa /JU7YH4Fhb5snoBko39OC4iTzBBqGObvSWRUklhQb+XO2lgb7eW7iS6lf3L1901HN1om 0djg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=vPR9NX+N; dkim=pass header.i=@linaro.org header.s=google header.b=obhvBwmg; spf=pass (google.com: domain of libc-alpha-return-105881-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105881-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h4si6518183edd.189.2019.10.11.12.16.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Oct 2019 12:16:16 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-105881-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=vPR9NX+N; dkim=pass header.i=@linaro.org header.s=google header.b=obhvBwmg; spf=pass (google.com: domain of libc-alpha-return-105881-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="libc-alpha-return-105881-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=InsB5HEsXbg4Rz+g3SauoG3Ps5bz5Ft vLd8k7zTLiZoifW8kx9PRyRWu0d35MxJSYLvtQaehC4UZ87ziW5tvusSnZy+WWJN NVRCaKFZlMhxf23/c8RNyFu3VusvIJbgFbcizWWoaQJ8YykYKKfmTAROYmYFkyy9 KMzQpazlmUcw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=ZCkvej6nZzcCUIx1IapYkWf2B58=; b=vPR9N X+NXnXU+lxXnp3BoGl9NzKh+7/uJwl3ghLZlrWQdOJDwGUVS4l6984T3quhtXpH8 08eykk+6ZaRJ0B1OWB6eFrgCeWs6uBOov0Ll/kkg9PusWmenf0juYjptn5+1TRNR 6+7K8+OIdXr5bPip9SuA9fCRPxXcxVbIny8mCA= Received: (qmail 23277 invoked by alias); 11 Oct 2019 19:16:07 -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 23250 invoked by uid 89); 11 Oct 2019 19:16:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:3101 X-HELO: mail-qk1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Npi3AonLUAw/XPyH4gi//ZyctTSAs6KE8Zj2nE5RxmI=; b=obhvBwmgWCpgj160P99/2TigXk15kt/GRU4vm4ZNrW11KccVIvMRd2wBelTBtmEkR6 MiC1tvWVj+mQ2W3ienJ0BQYnoE3LwC+Y3gEDVjYtkQeK7uNncNWObM08x8o2gsgBXGfI TeAdjKTvl5Nq46bdz4iQCmqSzmdz8XJzT3MrNKD+DDj4qlBa0YanUdtapstWMjgiEYzb AVt2J+fErBh4XSW+7xNmqL4Vlp9Wi/KsSyXQpKY570nrR1AprmvfXcR7VyLttqU8Hq1U cYyYrKP10XVcTWGT/HvTyHnp9Cy2LSQmAd5LfvB6vF1wqP97nYPasdqMOymN/0+PHzZ0 5a4A== Return-Path: From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: "Paul A . Clarke" Subject: [PATCH 2/3] sysvipc: Implement semop based on semtimedop Date: Fri, 11 Oct 2019 16:15:53 -0300 Message-Id: <20191011191554.10870-2-adhemerval.zanella@linaro.org> In-Reply-To: <20191011191554.10870-1-adhemerval.zanella@linaro.org> References: <20191011191554.10870-1-adhemerval.zanella@linaro.org> Besides semop being a subset of semtimedop, new 32-bit architectures on Linux are not expected to provide the syscall (only the 64-bit time semtimedop). Also, Linux 5.1 only wired-up semtimedop for the 64-bit architectures that missed it (powerpc, s390, and sparc). This simplifies the code to support it. Checked on x86_64-linux-gnu and i686-linux-gnu. * include/sys/sem.h: New file. * sysdeps/unix/sysv/linux/semop.c (semop): Call internal semtimedop. * sysdeps/unix/sysv/linux/semtimedop.c (semtimedop): Add internal alias. * sysvipc/semtimedop.c (semtimedop): Likewise. --- include/sys/sem.h | 11 ++++++++++- sysdeps/unix/sysv/linux/semop.c | 6 +----- sysdeps/unix/sysv/linux/semtimedop.c | 6 ++++-- sysvipc/semtimedop.c | 6 ++++-- 4 files changed, 19 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/include/sys/sem.h b/include/sys/sem.h index b0fb201bd0..bab548c3f7 100644 --- a/include/sys/sem.h +++ b/include/sys/sem.h @@ -1 +1,10 @@ -#include +#ifndef _SYS_SEM_H +# include + +# ifndef _ISOMAC + +__typeof__ (semtimedop) __semtimedop attribute_hidden; +libc_hidden_proto (__semtimedop) + +# endif +#endif diff --git a/sysdeps/unix/sysv/linux/semop.c b/sysdeps/unix/sysv/linux/semop.c index 687fdcb805..e111b9aa3d 100644 --- a/sysdeps/unix/sysv/linux/semop.c +++ b/sysdeps/unix/sysv/linux/semop.c @@ -26,9 +26,5 @@ int semop (int semid, struct sembuf *sops, size_t nsops) { -#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS - return INLINE_SYSCALL_CALL (semop, semid, sops, nsops); -#else - return INLINE_SYSCALL_CALL (ipc, IPCOP_semop, semid, nsops, 0, sops); -#endif + return __semtimedop (semid, sops, nsops, NULL); } diff --git a/sysdeps/unix/sysv/linux/semtimedop.c b/sysdeps/unix/sysv/linux/semtimedop.c index f34a7fb920..5f1b205c2b 100644 --- a/sysdeps/unix/sysv/linux/semtimedop.c +++ b/sysdeps/unix/sysv/linux/semtimedop.c @@ -24,8 +24,8 @@ /* Perform user-defined atomical operation of array of semaphores. */ int -semtimedop (int semid, struct sembuf *sops, size_t nsops, - const struct timespec *timeout) +__semtimedop (int semid, struct sembuf *sops, size_t nsops, + const struct timespec *timeout) { #ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS return INLINE_SYSCALL_CALL (semtimedop, semid, sops, nsops, timeout); @@ -34,3 +34,5 @@ semtimedop (int semid, struct sembuf *sops, size_t nsops, SEMTIMEDOP_IPC_ARGS (nsops, sops, timeout)); #endif } +weak_alias (__semtimedop, semtimedop) +libc_hidden_def (__semtimedop) diff --git a/sysvipc/semtimedop.c b/sysvipc/semtimedop.c index 5ca4d47ee3..68707d6ade 100644 --- a/sysvipc/semtimedop.c +++ b/sysvipc/semtimedop.c @@ -22,11 +22,13 @@ /* Perform user-defined atomical operation of array of semaphores. */ int -semtimedop (int semid, struct sembuf *sops, size_t nsops, - const struct timespec *timeout) +__semtimedop (int semid, struct sembuf *sops, size_t nsops, + const struct timespec *timeout) { __set_errno (ENOSYS); return -1; } +weak_alias (__semtimedop, semtimedop) +libc_hidden_def (__semtimedop) stub_warning (semtimedop)