4 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
5 #include "sysdep-cancel.h"
7 #define SINGLE_THREAD_P 1
14 #define __NR___libc_msgctl __NR_msgctl
15 static __inline__
_syscall3(int, __libc_msgctl
, int, msqid
, int, cmd
, struct msqid_ds
*, buf
)
17 /* Message queue control operation. */
18 int msgctl(int msqid
, int cmd
, struct msqid_ds
*buf
)
21 return __libc_msgctl(msqid
, cmd
| __IPC_64
, buf
);
23 return __syscall_ipc(IPCOP_msgctl
, msqid
, cmd
| __IPC_64
, 0, buf
, 0);
31 _syscall2(int, msgget
, key_t
, key
, int, msgflg
)
33 /* Get messages queue. */
34 int msgget (key_t key
, int msgflg
)
36 return __syscall_ipc(IPCOP_msgget
,key
,msgflg
,0 ,0, 0);
43 struct msgbuf
* oldmsg
;
44 long int r_msgtyp
; /* the fifth arg of __syscall_ipc */
46 /* Receive message from message queue. */
51 #define __NR___syscall_msgrcv __NR_msgrcv
52 static inline _syscall5(ssize_t
, __syscall_msgrcv
, int, msqid
, void *, msgp
,
53 size_t, msgsz
, long int, msgtyp
, int, msgflg
)
55 static inline ssize_t
do_msgrcv (int msqid
, void *msgp
, size_t msgsz
,
56 long int msgtyp
, int msgflg
)
59 return __syscall_msgrcv(msqid
, msgp
, msgsz
, msgtyp
, msgflg
);
61 struct new_msg_buf temp
;
63 temp
.r_msgtyp
= msgtyp
;
65 return __syscall_ipc(IPCOP_msgrcv
,msqid
,msgsz
,msgflg
,&temp
, 0);
68 ssize_t
msgrcv (int msqid
, void *msgp
, size_t msgsz
,
69 long int msgtyp
, int msgflg
)
72 return do_msgrcv(msqid
, msgp
, msgsz
, msgtyp
, msgflg
);
73 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
74 int oldtype
= LIBC_CANCEL_ASYNC ();
75 int result
= do_msgrcv(msqid
, msgp
, msgsz
, msgtyp
, msgflg
);
76 LIBC_CANCEL_RESET (oldtype
);
86 #define __NR___syscall_msgsnd __NR_msgsnd
87 static inline _syscall4(int, __syscall_msgsnd
, int, msqid
, const void *, msgp
,
88 size_t, msgsz
, int, msgflg
)
90 /* Send message to message queue. */
91 static inline int do_msgsnd (int msqid
, const void *msgp
, size_t msgsz
,
95 return __syscall_msgsnd(msqid
, msgp
, msgsz
, msgflg
);
97 return __syscall_ipc(IPCOP_msgsnd
, msqid
, msgsz
, msgflg
, (void *)msgp
, 0);
100 int msgsnd (int msqid
, const void *msgp
, size_t msgsz
, int msgflg
)
103 return do_msgsnd(msqid
, msgp
, msgsz
, msgflg
);
104 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
105 int oldtype
= LIBC_CANCEL_ASYNC ();
106 int result
= do_msgsnd(msqid
, msgp
, msgsz
, msgflg
);
107 LIBC_CANCEL_RESET (oldtype
);