From patchwork Mon Oct 27 07:59:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 39573 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A88882118A for ; Mon, 27 Oct 2014 08:01:57 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id k14sf356145wgh.3 for ; Mon, 27 Oct 2014 01:01:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results; bh=hRljmrCAgtXUapfL+YnXZPNUMJP1leMHbKl0NnaOuqE=; b=ieWeaH7NakEqARi1yntMewS1ROtN9258Mih/8RXVEHnee0umK/5ZeaP7hQPC9Txgyd C8XSNScfLF6k8RPJNjgfRRehErlMrrkU5i2orbQkPuupYojTNjlWOkVMesNX5O1cM+7x Gm1+XCBrm0uYmaOmzpDsL+haKf8w4aKHCA9pgGJHxzv0k0UHyZpbrc5Qecwhgh7JLuNI +jc7Kjcta9y1YwVTIUVPbDOt6kgojpnljMgirFbiIm/6Nl+2up0o+UuNk3ENNCRe9WPf z0qG4CzrNCWM4INk9WPxyx52Tuw+Ftyl+HngJ/SW7VC+0oVpF6M6DVIZuTYIi+rapHT2 l3HA== X-Gm-Message-State: ALoCoQkqfWjyPRDbtHKKbjFiB9KfE8lBTnir7I8uktGBIrbPydEJ5BKMa8SNtGV9oCuCCR1vgq/l X-Received: by 10.112.225.135 with SMTP id rk7mr5205771lbc.6.1414396916625; Mon, 27 Oct 2014 01:01:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.197.100 with SMTP id it4ls666686lac.7.gmail; Mon, 27 Oct 2014 01:01:55 -0700 (PDT) X-Received: by 10.112.48.3 with SMTP id h3mr21920609lbn.71.1414396915853; Mon, 27 Oct 2014 01:01:55 -0700 (PDT) Received: from mail-la0-x230.google.com (mail-la0-x230.google.com. [2a00:1450:4010:c03::230]) by mx.google.com with ESMTPS id i9si18609209lag.115.2014.10.27.01.01.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 01:01:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::230 as permitted sender) client-ip=2a00:1450:4010:c03::230; Received: by mail-la0-f48.google.com with SMTP id gi9so5413295lab.35 for ; Mon, 27 Oct 2014 01:01:55 -0700 (PDT) X-Received: by 10.153.8.164 with SMTP id dl4mr21681961lad.29.1414396915378; Mon, 27 Oct 2014 01:01:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp247384lbz; Mon, 27 Oct 2014 01:01:54 -0700 (PDT) X-Received: by 10.66.191.232 with SMTP id hb8mr8644821pac.117.1414396913708; Mon, 27 Oct 2014 01:01:53 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id tb10si9788766pbc.219.2014.10.27.01.01.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Oct 2014 01:01:53 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-53805-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 15698 invoked by alias); 27 Oct 2014 08:00:05 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 15299 invoked by uid 89); 27 Oct 2014 08:00:01 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-ie0-f170.google.com X-Received: by 10.107.133.234 with SMTP id p103mr6030336ioi.7.1414396797369; Mon, 27 Oct 2014 00:59:57 -0700 (PDT) From: Andrew Pinski To: libc-alpha@sourceware.org Cc: Andrew Pinski Subject: [PATCH 03/29] Add ability for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) to have time_t being 64bit Date: Mon, 27 Oct 2014 00:59:27 -0700 Message-Id: <1414396793-9005-4-git-send-email-apinski@cavium.com> In-Reply-To: <1414396793-9005-1-git-send-email-apinski@cavium.com> References: <1414396793-9005-1-git-send-email-apinski@cavium.com> X-Original-Sender: apinski@cavium.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::230 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 The generic headers for the IPC structures (msqid_ds, semid_ds, shmid_ds, etc.) already have the ability to already take account time_t being 64bit but only if WORDSIZE is set 64. Also for AARCH64:ILP32, we want these structures to match up with the LP64 size, so we add change the all of the unsigned long types in these headers to be __syscall_ulong_t. Also there is one size_t field which we need to be changed for AARCH64:ILP32 so we add a macro which can be changed but defaulting to size_t. * sysdeps/unix/sysv/linux/generic/bits/msq.h (msgqnum_t): Change to __syscall_ulong_t. (msglen_t): Likewise. (__IPC_TIME_T_64_BITS): Define if not defined already and WORDSIZE is 64. (struct msqid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS. Also change some unsigned long fields to __syscall_ulong_t. * sysdeps/unix/sysv/linux/generic/bits/sem.h (__IPC_TIME_T_64_BITS): Define if not defined already and WORDSIZE is 64. (struct semid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS. Also change some unsigned long fields to __syscall_ulong_t. * sysdeps/unix/sysv/linux/generic/bits/shm.h (__IPC_TIME_T_64_BITS): Define if not defined already and WORDSIZE is 64. (__SHMID_DS_SIZE_TYPE): Define if not already defined. (struct shmid_ds): Change WORD_SIZE check to check __IPC_TIME_T_64_BITS. Change shm_segsz definition to be based on __SHMID_DS_SIZE_TYPE. Also change some unsigned long fields to __syscall_ulong_t. (struct shminfo): change some unsigned long fields to __syscall_ulong_t. (struct shm_info): Likewise. --- sysdeps/unix/sysv/linux/generic/bits/msq.h | 21 +++++++---- sysdeps/unix/sysv/linux/generic/bits/sem.h | 14 +++++--- sysdeps/unix/sysv/linux/generic/bits/shm.h | 50 ++++++++++++++++------------ 3 files changed, 51 insertions(+), 34 deletions(-) diff --git a/sysdeps/unix/sysv/linux/generic/bits/msq.h b/sysdeps/unix/sysv/linux/generic/bits/msq.h index f3fcd8d..df5128e 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/msq.h +++ b/sysdeps/unix/sysv/linux/generic/bits/msq.h @@ -31,8 +31,13 @@ #endif /* Types used in the structure definition. */ -typedef unsigned long int msgqnum_t; -typedef unsigned long int msglen_t; +typedef __syscall_ulong_t msgqnum_t; +typedef __syscall_ulong_t msglen_t; + +#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64 +#define __IPC_TIME_T_64_BITS +#endif + /* Structure of record for one message inside the kernel. The type `struct msg' is opaque. */ @@ -40,24 +45,24 @@ struct msqid_ds { struct ipc_perm msg_perm; /* structure describing operation permission */ __time_t msg_stime; /* time of last msgsnd command */ -#if __WORDSIZE == 32 +#ifndef __IPC_TIME_T_64_BITS unsigned long int __glibc_reserved1; #endif __time_t msg_rtime; /* time of last msgrcv command */ -#if __WORDSIZE == 32 +#ifndef __IPC_TIME_T_64_BITS unsigned long int __glibc_reserved2; #endif __time_t msg_ctime; /* time of last change */ -#if __WORDSIZE == 32 +#ifndef __IPC_TIME_T_64_BITS unsigned long int __glibc_reserved3; #endif - unsigned long int __msg_cbytes; /* current number of bytes on queue */ + __syscall_ulong_t __msg_cbytes; /* current number of bytes on queue */ msgqnum_t msg_qnum; /* number of messages currently on queue */ msglen_t msg_qbytes; /* max number of bytes allowed on queue */ __pid_t msg_lspid; /* pid of last msgsnd() */ __pid_t msg_lrpid; /* pid of last msgrcv() */ - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; + __syscall_ulong_t __glibc_reserved4; + __syscall_ulong_t __glibc_reserved5; }; #ifdef __USE_MISC diff --git a/sysdeps/unix/sysv/linux/generic/bits/sem.h b/sysdeps/unix/sysv/linux/generic/bits/sem.h index 3c9aea8..a0a5d47 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/sem.h +++ b/sysdeps/unix/sysv/linux/generic/bits/sem.h @@ -36,21 +36,25 @@ #define SETALL 17 /* set all semval's */ +#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64 +#define __IPC_TIME_T_64_BITS +#endif + /* Data structure describing a set of semaphores. */ struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ -#if __WORDSIZE == 32 +#ifndef __IPC_TIME_T_64_BITS unsigned long int __glibc_reserved1; #endif __time_t sem_ctime; /* last time changed by semctl() */ -#if __WORDSIZE == 32 +#ifndef __IPC_TIME_T_64_BITS unsigned long int __glibc_reserved2; #endif - unsigned long int sem_nsems; /* number of semaphores in set */ - unsigned long int __glibc_reserved3; - unsigned long int __glibc_reserved4; + __syscall_ulong_t sem_nsems; /* number of semaphores in set */ + __syscall_ulong_t __glibc_reserved3; + __syscall_ulong_t __glibc_reserved4; }; /* The user should define a union like the following to use it for arguments diff --git a/sysdeps/unix/sysv/linux/generic/bits/shm.h b/sysdeps/unix/sysv/linux/generic/bits/shm.h index 0dbed61..78ff79d 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/shm.h +++ b/sysdeps/unix/sysv/linux/generic/bits/shm.h @@ -44,31 +44,39 @@ __BEGIN_DECLS extern int __getpagesize (void) __THROW __attribute__ ((__const__)); +#if !defined(__IPC_TIME_T_64_BITS) && __WORDSIZE == 64 +#define __IPC_TIME_T_64_BITS +#endif + /* Type to count number of attaches. */ -typedef unsigned long int shmatt_t; +typedef __syscall_ulong_t shmatt_t; + +#ifndef __SHMID_DS_SIZE_TYPE +#define __SHMID_DS_SIZE_TYPE(field) size_t field +#endif /* Data structure describing a shared memory segment. */ struct shmid_ds { struct ipc_perm shm_perm; /* operation permission struct */ - size_t shm_segsz; /* size of segment in bytes */ + __SHMID_DS_SIZE_TYPE(shm_segsz); /* size of segment in bytes */ __time_t shm_atime; /* time of last shmat() */ -#if __WORDSIZE == 32 +#ifndef __IPC_TIME_T_64_BITS unsigned long int __glibc_reserved1; #endif __time_t shm_dtime; /* time of last shmdt() */ -#if __WORDSIZE == 32 +#ifndef __IPC_TIME_T_64_BITS unsigned long int __glibc_reserved2; #endif __time_t shm_ctime; /* time of last change by shmctl() */ -#if __WORDSIZE == 32 +#ifndef __IPC_TIME_T_64_BITS unsigned long int __glibc_reserved3; #endif __pid_t shm_cpid; /* pid of creator */ __pid_t shm_lpid; /* pid of last shmop */ shmatt_t shm_nattch; /* number of current attaches */ - unsigned long int __glibc_reserved4; - unsigned long int __glibc_reserved5; + __syscall_ulong_t __glibc_reserved4; + __syscall_ulong_t __glibc_reserved5; }; #ifdef __USE_MISC @@ -85,25 +93,25 @@ struct shmid_ds struct shminfo { - unsigned long int shmmax; - unsigned long int shmmin; - unsigned long int shmmni; - unsigned long int shmseg; - unsigned long int shmall; - unsigned long int __glibc_reserved1; - unsigned long int __glibc_reserved2; - unsigned long int __glibc_reserved3; - unsigned long int __glibc_reserved4; + __syscall_ulong_t shmmax; + __syscall_ulong_t shmmin; + __syscall_ulong_t shmmni; + __syscall_ulong_t shmseg; + __syscall_ulong_t shmall; + __syscall_ulong_t __glibc_reserved1; + __syscall_ulong_t __glibc_reserved2; + __syscall_ulong_t __glibc_reserved3; + __syscall_ulong_t __glibc_reserved4; }; struct shm_info { int used_ids; - unsigned long int shm_tot; /* total allocated shm */ - unsigned long int shm_rss; /* total resident shm */ - unsigned long int shm_swp; /* total swapped shm */ - unsigned long int swap_attempts; - unsigned long int swap_successes; + __syscall_ulong_t shm_tot; /* total allocated shm */ + __syscall_ulong_t shm_rss; /* total resident shm */ + __syscall_ulong_t shm_swp; /* total swapped shm */ + __syscall_ulong_t swap_attempts; + __syscall_ulong_t swap_successes; }; #endif /* __USE_MISC */