Message ID | 1478010323-13076-8-git-send-email-adhemerval.zanella@linaro.org |
---|---|
State | Dropped |
Headers |
Received: (qmail 36506 invoked by alias); 1 Nov 2016 14:25:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 36381 invoked by uid 89); 1 Nov 2016 14:25:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=KEY X-HELO: mail-ua0-f173.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=/EeTLV2VFnWh6CncEMpr15cUFJenBeahvnF0GE0xoYc=; b=gD3DA4hHJ37Qy9bCK0dJAgo/QUcrJ1wgF5cLMm3CdKNiutfJoqfte9SEzOf4RSoK2A J4VeWoWYkQ/rRp5Pu4Xf+Xb4FzS4gWyZvO8DY17VyIlutMULkNj4oVjY907toMljOaFc 3uLgk9Sn4NpL8nzAX+nWdfDKoWqHZJHvalhRcluGp9xoEOxCPjMsKCBWkbW207zTrliI tW42Nu31le/ONE3QfgQd/l1LFr6cBEvqI4ANGNov5rZh2CNuacOPz7TePwR6rCnVmD0V nfrptWkKUGPnta4HhAOxfOoDGuX25QhcunMAfWM5Ut6/SWC0nGDY9/gXp8mFLjSw9ly/ ldSg== X-Gm-Message-State: ABUngvcq4HyNU+FL4sJeaXayohLDW/OTiGRVH1NEHOOqreq4Ho0CpKPD4c/SfJhV98jBr9// X-Received: by 10.176.80.14 with SMTP id b14mr24397039uaa.132.1478010339015; Tue, 01 Nov 2016 07:25:39 -0700 (PDT) From: Adhemerval Zanella <adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Subject: [PATCH 07/15] Use semget syscall for Linux implementation Date: Tue, 1 Nov 2016 12:25:15 -0200 Message-Id: <1478010323-13076-8-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1478010323-13076-1-git-send-email-adhemerval.zanella@linaro.org> References: <1478010323-13076-1-git-send-email-adhemerval.zanella@linaro.org> |
Commit Message
Adhemerval Zanella Netto
Nov. 1, 2016, 2:25 p.m. UTC
This patch add a direct call to semget syscall if it is defined by kernel headers. hecked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/semget.c (semget): Use semget syscall if it is defined. --- ChangeLog | 3 +++ sysdeps/unix/sysv/linux/semget.c | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-)
Comments
On Nov 01 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > This patch add a direct call to semget syscall if it is defined by > kernel headers. That does not mean that the running kernel provides it. Andreas.
On Tue, 1 Nov 2016, Andreas Schwab wrote: > On Nov 01 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > > > This patch add a direct call to semget syscall if it is defined by > > kernel headers. > > That does not mean that the running kernel provides it. Specifically, this sort of patch series needs to be accompanied by an analysis of when the relevant syscalls were added for each supported architecture (and subarchitecture for cases with multiple syscall tables for different ABNs). If present (in the syscall table as well as in asm/unistd.h) in the minimum kernel version, OK, otherwise you need appropriate __ASSUME_* conditionals (even if not present in the latest kernel, it might be added in future, so you should have those conditionals now to avoid breaking things when current glibc is compiled with future kernel headers).
On 01/11/2016 14:40, Joseph Myers wrote: > On Tue, 1 Nov 2016, Andreas Schwab wrote: > >> On Nov 01 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: >> >>> This patch add a direct call to semget syscall if it is defined by >>> kernel headers. >> >> That does not mean that the running kernel provides it. > > Specifically, this sort of patch series needs to be accompanied by an > analysis of when the relevant syscalls were added for each supported > architecture (and subarchitecture for cases with multiple syscall tables > for different ABNs). If present (in the syscall table as well as in > asm/unistd.h) in the minimum kernel version, OK, otherwise you need > appropriate __ASSUME_* conditionals (even if not present in the latest > kernel, it might be added in future, so you should have those conditionals > now to avoid breaking things when current glibc is compiled with future > kernel headers). Indeed, I did not consider the case of latest kernel headers. Based on current Linux approach and historical implementation for sysv IPC I think we can assume that either the kernel only supports the old 'ipc' syscall or all the sysvipc syscall wire-up. Do you know if we do require an __ASSUME for each syscall?
On Tue, Nov 1, 2016 at 1:16 PM, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: > On 01/11/2016 14:40, Joseph Myers wrote: >> On Tue, 1 Nov 2016, Andreas Schwab wrote: >> >>> On Nov 01 2016, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote: >>> >>>> This patch add a direct call to semget syscall if it is defined by >>>> kernel headers. >>> >>> That does not mean that the running kernel provides it. >> >> Specifically, this sort of patch series needs to be accompanied by an >> analysis of when the relevant syscalls were added for each supported >> architecture (and subarchitecture for cases with multiple syscall tables >> for different ABNs). If present (in the syscall table as well as in >> asm/unistd.h) in the minimum kernel version, OK, otherwise you need >> appropriate __ASSUME_* conditionals (even if not present in the latest >> kernel, it might be added in future, so you should have those conditionals >> now to avoid breaking things when current glibc is compiled with future >> kernel headers). > > Indeed, I did not consider the case of latest kernel headers. Based > on current Linux approach and historical implementation for sysv IPC > I think we can assume that either the kernel only supports the old > 'ipc' syscall or all the sysvipc syscall wire-up. Do you know if we > do require an __ASSUME for each syscall? It wouldn't have made sense to add direct syscalls for some but not all of the APIs that were multiplexed, so I would think one __ASSUME is enough. zw
On Tue, 1 Nov 2016, Adhemerval Zanella wrote: > Indeed, I did not consider the case of latest kernel headers. Based > on current Linux approach and historical implementation for sysv IPC > I think we can assume that either the kernel only supports the old > 'ipc' syscall or all the sysvipc syscall wire-up. Do you know if we > do require an __ASSUME for each syscall? If your analysis shows that all the syscalls were always wired up (in both places, syscall table and asm/unistd.h) at the same time, you can just use a single __ASSUME (or if by mistake some architectures were only partially wired up, you could still use a single __ASSUME if it's conservatively safe).
diff --git a/sysdeps/unix/sysv/linux/semget.c b/sysdeps/unix/sysv/linux/semget.c index 52189fd..739346b 100644 --- a/sysdeps/unix/sysv/linux/semget.c +++ b/sysdeps/unix/sysv/linux/semget.c @@ -16,13 +16,10 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <errno.h> #include <sys/sem.h> #include <ipc_priv.h> -#include <stdlib.h> /* for definition of NULL */ - #include <sysdep.h> -#include <sys/syscall.h> +#include <errno.h> /* Return identifier for array of NSEMS semaphores associated with KEY. */ @@ -30,5 +27,9 @@ int semget (key_t key, int nsems, int semflg) { - return INLINE_SYSCALL (ipc, 5, IPCOP_semget, key, nsems, semflg, NULL); +#ifdef __NR_semget + return INLINE_SYSCALL_CALL (semget, key, nsems, semflg); +#else + return INLINE_SYSCALL_CALL (ipc, IPCOP_semget, key, nsems, semflg, NULL); +#endif }