* @brief Receives a message from a communication channel with a timeout. * * This system call attempts to receive a message from a specified communication channel identified * by the file descriptor `fd`. The received message is stored in the `data` buffer. If no message * is available within the specified timeout period, the function returns with a timeout status. * * @param[in] fd The
| 4306 | * message to avoid memory corruption or data loss. |
| 4307 | */ |
| 4308 | sysret_t sys_channel_recv_timeout(int fd, rt_channel_msg_t data, rt_int32_t time) |
| 4309 | { |
| 4310 | rt_size_t ret = 0; |
| 4311 | rt_channel_msg_t kdata = RT_NULL; |
| 4312 | |
| 4313 | kdata = kmem_get(sizeof(*data)); |
| 4314 | if (kdata == RT_NULL) |
| 4315 | return -ENOMEM; |
| 4316 | |
| 4317 | ret = lwp_channel_recv_timeout(FDT_TYPE_LWP, fd, kdata, time); |
| 4318 | |
| 4319 | lwp_put_to_user(data, kdata, sizeof(*kdata)); |
| 4320 | kmem_put(kdata); |
| 4321 | |
| 4322 | return ret; |
| 4323 | } |
| 4324 | |
| 4325 | static struct rt_semaphore critical_lock; |
| 4326 |
nothing calls this directly
no test coverage detected