* @brief Receives a message from a mailbox with a timeout. * * This system call attempts to receive a message from the specified mailbox. * If the mailbox is empty, the function will wait for a specified timeout * period for a message to arrive. If no message is received within the timeout, * an error is returned. * * @param[in] mb The handle to the mailbox object from which the mess
| 2480 | * indefinite blocking, potentially resulting in deadlocks. |
| 2481 | */ |
| 2482 | sysret_t sys_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout) |
| 2483 | { |
| 2484 | int ret = 0; |
| 2485 | rt_ubase_t *kvalue; |
| 2486 | |
| 2487 | if (!lwp_user_accessable((void *)value, sizeof(rt_ubase_t *))) |
| 2488 | { |
| 2489 | return -EFAULT; |
| 2490 | } |
| 2491 | |
| 2492 | kvalue = kmem_get(sizeof(rt_ubase_t *)); |
| 2493 | if (kvalue == RT_NULL) |
| 2494 | { |
| 2495 | return -ENOMEM; |
| 2496 | } |
| 2497 | |
| 2498 | ret = rt_mb_recv(mb, (rt_ubase_t *)kvalue, timeout); |
| 2499 | if (ret == RT_EOK) |
| 2500 | { |
| 2501 | lwp_put_to_user(value, kvalue, sizeof(rt_ubase_t *)); |
| 2502 | } |
| 2503 | |
| 2504 | kmem_put(kvalue); |
| 2505 | |
| 2506 | return ret; |
| 2507 | } |
| 2508 | |
| 2509 | rt_weak int syslog_ctrl(int type, char *buf, int len) |
| 2510 | { |
nothing calls this directly
no test coverage detected