xref: /haiku/src/system/libroot/posix/sys/xsi_msg_queue.cpp (revision 7ee53ed3bd2222305c93a4959f8c587c373ed97c)
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 
16 #include <OS.h>
17 
18 #include <errno_private.h>
19 #include <syscall_utils.h>
20 #include <syscalls.h>
21 
22 
23 int
24 msgctl(int messageQueueID, int command, struct msqid_ds *buffer)
25 {
26 	RETURN_AND_SET_ERRNO(_kern_xsi_msgctl(messageQueueID, command, buffer));
27 }
28 
29 
30 int
31 msgget(key_t key, int messageQueueFlags)
32 {
33 	RETURN_AND_SET_ERRNO(_kern_xsi_msgget(key, messageQueueFlags));
34 }
35 
36 
37 ssize_t
38 msgrcv(int messageQueueID, void *messagePointer, size_t messageSize,
39 	long messageType, int messageFlags)
40 {
41 	RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_xsi_msgrcv(messageQueueID,
42 		messagePointer, messageSize, messageType, messageFlags));
43 }
44 
45 
46 int
47 msgsnd(int messageQueueID, const void *messagePointer, size_t messageSize,
48 	int messageFlags)
49 {
50 	RETURN_AND_SET_ERRNO_TEST_CANCEL(_kern_xsi_msgsnd(messageQueueID,
51 		messagePointer, messageSize, messageFlags));
52 }
53