xref: /openbmc/linux/include/uapi/linux/mqueue.h (revision e4624435)
1 /* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
2 /* Copyright (C) 2003 Krzysztof Benedyczak & Michal Wronski
3 
4    This program is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    It is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with this software; if not, write to the Free
16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17    02111-1307 USA.  */
18 
19 #ifndef _LINUX_MQUEUE_H
20 #define _LINUX_MQUEUE_H
21 
22 #include <linux/types.h>
23 
24 #define MQ_PRIO_MAX 	32768
25 /* per-uid limit of kernel memory used by mqueue, in bytes */
26 #define MQ_BYTES_MAX	819200
27 
28 struct mq_attr {
29 	__kernel_long_t	mq_flags;	/* message queue flags			*/
30 	__kernel_long_t	mq_maxmsg;	/* maximum number of messages		*/
31 	__kernel_long_t	mq_msgsize;	/* maximum message size			*/
32 	__kernel_long_t	mq_curmsgs;	/* number of messages currently queued	*/
33 	__kernel_long_t	__reserved[4];	/* ignored for input, zeroed for output */
34 };
35 
36 /*
37  * SIGEV_THREAD implementation:
38  * SIGEV_THREAD must be implemented in user space. If SIGEV_THREAD is passed
39  * to mq_notify, then
40  * - sigev_signo must be the file descriptor of an AF_NETLINK socket. It's not
41  *   necessary that the socket is bound.
42  * - sigev_value.sival_ptr must point to a cookie that is NOTIFY_COOKIE_LEN
43  *   bytes long.
44  * If the notification is triggered, then the cookie is sent to the netlink
45  * socket. The last byte of the cookie is replaced with the NOTIFY_?? codes:
46  * NOTIFY_WOKENUP if the notification got triggered, NOTIFY_REMOVED if it was
47  * removed, either due to a close() on the message queue fd or due to a
48  * mq_notify() that removed the notification.
49  */
50 #define NOTIFY_NONE	0
51 #define NOTIFY_WOKENUP	1
52 #define NOTIFY_REMOVED	2
53 
54 #define NOTIFY_COOKIE_LEN	32
55 
56 #endif
57