MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_mq_urgent

Function sys_mq_urgent

components/lwp/lwp_syscall.c:2739–2766  ·  view source on GitHub ↗

* @brief Sends an urgent message to a message queue. * * This system call sends a message to the specified message queue with higher priority, * meaning it will be placed at the front of the queue, bypassing normal message * order. The message is copied into the queue's buffer. If the queue is full, * the behavior will depend on the flags set during queue creation (e.g., whether * it is bloc

Source from the content-addressed store, hash-verified

2737 * calling task or thread to block indefinitely if not properly handled.
2738 */
2739sysret_t sys_mq_urgent(rt_mq_t mq, void *buffer, rt_size_t size)
2740{
2741 int ret = 0;
2742 void *kbuffer = RT_NULL;
2743
2744 if (!lwp_user_accessable((void *)buffer, size))
2745 {
2746 return -EFAULT;
2747 }
2748
2749 kbuffer = kmem_get(size);
2750 if (kbuffer == RT_NULL)
2751 {
2752 return -ENOMEM;
2753 }
2754
2755 if (lwp_get_from_user(kbuffer, buffer, size) != size)
2756 {
2757 kmem_put(kbuffer);
2758 return -EINVAL;
2759 }
2760
2761 ret = rt_mq_urgent(mq, kbuffer, size);
2762
2763 kmem_put(kbuffer);
2764
2765 return ret;
2766}
2767
2768/**
2769 * @brief Receives a message from a message queue.

Callers

nothing calls this directly

Calls 5

lwp_user_accessableFunction · 0.85
kmem_getFunction · 0.85
lwp_get_from_userFunction · 0.85
kmem_putFunction · 0.85
rt_mq_urgentFunction · 0.85

Tested by

no test coverage detected