Fix mips build.
Tests still pass on arm/aarch64/x86/x86-64.
Change-Id: I6a17b5bca356dbc7273b5427c68d538c0dd6deed
diff --git a/libc/bionic/sys_msg.cpp b/libc/bionic/sys_msg.cpp
index 9d2dc0e..462c83b 100644
--- a/libc/bionic/sys_msg.cpp
+++ b/libc/bionic/sys_msg.cpp
@@ -36,33 +36,33 @@
// Annoyingly, the kernel requires this for 32-bit but rejects it for 64-bit.
cmd |= IPC_64;
#endif
-#if __i386__
- return syscall(SYS_ipc, MSGCTL, id, cmd, 0, buf, 0);
-#else
+#if defined(SYS_msgctl)
return syscall(SYS_msgctl, id, cmd, buf);
+#else
+ return syscall(SYS_ipc, MSGCTL, id, cmd, 0, buf, 0);
#endif
}
int msgget(key_t key, int flags) {
-#if __i386__
- return syscall(SYS_ipc, MSGGET, key, flags, 0, 0, 0);
-#else
+#if defined(SYS_msgget)
return syscall(SYS_msgget, key, flags);
+#else
+ return syscall(SYS_ipc, MSGGET, key, flags, 0, 0, 0);
#endif
}
ssize_t msgrcv(int id, void* msg, size_t n, long type, int flags) {
-#if __i386__
- return syscall(SYS_ipc, IPCCALL(1, MSGRCV), id, n, flags, msg, type);
-#else
+#if defined(SYS_msgrcv)
return syscall(SYS_msgrcv, id, msg, n, type, flags);
+#else
+ return syscall(SYS_ipc, IPCCALL(1, MSGRCV), id, n, flags, msg, type);
#endif
}
int msgsnd(int id, const void* msg, size_t n, int flags) {
-#if __i386__
- return syscall(SYS_ipc, MSGSND, id, n, flags, msg, 0);
-#else
+#if defined(SYS_msgsnd)
return syscall(SYS_msgsnd, id, msg, n, flags);
+#else
+ return syscall(SYS_ipc, MSGSND, id, n, flags, msg, 0);
#endif
}