From patchwork Thu Feb 6 13:13:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Murzin X-Patchwork-Id: 1234346 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=uclibc-ng.org (client-ip=89.238.66.15; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48CzR92w2Bz9sRX for ; Fri, 7 Feb 2020 00:14:12 +1100 (AEDT) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id B9F8010113; Thu, 6 Feb 2020 14:14:07 +0100 (CET) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by helium.openadk.org (Postfix) with ESMTP id D89CD10113 for ; Thu, 6 Feb 2020 14:14:04 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C54430E for ; Thu, 6 Feb 2020 05:14:06 -0800 (PST) Received: from login2.euhpc.arm.com. (login2.euhpc.arm.com [10.6.27.34]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D4A2A3F68E for ; Thu, 6 Feb 2020 05:14:05 -0800 (PST) From: Vladimir Murzin To: devel@uclibc-ng.org Date: Thu, 6 Feb 2020 13:13:54 +0000 Message-Id: <1580994834-3511-1-git-send-email-vladimir.murzin@arm.com> X-Mailer: git-send-email 2.0.0 Subject: [uclibc-ng-devel] [RFC PATCH] common/bits: Fix ipc_perm and semid_ds definitions for 64-bit arches X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" It fixes: FAIL sem got 1 expected 0 failed: incorrect sem_nsems! semget(IPC_CREAT) = 0 semctl(k) = 0 sem_nsems = 0 for aarch64. Signed-off-by: Vladimir Murzin --- I'm not really sure if it has negative effect on other arches... libc/sysdeps/linux/common/bits/ipc.h | 5 +++++ libc/sysdeps/linux/common/bits/sem.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/libc/sysdeps/linux/common/bits/ipc.h b/libc/sysdeps/linux/common/bits/ipc.h index 3bd5f1b..ca7f58c 100644 --- a/libc/sysdeps/linux/common/bits/ipc.h +++ b/libc/sysdeps/linux/common/bits/ipc.h @@ -20,6 +20,7 @@ #endif #include +#include /* Mode bits for `msgget', `semget', and `shmget'. */ #define IPC_CREAT 01000 /* Create key if key does not exist. */ @@ -46,8 +47,12 @@ struct ipc_perm __gid_t gid; /* Owner's group ID. */ __uid_t cuid; /* Creator's user ID. */ __gid_t cgid; /* Creator's group ID. */ +#if __WORDSIZE == 64 + unsigned int mode; +#else unsigned short int mode; /* Read/write permission. */ unsigned short int __pad1; +#endif unsigned short int __seq; /* Sequence number. */ unsigned short int __pad2; unsigned long int __unused1; diff --git a/libc/sysdeps/linux/common/bits/sem.h b/libc/sysdeps/linux/common/bits/sem.h index 501e080..3fb10d4 100644 --- a/libc/sysdeps/linux/common/bits/sem.h +++ b/libc/sysdeps/linux/common/bits/sem.h @@ -20,6 +20,7 @@ #endif #include +#include /* Flags for `semop'. */ #define SEM_UNDO 0x1000 /* undo the operation on exit */ @@ -39,9 +40,13 @@ struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ __time_t sem_otime; /* last semop() time */ +#if __WORDSIZE == 32 unsigned long int __unused1; +#endif __time_t sem_ctime; /* last time changed by semctl() */ +#if __WORDSIZE == 32 unsigned long int __unused2; +#endif unsigned long int sem_nsems; /* number of semaphores in set */ unsigned long int __unused3; unsigned long int __unused4;