summaryrefslogtreecommitdiffstats
path: root/libc/misc/sysvipc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/sysvipc')
-rw-r--r--libc/misc/sysvipc/Makefile.in2
-rw-r--r--libc/misc/sysvipc/ipc.h2
-rw-r--r--libc/misc/sysvipc/msgq.c51
3 files changed, 54 insertions, 1 deletions
diff --git a/libc/misc/sysvipc/Makefile.in b/libc/misc/sysvipc/Makefile.in
index 44707d643..057a75568 100644
--- a/libc/misc/sysvipc/Makefile.in
+++ b/libc/misc/sysvipc/Makefile.in
@@ -24,6 +24,8 @@ MISC_SYSVIPC_SRC := $(patsubst %.c,$(MISC_SYSVIPC_DIR)/%.c,$(CSRC))
MISC_SYSVIPC_OBJ := $(patsubst %.c,$(MISC_SYSVIPC_OUT)/%.o,$(CSRC))
libc-y += $(MISC_SYSVIPC_OBJ)
+libc-a-y += $(MISC_SYSVIPC_OBJ)
+libc-so-y += $(MISC_SYSVIPC_OBJ:.o=.os)
objclean-y += misc_sysvipc_objclean
diff --git a/libc/misc/sysvipc/ipc.h b/libc/misc/sysvipc/ipc.h
index ffc07daf9..62c035b20 100644
--- a/libc/misc/sysvipc/ipc.h
+++ b/libc/misc/sysvipc/ipc.h
@@ -3,7 +3,7 @@
#include <syscall.h>
#include <bits/wordsize.h>
-#if __WORDSIZE == 32
+#if __WORDSIZE == 32 || defined __alpha__
# define __IPC_64 0x100
#else
# define __IPC_64 0x0
diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c
index f56bb4e8a..5f695084a 100644
--- a/libc/misc/sysvipc/msgq.c
+++ b/libc/misc/sysvipc/msgq.c
@@ -42,6 +42,34 @@ struct new_msg_buf{
#ifdef L_msgrcv
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <sysdep-cancel.h>
+
+int
+__libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg)
+{
+ /* The problem here is that Linux' calling convention only allows up to
+ fives parameters to a system call. */
+ struct new_msg_buf tmp;
+
+ tmp.oldmsg = msgp;
+ tmp.r_msgtyp = msgtyp;
+
+ if (SINGLE_THREAD_P)
+ return INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
+ __ptrvalue (&tmp));
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
+ __ptrvalue (&tmp));
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+weak_alias(__libc_msgrcv, msgrcv)
+#else
#ifdef __NR_msgrcv
_syscall5(int, msgrcv, int, msqid, void *, msgp, size_t, msgsz, long int, msgtyp, int, msgflg);
#else
@@ -56,10 +84,32 @@ int msgrcv (int msqid, void *msgp, size_t msgsz,
}
#endif
#endif
+#endif
#ifdef L_msgsnd
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include <sysdep-cancel.h>
+
+int
+__libc_msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
+{
+ if (SINGLE_THREAD_P)
+ return INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
+ msgflg, msgp);
+
+ int oldtype = LIBC_CANCEL_ASYNC ();
+
+ int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
+ msgflg, msgp);
+
+ LIBC_CANCEL_RESET (oldtype);
+
+ return result;
+}
+weak_alias(__libc_msgsnd, msgsnd)
+#else
#ifdef __NR_msgsnd
_syscall4(int, msgsnd, int, msqid, const void *, msgp, size_t, msgsz, int, msgflg);
#else
@@ -70,4 +120,5 @@ int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
}
#endif
#endif
+#endif