From patchwork Tue Dec 27 14:01:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 89075 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp4998702qgi; Tue, 27 Dec 2016 06:02:24 -0800 (PST) X-Received: by 10.98.32.151 with SMTP id m23mr30353318pfj.127.1482847344133; Tue, 27 Dec 2016 06:02:24 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id k1si46623939pld.26.2016.12.27.06.02.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Dec 2016 06:02:24 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-76352-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; spf=pass (google.com: domain of libc-alpha-return-76352-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-76352-patch=linaro.org@sourceware.org; dmarc=fail (p=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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=OoPZUqFyFE/SAkzynwuFlVdmpCni+TW tRntKM8iM/RGTkyq0i58kN269Rl5oga2UeTj4QyjFYazqfrPRvrTy5Eyb2q83Szh 3b0AuadvfYRXdNuktZy0lpdWCpEK1kDmjnz64zH5ZjNi4pp7HhTpkK7FpSf7nFon +/Tt0GFiImGQ= 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:subject:date:message-id:in-reply-to :references; s=default; bh=YN4J+aga1CgHjx9mojIDgSOmlK8=; b=fIsQ8 G40CNUfk3Duw0jIAPXTZ/wQ9L11G1pzwLwi+4kiPvciVslZ95oZ8lEYT0xrGvW1L V6wyaUiS638bEqO9D2pTHMm/Ctw55l8F3IxSjZVfwQ+3XCxb5bobgJ0C2Vu3mepG PPX2OtbTjAVhDiduMpsIHhyLKsJBnYZ4wR9z9o= Received: (qmail 76333 invoked by alias); 27 Dec 2016 14:01:49 -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 76242 invoked by uid 89); 27 Dec 2016 14:01:49 -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=ipc, hppa, 1995, 1617 X-HELO: mail-yw0-f174.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=BjzlzunB1igfkP6gggK8YVP3gnRnkcU795DCKV7qk/s=; b=a+m4C+FyS93aZa9uFLszz9+H1rPVLAt/SN1yJOXWflp8yWR7NWImBMBtmnYgt6xeun 34Nsr+VQoTKrzWkHUPdRV2n7cNHShWm/zAvCS32N/Rq4uykLT5HRenEdEs5mrLC8DMEQ PxmAJsEmVw86TS+kuyo5eJVZdP/vDzDXBsRbGWXK9NdKUCBa9F9luEx6geIHG3cAzNzH oJQhMANbBtRFJsFTrSfao5DloIr7dSHg9DGIx5WE0HJ+5IyLFtD5fYGiNi8JA1hZ2N/s fTZHrPt+EL4PF5ObahLsiMJAxoEfwZpbP2My9ND9Z9mByGujBffKBOz8rYVdE87jZnXr F/QA== X-Gm-Message-State: AIkVDXJpM1Jl8s1gUrVaGjBEiyv9gpdz3wMn/BuxZs+/3a+oSdWvmM1RhAEg/b3Rj1Zr5oco X-Received: by 10.13.254.195 with SMTP id o186mr26852918ywf.300.1482847297779; Tue, 27 Dec 2016 06:01:37 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 03/17] Consolidate Linux msgctl implementation Date: Tue, 27 Dec 2016 12:01:12 -0200 Message-Id: <1482847286-29933-4-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1482847286-29933-1-git-send-email-adhemerval.zanella@linaro.org> References: <1482847286-29933-1-git-send-email-adhemerval.zanella@linaro.org> This patch consolidates the msgctl Linux implementation in only one default file, sysdeps/unix/sysv/linux/msgctl.c. If tries to use the direct syscall if it is supported, otherwise will use the old ipc multiplex mechanism. The patch also simplify header inclusion and reorganize internal compat symbol to be built only if old ipc is defined. Checked on x86_64, i686, powerpc64le, aarch64, and armhf. * sysdeps/unix/sysv/linux/alpha/Makefile (sysdeps_routines): Remove oldmsgctl. * sysdeps/unix/sysv/linux/alpha/msgctl.c: Remove file. * sysdeps/unix/sysv/linux/arm/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/microblaze/msgctl.c: Likewise. * sysdeps/unix/sysv/linux/alpha/syscalls.list (oldmsgctl): Remove. * sysdeps/unix/sysv/linux/generic/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgctl): Likewise. * sysdeps/unix/sysv/linux/mips/mips64/msgctl.c: Use default implementation. * sysdeps/unix/sysv/linux/msgctl.c (__new_msgctl): Use msgctl syscall if defined. --- ChangeLog | 17 ++++++++ sysdeps/unix/sysv/linux/alpha/Makefile | 2 +- sysdeps/unix/sysv/linux/alpha/msgctl.c | 1 - sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 - sysdeps/unix/sysv/linux/arm/msgctl.c | 33 ---------------- sysdeps/unix/sysv/linux/generic/syscalls.list | 1 - sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 - sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 - sysdeps/unix/sysv/linux/microblaze/msgctl.c | 1 - sysdeps/unix/sysv/linux/mips/mips64/msgctl.c | 17 +++----- sysdeps/unix/sysv/linux/msgctl.c | 45 +++++++++++----------- sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list | 1 - sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 - 13 files changed, 46 insertions(+), 76 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/msgctl.c delete mode 100644 sysdeps/unix/sysv/linux/arm/msgctl.c delete mode 100644 sysdeps/unix/sysv/linux/microblaze/msgctl.c -- 2.7.4 diff --git a/sysdeps/unix/sysv/linux/alpha/Makefile b/sysdeps/unix/sysv/linux/alpha/Makefile index 45941b0..c24dc2e 100644 --- a/sysdeps/unix/sysv/linux/alpha/Makefile +++ b/sysdeps/unix/sysv/linux/alpha/Makefile @@ -18,7 +18,7 @@ sysdep_routines += osf_select osf_gettimeofday osf_settimeofday \ osf_getrusage osf_wait4 # Support old ipc control -sysdep_routines += oldmsgctl oldsemctl oldshmctl +sysdep_routines += oldsemctl oldshmctl CFLAGS-ioperm.c = -Wa,-mev6 endif diff --git a/sysdeps/unix/sysv/linux/alpha/msgctl.c b/sysdeps/unix/sysv/linux/alpha/msgctl.c deleted file mode 100644 index d65a5b9..0000000 --- a/sysdeps/unix/sysv/linux/alpha/msgctl.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index 0c9efcb..f82c9da 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -1,6 +1,5 @@ # File name Caller Syscall name # args Strong name Weak names -oldmsgctl EXTRA msgctl i:iip __old_msgctl msgctl@GLIBC_2.0 msgget - msgget i:ii __msgget msgget msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv msgsnd - msgsnd Ci:ibni __msgsnd msgsnd diff --git a/sysdeps/unix/sysv/linux/arm/msgctl.c b/sysdeps/unix/sysv/linux/arm/msgctl.c deleted file mode 100644 index 83c6744..0000000 --- a/sysdeps/unix/sysv/linux/arm/msgctl.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1995-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , August 1995. - - 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 -#include -#include -#include - - -int -__new_msgctl (int msqid, int cmd, struct msqid_ds *buf) -{ - return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf); -} - -#include -versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2); diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list index 5993ab4..dea452b 100644 --- a/sysdeps/unix/sysv/linux/generic/syscalls.list +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list @@ -2,7 +2,6 @@ # SysV APIs msgget - msgget i:ii __msgget msgget -msgctl - msgctl i:iip __msgctl msgctl msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv msgsnd - msgsnd Ci:ibni __msgsnd msgsnd semget - semget i:iii __semget semget diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list index a95c3dd..ead0e99 100644 --- a/sysdeps/unix/sysv/linux/hppa/syscalls.list +++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list @@ -1,7 +1,6 @@ # File name Caller Syscall name # args Strong name Weak names # semaphore and shm system calls -msgctl - msgctl i:iip __msgctl msgctl msgget - msgget i:ii __msgget msgget msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv msgsnd - msgsnd Ci:ibni __msgsnd msgsnd diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list index 68b6c9a..8a66ca9 100644 --- a/sysdeps/unix/sysv/linux/ia64/syscalls.list +++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list @@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2 getpriority - getpriority i:ii __getpriority getpriority # semaphore and shm system calls -msgctl - msgctl i:iip __msgctl msgctl msgget - msgget i:ii __msgget msgget msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv msgsnd - msgsnd Ci:ibni __msgsnd msgsnd diff --git a/sysdeps/unix/sysv/linux/microblaze/msgctl.c b/sysdeps/unix/sysv/linux/microblaze/msgctl.c deleted file mode 100644 index d65a5b9..0000000 --- a/sysdeps/unix/sysv/linux/microblaze/msgctl.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c b/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c index c4dc7ff..928c3dc 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c +++ b/sysdeps/unix/sysv/linux/mips/mips64/msgctl.c @@ -15,18 +15,11 @@ License along with the GNU C Library. If not, see . */ -#include -#include -#include -#include +#include -int __msgctl (int msqid, int cmd, struct msqid_ds *buf); +#undef SHLIB_COMPAT +#define SHLIB_COMPAT(a, b, c) 0 -int -__msgctl (int msqid, int cmd, struct msqid_ds *buf) -{ - return INLINE_SYSCALL (msgctl, 3, msqid, cmd | __IPC_64, buf); -} +#define DEFAULT_VERSION GLIBC_2_0 -#include -versioned_symbol (libc, __msgctl, msgctl, GLIBC_2_0); +#include diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c index e48fbb3..45bf350 100644 --- a/sysdeps/unix/sysv/linux/msgctl.c +++ b/sysdeps/unix/sysv/linux/msgctl.c @@ -16,17 +16,30 @@ License along with the GNU C Library; if not, see . */ -#include #include #include - #include -#include -#include #include +#include + +#ifndef DEFAULT_VERSION +# define DEFAULT_VERSION GLIBC_2_2 +#endif + +int +__new_msgctl (int msqid, int cmd, struct msqid_ds *buf) +{ +#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS + return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf); +#else + return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, + buf); +#endif +} +versioned_symbol (libc, __new_msgctl, msgctl, DEFAULT_VERSION); -#include +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) struct __old_msqid_ds { struct __old_ipc_perm msg_perm; /* structure describing operation permission */ @@ -44,27 +57,15 @@ struct __old_msqid_ds __ipc_pid_t msg_lrpid; /* pid of last msgrcv() */ }; -/* Allows to control internal state and destruction of message queue - objects. */ -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) -int __old_msgctl (int, int, struct __old_msqid_ds *); -#endif -int __new_msgctl (int, int, struct msqid_ds *); - -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) int attribute_compat_text_section __old_msgctl (int msqid, int cmd, struct __old_msqid_ds *buf) { - return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd, 0, buf); +#ifdef __ASSUME_DIRECT_SYSVIPC_SYSCALLS + return INLINE_SYSCALL_CALL (msgctl, msqid, cmd | __IPC_64, buf); +#else + return INLINE_SYSCALL_CALL (ipc, IPCOP_msgctl, msqid, cmd, 0, buf); +#endif } compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0); #endif - -int -__new_msgctl (int msqid, int cmd, struct msqid_ds *buf) -{ - return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf); -} - -versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2); diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list index 9f03d26..808cbbb 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list @@ -1,7 +1,6 @@ # File name Caller Syscall name # args Strong name Weak names # semaphore and shm system calls -msgctl - msgctl i:iip __msgctl msgctl msgget - msgget i:ii __msgget msgget msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv msgsnd - msgsnd Ci:ibni __msgsnd msgsnd diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list index 8aed2f4..4d19d75 100644 --- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list +++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list @@ -2,7 +2,6 @@ arch_prctl EXTRA arch_prctl i:ii __arch_prctl arch_prctl modify_ldt EXTRA modify_ldt i:ipi __modify_ldt modify_ldt -msgctl - msgctl i:iip __msgctl msgctl msgget - msgget i:ii __msgget msgget msgrcv - msgrcv Ci:ibnii __msgrcv msgrcv msgsnd - msgsnd Ci:ibni __msgsnd msgsnd