xref: /haiku/src/system/libroot/posix/sys/xsi_msg_queue.cpp (revision a127b88ecbfab58f64944c98aa47722a18e363b2)
1 /*
2  * Copyright 2008, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Salvatore Benedetto <salvatore.benedetto@gmail.com>
7  */
8 
9 #include <sys/msg.h>
10 
11 #include <errno.h>
12 #include <fcntl.h>
13 #include <stdarg.h>
14 #include <stdlib.h>
15 #include <pthread.h>
16 
17 #include <OS.h>
18 
19 #include <errno_private.h>
20 #include <syscall_utils.h>
21 #include <syscalls.h>
22 
23 
24 int
25 msgctl(int messageQueueID, int command, struct msqid_ds *buffer)
26 {
27 	RETURN_AND_SET_ERRNO(_kern_xsi_msgctl(messageQueueID, command, buffer));
28 }
29 
30 
31 int
32 msgget(key_t key, int messageQueueFlags)
33 {
34 	RETURN_AND_SET_ERRNO(_kern_xsi_msgget(key, messageQueueFlags));
35 }
36 
37 
38 ssize_t
39 msgrcv(int messageQueueID, void *messagePointer, size_t messageSize,
40 	long messageType, int messageFlags)
41 {
42 	RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_xsi_msgrcv(messageQueueID,
43 		messagePointer, messageSize, messageType, messageFlags));
44 }
45 
46 
47 int
48 msgsnd(int messageQueueID, const void *messagePointer, size_t messageSize,
49 	int messageFlags)
50 {
51 	RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_xsi_msgsnd(messageQueueID,
52 		messagePointer, messageSize, messageFlags));
53 }
54