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

Function sys_channel_reply

components/lwp/lwp_syscall.c:4255–4280  ·  view source on GitHub ↗

* @brief Sends a reply message through a communication channel. * * This system call is used to send a reply (`data`) through a communication channel identified * by the file descriptor `fd`. It is typically called in response to a received request * within a request-response communication pattern. The reply is sent to the requesting entity * through the same channel. * * @param[in] fd

Source from the content-addressed store, hash-verified

4253 * Sending invalid or corrupted data may lead to unexpected behavior or communication failures.
4254 */
4255sysret_t sys_channel_reply(int fd, rt_channel_msg_t data)
4256{
4257 rt_size_t ret = 0;
4258 rt_channel_msg_t kdata = RT_NULL;
4259
4260 if (!lwp_user_accessable((void *)data, sizeof(*data)))
4261 {
4262 return -EFAULT;
4263 }
4264
4265 kdata = kmem_get(sizeof(*data));
4266 if (kdata == RT_NULL)
4267 return -ENOMEM;
4268
4269 if (lwp_get_from_user(kdata, data, sizeof(*kdata)) != sizeof(*data))
4270 {
4271 kmem_put(kdata);
4272 return -EFAULT;
4273 }
4274
4275 ret = lwp_channel_reply(FDT_TYPE_LWP, fd, kdata);
4276
4277 kmem_put(kdata);
4278
4279 return ret;
4280}
4281
4282/**
4283 * @brief Receives a message from a communication channel with a timeout.

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
lwp_channel_replyFunction · 0.85

Tested by

no test coverage detected