* @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
| 4253 | * Sending invalid or corrupted data may lead to unexpected behavior or communication failures. |
| 4254 | */ |
| 4255 | sysret_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. |
nothing calls this directly
no test coverage detected