blob: 93c0747ce500445d5689aba9f94e425de1914752 [file] [log] [blame]
Benjamin Walsh456c6da2016-09-02 18:55:39 -04001/*
2 * Copyright (c) 2016 Wind River Systems, Inc.
3 *
David B. Kinderac74d8b2017-01-18 17:01:01 -08004 * SPDX-License-Identifier: Apache-2.0
Benjamin Walsh456c6da2016-09-02 18:55:39 -04005 */
6
7/**
8 * @file
9 * @brief Message queues.
10 */
11
12
13#include <kernel.h>
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050014#include <kernel_structs.h>
Anas Nashif569f0b42016-12-17 13:18:45 -050015#include <debug/object_tracing_common.h>
Benjamin Walsh456c6da2016-09-02 18:55:39 -040016#include <toolchain.h>
Anas Nashif397d29d2017-06-17 11:30:47 -040017#include <linker/sections.h>
Benjamin Walsh456c6da2016-09-02 18:55:39 -040018#include <string.h>
Stephanos Ioannidis2d746042019-10-25 00:08:21 +090019#include <ksched.h>
Benjamin Walsh456c6da2016-09-02 18:55:39 -040020#include <wait_q.h>
Anas Nashifee9dd1a2019-06-26 10:33:41 -040021#include <sys/dlist.h>
Anas Nashif6ecadb02019-06-26 10:33:45 -040022#include <sys/math_extras.h>
Allan Stephense7d2cc22016-10-19 16:10:46 -050023#include <init.h>
Andrew Boie82edb6e2017-10-02 10:53:06 -070024#include <syscall_handler.h>
Andy Ross4f911e12018-09-05 10:13:38 -070025#include <kernel_internal.h>
Anas Nashif11b93652019-06-16 08:43:48 -040026#include <sys/check.h>
Allan Stephense7d2cc22016-10-19 16:10:46 -050027
Anas Nashif2f203c22016-12-18 06:57:45 -050028#ifdef CONFIG_OBJECT_TRACING
Allan Stephense7d2cc22016-10-19 16:10:46 -050029
Maciek Borzecki059544d2017-05-18 12:16:45 +020030struct k_msgq *_trace_list_k_msgq;
31
Allan Stephense7d2cc22016-10-19 16:10:46 -050032/*
33 * Complete initialization of statically defined message queues.
34 */
Tomasz Bursztykae18fcbb2020-04-30 20:33:38 +020035static int init_msgq_module(const struct device *dev)
Allan Stephense7d2cc22016-10-19 16:10:46 -050036{
37 ARG_UNUSED(dev);
38
Nicolas Pitreaa9228852019-06-03 13:01:43 -040039 Z_STRUCT_SECTION_FOREACH(k_msgq, msgq) {
Allan Stephense7d2cc22016-10-19 16:10:46 -050040 SYS_TRACING_OBJ_INIT(k_msgq, msgq);
41 }
42 return 0;
43}
44
Andrew Boie0b474ee2016-11-08 11:06:55 -080045SYS_INIT(init_msgq_module, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_OBJECTS);
Allan Stephense7d2cc22016-10-19 16:10:46 -050046
Anas Nashif2f203c22016-12-18 06:57:45 -050047#endif /* CONFIG_OBJECT_TRACING */
Benjamin Walsh456c6da2016-09-02 18:55:39 -040048
Anas Nashif7bde81f2019-06-19 07:30:50 -040049void k_msgq_init(struct k_msgq *msgq, char *buffer, size_t msg_size,
Kumar Galaa1b77fd2020-05-27 11:26:57 -050050 uint32_t max_msgs)
Benjamin Walsh456c6da2016-09-02 18:55:39 -040051{
Anas Nashif7bde81f2019-06-19 07:30:50 -040052 msgq->msg_size = msg_size;
53 msgq->max_msgs = max_msgs;
54 msgq->buffer_start = buffer;
55 msgq->buffer_end = buffer + (max_msgs * msg_size);
56 msgq->read_ptr = buffer;
57 msgq->write_ptr = buffer;
58 msgq->used_msgs = 0;
59 msgq->flags = 0;
60 z_waitq_init(&msgq->wait_q);
61 msgq->lock = (struct k_spinlock) {};
Andrew Boie945af952017-08-22 13:15:23 -070062
Anas Nashif7bde81f2019-06-19 07:30:50 -040063 SYS_TRACING_OBJ_INIT(k_msgq, msgq);
64
65 z_object_init(msgq);
Benjamin Walsh456c6da2016-09-02 18:55:39 -040066}
67
Anas Nashif7bde81f2019-06-19 07:30:50 -040068int z_impl_k_msgq_alloc_init(struct k_msgq *msgq, size_t msg_size,
Kumar Galaa1b77fd2020-05-27 11:26:57 -050069 uint32_t max_msgs)
Andrew Boie82edb6e2017-10-02 10:53:06 -070070{
Andrew Boie0fe789f2018-04-12 18:35:56 -070071 void *buffer;
72 int ret;
73 size_t total_size;
Andrew Boie82edb6e2017-10-02 10:53:06 -070074
Jakob Olesenc8708d92019-05-07 10:17:35 -070075 if (size_mul_overflow(msg_size, max_msgs, &total_size)) {
Andrew Boie0fe789f2018-04-12 18:35:56 -070076 ret = -EINVAL;
77 } else {
78 buffer = z_thread_malloc(total_size);
Flavio Ceolinea716bf2018-09-20 16:30:45 -070079 if (buffer != NULL) {
Anas Nashif7bde81f2019-06-19 07:30:50 -040080 k_msgq_init(msgq, buffer, msg_size, max_msgs);
81 msgq->flags = K_MSGQ_FLAG_ALLOC;
Andrew Boie0fe789f2018-04-12 18:35:56 -070082 ret = 0;
83 } else {
84 ret = -ENOMEM;
85 }
86 }
87
88 return ret;
89}
90
91#ifdef CONFIG_USERSPACE
Andy Ross65649742019-08-06 13:34:31 -070092int z_vrfy_k_msgq_alloc_init(struct k_msgq *q, size_t msg_size,
Kumar Galaa1b77fd2020-05-27 11:26:57 -050093 uint32_t max_msgs)
Andrew Boie0fe789f2018-04-12 18:35:56 -070094{
Andrew Boie8345e5e2018-05-04 15:57:57 -070095 Z_OOPS(Z_SYSCALL_OBJ_NEVER_INIT(q, K_OBJ_MSGQ));
Andrew Boie0fe789f2018-04-12 18:35:56 -070096
Andy Ross65649742019-08-06 13:34:31 -070097 return z_impl_k_msgq_alloc_init(q, msg_size, max_msgs);
Andrew Boie82edb6e2017-10-02 10:53:06 -070098}
Andy Ross65649742019-08-06 13:34:31 -070099#include <syscalls/k_msgq_alloc_init_mrsh.c>
Andrew Boie82edb6e2017-10-02 10:53:06 -0700100#endif
101
Anas Nashif11b93652019-06-16 08:43:48 -0400102int k_msgq_cleanup(struct k_msgq *msgq)
Andrew Boie0fe789f2018-04-12 18:35:56 -0700103{
Anas Nashif11b93652019-06-16 08:43:48 -0400104 CHECKIF(z_waitq_head(&msgq->wait_q) != NULL) {
105 return -EBUSY;
106 }
Andrew Boie0fe789f2018-04-12 18:35:56 -0700107
Anas Nashif7bde81f2019-06-19 07:30:50 -0400108 if ((msgq->flags & K_MSGQ_FLAG_ALLOC) != 0) {
109 k_free(msgq->buffer_start);
110 msgq->flags &= ~K_MSGQ_FLAG_ALLOC;
Andrew Boie0fe789f2018-04-12 18:35:56 -0700111 }
Anas Nashif11b93652019-06-16 08:43:48 -0400112 return 0;
Andrew Boie0fe789f2018-04-12 18:35:56 -0700113}
114
115
Andy Ross78327382020-03-05 15:18:14 -0800116int z_impl_k_msgq_put(struct k_msgq *msgq, void *data, k_timeout_t timeout)
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400117{
Andy Ross78327382020-03-05 15:18:14 -0800118 __ASSERT(!arch_is_in_isr() || K_TIMEOUT_EQ(timeout, K_NO_WAIT), "");
Benjamin Walsh8215ce12016-11-09 19:45:19 -0500119
Benjamin Walshb7ef0cb2016-10-05 17:32:01 -0400120 struct k_thread *pending_thread;
Anas Nashif7bde81f2019-06-19 07:30:50 -0400121 k_spinlock_key_t key;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400122 int result;
123
Anas Nashif7bde81f2019-06-19 07:30:50 -0400124 key = k_spin_lock(&msgq->lock);
125
126 if (msgq->used_msgs < msgq->max_msgs) {
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400127 /* message queue isn't full */
Anas Nashif7bde81f2019-06-19 07:30:50 -0400128 pending_thread = z_unpend_first_thread(&msgq->wait_q);
Flavio Ceolinea716bf2018-09-20 16:30:45 -0700129 if (pending_thread != NULL) {
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400130 /* give message to waiting thread */
Flavio Ceolin66994232018-08-13 15:17:04 -0700131 (void)memcpy(pending_thread->base.swap_data, data,
Anas Nashif7bde81f2019-06-19 07:30:50 -0400132 msgq->msg_size);
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400133 /* wake up waiting thread */
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800134 arch_thread_return_value_set(pending_thread, 0);
Patrik Flykt4344e272019-03-08 14:19:05 -0700135 z_ready_thread(pending_thread);
Anas Nashif7bde81f2019-06-19 07:30:50 -0400136 z_reschedule(&msgq->lock, key);
Andy Ross8606fab2018-03-26 10:54:40 -0700137 return 0;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400138 } else {
139 /* put message in queue */
Anas Nashif7bde81f2019-06-19 07:30:50 -0400140 (void)memcpy(msgq->write_ptr, data, msgq->msg_size);
141 msgq->write_ptr += msgq->msg_size;
142 if (msgq->write_ptr == msgq->buffer_end) {
143 msgq->write_ptr = msgq->buffer_start;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400144 }
Anas Nashif7bde81f2019-06-19 07:30:50 -0400145 msgq->used_msgs++;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400146 }
147 result = 0;
Andy Ross78327382020-03-05 15:18:14 -0800148 } else if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) {
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400149 /* don't wait for message space to become available */
150 result = -ENOMSG;
151 } else {
152 /* wait for put message success, failure, or timeout */
Benjamin Walshf6ca7de2016-11-08 10:36:50 -0500153 _current->base.swap_data = data;
Anas Nashif7bde81f2019-06-19 07:30:50 -0400154 return z_pend_curr(&msgq->lock, key, &msgq->wait_q, timeout);
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400155 }
156
Anas Nashif7bde81f2019-06-19 07:30:50 -0400157 k_spin_unlock(&msgq->lock, key);
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400158
159 return result;
160}
161
Andrew Boie82edb6e2017-10-02 10:53:06 -0700162#ifdef CONFIG_USERSPACE
Andy Ross78327382020-03-05 15:18:14 -0800163static inline int z_vrfy_k_msgq_put(struct k_msgq *q, void *data,
164 k_timeout_t timeout)
Andrew Boie82edb6e2017-10-02 10:53:06 -0700165{
Andrew Boie8345e5e2018-05-04 15:57:57 -0700166 Z_OOPS(Z_SYSCALL_OBJ(q, K_OBJ_MSGQ));
167 Z_OOPS(Z_SYSCALL_MEMORY_READ(data, q->msg_size));
Andrew Boie82edb6e2017-10-02 10:53:06 -0700168
Andy Ross65649742019-08-06 13:34:31 -0700169 return z_impl_k_msgq_put(q, data, timeout);
Andrew Boie82edb6e2017-10-02 10:53:06 -0700170}
Andy Ross65649742019-08-06 13:34:31 -0700171#include <syscalls/k_msgq_put_mrsh.c>
Andrew Boie82edb6e2017-10-02 10:53:06 -0700172#endif
173
Anas Nashif7bde81f2019-06-19 07:30:50 -0400174void z_impl_k_msgq_get_attrs(struct k_msgq *msgq, struct k_msgq_attrs *attrs)
Youvedeep Singh188c1ab2018-03-19 20:02:40 +0530175{
Anas Nashif7bde81f2019-06-19 07:30:50 -0400176 attrs->msg_size = msgq->msg_size;
177 attrs->max_msgs = msgq->max_msgs;
178 attrs->used_msgs = msgq->used_msgs;
Youvedeep Singh188c1ab2018-03-19 20:02:40 +0530179}
180
181#ifdef CONFIG_USERSPACE
Andy Ross643701a2019-08-13 12:58:38 -0700182static inline void z_vrfy_k_msgq_get_attrs(struct k_msgq *q,
183 struct k_msgq_attrs *attrs)
Youvedeep Singh188c1ab2018-03-19 20:02:40 +0530184{
Andrew Boie8345e5e2018-05-04 15:57:57 -0700185 Z_OOPS(Z_SYSCALL_OBJ(q, K_OBJ_MSGQ));
186 Z_OOPS(Z_SYSCALL_MEMORY_WRITE(attrs, sizeof(struct k_msgq_attrs)));
Andy Ross65649742019-08-06 13:34:31 -0700187 z_impl_k_msgq_get_attrs(q, attrs);
Youvedeep Singh188c1ab2018-03-19 20:02:40 +0530188}
Andy Ross65649742019-08-06 13:34:31 -0700189#include <syscalls/k_msgq_get_attrs_mrsh.c>
Youvedeep Singh188c1ab2018-03-19 20:02:40 +0530190#endif
191
Andy Ross78327382020-03-05 15:18:14 -0800192int z_impl_k_msgq_get(struct k_msgq *msgq, void *data, k_timeout_t timeout)
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400193{
Andy Ross78327382020-03-05 15:18:14 -0800194 __ASSERT(!arch_is_in_isr() || K_TIMEOUT_EQ(timeout, K_NO_WAIT), "");
Benjamin Walsh8215ce12016-11-09 19:45:19 -0500195
Anas Nashif7bde81f2019-06-19 07:30:50 -0400196 k_spinlock_key_t key;
Benjamin Walshb7ef0cb2016-10-05 17:32:01 -0400197 struct k_thread *pending_thread;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400198 int result;
199
Anas Nashif7bde81f2019-06-19 07:30:50 -0400200 key = k_spin_lock(&msgq->lock);
201
202 if (msgq->used_msgs > 0) {
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400203 /* take first available message from queue */
Anas Nashif7bde81f2019-06-19 07:30:50 -0400204 (void)memcpy(data, msgq->read_ptr, msgq->msg_size);
205 msgq->read_ptr += msgq->msg_size;
206 if (msgq->read_ptr == msgq->buffer_end) {
207 msgq->read_ptr = msgq->buffer_start;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400208 }
Anas Nashif7bde81f2019-06-19 07:30:50 -0400209 msgq->used_msgs--;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400210
211 /* handle first thread waiting to write (if any) */
Anas Nashif7bde81f2019-06-19 07:30:50 -0400212 pending_thread = z_unpend_first_thread(&msgq->wait_q);
Flavio Ceolin4218d5f2018-09-17 09:39:51 -0700213 if (pending_thread != NULL) {
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400214 /* add thread's message to queue */
Anas Nashif7bde81f2019-06-19 07:30:50 -0400215 (void)memcpy(msgq->write_ptr, pending_thread->base.swap_data,
216 msgq->msg_size);
217 msgq->write_ptr += msgq->msg_size;
218 if (msgq->write_ptr == msgq->buffer_end) {
219 msgq->write_ptr = msgq->buffer_start;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400220 }
Anas Nashif7bde81f2019-06-19 07:30:50 -0400221 msgq->used_msgs++;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400222
223 /* wake up waiting thread */
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800224 arch_thread_return_value_set(pending_thread, 0);
Patrik Flykt4344e272019-03-08 14:19:05 -0700225 z_ready_thread(pending_thread);
Anas Nashif7bde81f2019-06-19 07:30:50 -0400226 z_reschedule(&msgq->lock, key);
Andy Ross8606fab2018-03-26 10:54:40 -0700227 return 0;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400228 }
229 result = 0;
Andy Ross78327382020-03-05 15:18:14 -0800230 } else if (K_TIMEOUT_EQ(timeout, K_NO_WAIT)) {
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400231 /* don't wait for a message to become available */
232 result = -ENOMSG;
233 } else {
234 /* wait for get message success or timeout */
Benjamin Walshf6ca7de2016-11-08 10:36:50 -0500235 _current->base.swap_data = data;
Anas Nashif7bde81f2019-06-19 07:30:50 -0400236 return z_pend_curr(&msgq->lock, key, &msgq->wait_q, timeout);
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400237 }
238
Anas Nashif7bde81f2019-06-19 07:30:50 -0400239 k_spin_unlock(&msgq->lock, key);
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400240
241 return result;
242}
243
Andrew Boie82edb6e2017-10-02 10:53:06 -0700244#ifdef CONFIG_USERSPACE
Andy Ross78327382020-03-05 15:18:14 -0800245static inline int z_vrfy_k_msgq_get(struct k_msgq *q, void *data,
246 k_timeout_t timeout)
Andrew Boie82edb6e2017-10-02 10:53:06 -0700247{
Andrew Boie8345e5e2018-05-04 15:57:57 -0700248 Z_OOPS(Z_SYSCALL_OBJ(q, K_OBJ_MSGQ));
249 Z_OOPS(Z_SYSCALL_MEMORY_WRITE(data, q->msg_size));
Andrew Boie82edb6e2017-10-02 10:53:06 -0700250
Andy Ross65649742019-08-06 13:34:31 -0700251 return z_impl_k_msgq_get(q, data, timeout);
Andrew Boie82edb6e2017-10-02 10:53:06 -0700252}
Andy Ross65649742019-08-06 13:34:31 -0700253#include <syscalls/k_msgq_get_mrsh.c>
Andrew Boie82edb6e2017-10-02 10:53:06 -0700254#endif
255
Anas Nashif7bde81f2019-06-19 07:30:50 -0400256int z_impl_k_msgq_peek(struct k_msgq *msgq, void *data)
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800257{
Anas Nashif7bde81f2019-06-19 07:30:50 -0400258 k_spinlock_key_t key;
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800259 int result;
260
Anas Nashif7bde81f2019-06-19 07:30:50 -0400261 key = k_spin_lock(&msgq->lock);
262
263 if (msgq->used_msgs > 0) {
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800264 /* take first available message from queue */
Anas Nashif7bde81f2019-06-19 07:30:50 -0400265 (void)memcpy(data, msgq->read_ptr, msgq->msg_size);
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800266 result = 0;
267 } else {
268 /* don't wait for a message to become available */
269 result = -ENOMSG;
270 }
271
Anas Nashif7bde81f2019-06-19 07:30:50 -0400272 k_spin_unlock(&msgq->lock, key);
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800273
274 return result;
275}
276
277#ifdef CONFIG_USERSPACE
Andy Ross65649742019-08-06 13:34:31 -0700278static inline int z_vrfy_k_msgq_peek(struct k_msgq *q, void *data)
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800279{
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800280 Z_OOPS(Z_SYSCALL_OBJ(q, K_OBJ_MSGQ));
281 Z_OOPS(Z_SYSCALL_MEMORY_WRITE(data, q->msg_size));
282
Andy Ross65649742019-08-06 13:34:31 -0700283 return z_impl_k_msgq_peek(q, data);
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800284}
Andy Ross65649742019-08-06 13:34:31 -0700285#include <syscalls/k_msgq_peek_mrsh.c>
Sathish Kuttana8aa2352018-11-09 21:04:36 -0800286#endif
287
Anas Nashif7bde81f2019-06-19 07:30:50 -0400288void z_impl_k_msgq_purge(struct k_msgq *msgq)
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400289{
Anas Nashif7bde81f2019-06-19 07:30:50 -0400290 k_spinlock_key_t key;
Benjamin Walshb7ef0cb2016-10-05 17:32:01 -0400291 struct k_thread *pending_thread;
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400292
Anas Nashif7bde81f2019-06-19 07:30:50 -0400293 key = k_spin_lock(&msgq->lock);
294
Peter Mitsis340d00a2016-09-22 13:59:00 -0400295 /* wake up any threads that are waiting to write */
Anas Nashif7bde81f2019-06-19 07:30:50 -0400296 while ((pending_thread = z_unpend_first_thread(&msgq->wait_q)) != NULL) {
Andrew Boie4f77c2a2019-11-07 12:43:29 -0800297 arch_thread_return_value_set(pending_thread, -ENOMSG);
Patrik Flykt4344e272019-03-08 14:19:05 -0700298 z_ready_thread(pending_thread);
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400299 }
300
Anas Nashif7bde81f2019-06-19 07:30:50 -0400301 msgq->used_msgs = 0;
302 msgq->read_ptr = msgq->write_ptr;
Peter Mitsis340d00a2016-09-22 13:59:00 -0400303
Anas Nashif7bde81f2019-06-19 07:30:50 -0400304 z_reschedule(&msgq->lock, key);
Benjamin Walsh456c6da2016-09-02 18:55:39 -0400305}
Andrew Boie82edb6e2017-10-02 10:53:06 -0700306
307#ifdef CONFIG_USERSPACE
Andy Ross65649742019-08-06 13:34:31 -0700308static inline void z_vrfy_k_msgq_purge(struct k_msgq *q)
309{
310 Z_OOPS(Z_SYSCALL_OBJ(q, K_OBJ_MSGQ));
311 z_impl_k_msgq_purge(q);
312}
313#include <syscalls/k_msgq_purge_mrsh.c>
314
Kumar Galaa1b77fd2020-05-27 11:26:57 -0500315static inline uint32_t z_vrfy_k_msgq_num_free_get(struct k_msgq *q)
Andy Ross65649742019-08-06 13:34:31 -0700316{
317 Z_OOPS(Z_SYSCALL_OBJ(q, K_OBJ_MSGQ));
318 return z_impl_k_msgq_num_free_get(q);
319}
320#include <syscalls/k_msgq_num_free_get_mrsh.c>
321
Kumar Galaa1b77fd2020-05-27 11:26:57 -0500322static inline uint32_t z_vrfy_k_msgq_num_used_get(struct k_msgq *q)
Andy Ross65649742019-08-06 13:34:31 -0700323{
324 Z_OOPS(Z_SYSCALL_OBJ(q, K_OBJ_MSGQ));
325 return z_impl_k_msgq_num_used_get(q);
326}
327#include <syscalls/k_msgq_num_used_get_mrsh.c>
328
Andrew Boie225e4c02017-10-12 09:54:26 -0700329#endif