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

Function sys_mq_unlink

components/lwp/lwp_syscall.c:9122–9148  ·  view source on GitHub ↗

* @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

Source from the content-addressed store, hash-verified

9120 * open by other processes.
9121 */
9122sysret_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.

Callers

nothing calls this directly

Calls 5

lwp_user_strlenFunction · 0.85
kmem_getFunction · 0.85
lwp_get_from_userFunction · 0.85
mq_unlinkFunction · 0.85
kmem_putFunction · 0.85

Tested by

no test coverage detected