* @brief Remove a message queue. * * This function removes a message queue identified by its name. If the message queue * is open by any process, it will be removed only when all the processes close their * file descriptors associated with the message queue. * * @param[in] name The name of the message queue to be removed. It should be a null-terminated * string that conforms
| 9120 | * open by other processes. |
| 9121 | */ |
| 9122 | sysret_t sys_mq_unlink(const char *name) |
| 9123 | { |
| 9124 | int ret = 0; |
| 9125 | #ifdef ARCH_MM_MMU |
| 9126 | char *kname = RT_NULL; |
| 9127 | rt_size_t len = 0; |
| 9128 | |
| 9129 | len = lwp_user_strlen(name); |
| 9130 | if (!len) |
| 9131 | return -EINVAL; |
| 9132 | kname = (char *)kmem_get(len + 1); |
| 9133 | if (!kname) |
| 9134 | return -ENOMEM; |
| 9135 | |
| 9136 | lwp_get_from_user(kname, (void *)name, len + 1); |
| 9137 | ret = mq_unlink(kname); |
| 9138 | if (ret < 0) |
| 9139 | { |
| 9140 | ret = GET_ERRNO(); |
| 9141 | } |
| 9142 | kmem_put(kname); |
| 9143 | return ret; |
| 9144 | #else |
| 9145 | ret = mq_unlink(name); |
| 9146 | return (ret < 0 ? GET_ERRNO() : ret); |
| 9147 | #endif |
| 9148 | } |
| 9149 | |
| 9150 | /** |
| 9151 | * @brief Send a message to a message queue with a timeout. |
nothing calls this directly
no test coverage detected