summaryrefslogtreecommitdiffstats
path: root/libc/misc/sysvipc/msgq.c
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2006-08-24 02:51:45 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2006-08-24 02:51:45 +0000
commitd2db9bdb4c79afcd4b09353346cd4eaf63b6cd2c (patch)
tree6f5cb1fa2fc62027df2614e8f8498f3eea8bc465 /libc/misc/sysvipc/msgq.c
parente116018ce23fc3dcee95c2c23f9f4f7b54acd92e (diff)
downloaduClibc-alpine-d2db9bdb4c79afcd4b09353346cd4eaf63b6cd2c.tar.bz2
uClibc-alpine-d2db9bdb4c79afcd4b09353346cd4eaf63b6cd2c.tar.xz
Merge from trunk and bring in NPTL code in the various 'misc' subsystems.
Diffstat (limited to 'libc/misc/sysvipc/msgq.c')
-rw-r--r--libc/misc/sysvipc/msgq.c51
1 files changed, 51 insertions, 0 deletions
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