From 23f088cd74b3c1da7aed07e5984970d38c85cd03 Mon Sep 17 00:00:00 2001 From: Nikola Veljkovic Date: Fri, 9 Sep 2016 02:01:01 +0200 Subject: [PATCH] [mips64] Fix ipc syscalls Mips defines CONFIG_ARCH_WANT_IPC_PARSE_VERSION for both 32 and 64-bit. See arch/mips/Kconfig. Other supported arches do it for 32-bit only. This translates in having to pass IPC_64 flag for mips32 and mips64. We use __mips__ to pass the flag, which is also defined for both 32 and 64-bit. Change fixes bionic smoke tests (sys_msg, sys_sem, sys_shm) for mips64. Test: bionic-unit-tests --gtest_filter="sys_*.smoke" Change-Id: I918e4ffafd2002bb3e62ee252406746778100031 --- libc/bionic/sys_msg.cpp | 3 ++- libc/bionic/sys_sem.cpp | 3 ++- libc/bionic/sys_shm.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libc/bionic/sys_msg.cpp b/libc/bionic/sys_msg.cpp index 462c83b2f..488035696 100644 --- a/libc/bionic/sys_msg.cpp +++ b/libc/bionic/sys_msg.cpp @@ -32,8 +32,9 @@ #include int msgctl(int id, int cmd, msqid_ds* buf) { -#if !defined(__LP64__) +#if !defined(__LP64__) || defined(__mips__) // Annoyingly, the kernel requires this for 32-bit but rejects it for 64-bit. + // Mips64 is an exception to this, it requires the flag. cmd |= IPC_64; #endif #if defined(SYS_msgctl) diff --git a/libc/bionic/sys_sem.cpp b/libc/bionic/sys_sem.cpp index 058cfefc8..5e2a05c29 100644 --- a/libc/bionic/sys_sem.cpp +++ b/libc/bionic/sys_sem.cpp @@ -33,8 +33,9 @@ #include int semctl(int id, int num, int cmd, ...) { -#if !defined(__LP64__) +#if !defined(__LP64__) || defined(__mips__) // Annoyingly, the kernel requires this for 32-bit but rejects it for 64-bit. + // Mips64 is an exception to this, it requires the flag. cmd |= IPC_64; #endif va_list ap; diff --git a/libc/bionic/sys_shm.cpp b/libc/bionic/sys_shm.cpp index f780e04d4..f3b26e79c 100644 --- a/libc/bionic/sys_shm.cpp +++ b/libc/bionic/sys_shm.cpp @@ -45,8 +45,9 @@ void* shmat(int id, const void* address, int flags) { } int shmctl(int id, int cmd, struct shmid_ds* buf) { -#if !defined(__LP64__) +#if !defined(__LP64__) || defined(__mips__) // Annoyingly, the kernel requires this for 32-bit but rejects it for 64-bit. + // Mips64 is an exception to this, it requires the flag. cmd |= IPC_64; #endif #if defined(SYS_shmctl) -- 2.11.0