* @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
| 2737 | * calling task or thread to block indefinitely if not properly handled. |
| 2738 | */ |
| 2739 | sysret_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. |
nothing calls this directly
no test coverage detected