Lines Matching refs:mqd

39 static int32_t send_message(mqueue_desc *mqd, const char *msg_ptr, size_t msg_len,
41 static int32_t receive_message(mqueue_desc *mqd, char *msg_ptr, size_t msg_len,
62 mqueue_desc *msg_queue_desc = NULL, *mqd = (mqueue_desc *)(-1); in mq_open() local
81 return (mqd_t)mqd; in mq_open()
86 return (mqd_t)mqd; in mq_open()
98 return (mqd_t)mqd; in mq_open()
103 return (mqd_t)mqd; in mq_open()
179 return (mqd_t)mqd; in mq_open()
189 mqueue_desc *mqd = (mqueue_desc *)mqdes; in mq_close() local
191 if (mqd == NULL) { in mq_close()
196 atomic_dec(&mqd->mqueue->ref_count); in mq_close()
199 if (mqd->mqueue->name == NULL) { in mq_close()
200 remove_mq(mqd->mqueue); in mq_close()
203 k_free(mqd->mem_desc); in mq_close()
242 mqueue_desc *mqd = (mqueue_desc *)mqdes; in mq_send() local
244 return send_message(mqd, msg_ptr, msg_len, K_FOREVER); in mq_send()
257 mqueue_desc *mqd = (mqueue_desc *)mqdes; in mq_timedsend() local
260 return send_message(mqd, msg_ptr, msg_len, K_MSEC(timeout)); in mq_timedsend()
273 mqueue_desc *mqd = (mqueue_desc *)mqdes; in mq_receive() local
275 return receive_message(mqd, msg_ptr, msg_len, K_FOREVER); in mq_receive()
288 mqueue_desc *mqd = (mqueue_desc *)mqdes; in mq_timedreceive() local
291 return receive_message(mqd, msg_ptr, msg_len, K_MSEC(timeout)); in mq_timedreceive()
301 mqueue_desc *mqd = (mqueue_desc *)mqdes; in mq_getattr() local
304 if (mqd == NULL) { in mq_getattr()
310 k_msgq_get_attrs(&mqd->mqueue->queue, &attrs); in mq_getattr()
311 mqstat->mq_flags = mqd->flags; in mq_getattr()
327 mqueue_desc *mqd = (mqueue_desc *)mqdes; in mq_setattr() local
329 if (mqd == NULL) { in mq_setattr()
344 mqd->flags = mqstat->mq_flags; in mq_setattr()
357 mqueue_desc *mqd = (mqueue_desc *)mqdes; in mq_notify() local
359 if (mqd == NULL) { in mq_notify()
364 mqueue_object *msg_queue = mqd->mqueue; in mq_notify()
437 static int32_t send_message(mqueue_desc *mqd, const char *msg_ptr, size_t msg_len, in send_message() argument
442 if (mqd == NULL) { in send_message()
447 if ((mqd->flags & O_NONBLOCK) != 0U) { in send_message()
451 if (msg_len > mqd->mqueue->queue.msg_size) { in send_message()
456 uint32_t msgq_num = k_msgq_num_used_get(&mqd->mqueue->queue); in send_message()
458 if (k_msgq_put(&mqd->mqueue->queue, (void *)msg_ptr, timeout) != 0) { in send_message()
463 if (k_msgq_num_used_get(&mqd->mqueue->queue) - msgq_num > 0) { in send_message()
464 struct sigevent *sevp = &mqd->mqueue->not; in send_message()
474 mqd->mqueue); in send_message()
481 static int32_t receive_message(mqueue_desc *mqd, char *msg_ptr, size_t msg_len, in receive_message() argument
486 if (mqd == NULL) { in receive_message()
491 if (msg_len < mqd->mqueue->queue.msg_size) { in receive_message()
496 if ((mqd->flags & O_NONBLOCK) != 0U) { in receive_message()
500 if (k_msgq_get(&mqd->mqueue->queue, (void *)msg_ptr, timeout) != 0) { in receive_message()
503 ret = mqd->mqueue->queue.msg_size; in receive_message()