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

Function sys_mb_recv

components/lwp/lwp_syscall.c:2482–2507  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

2480 * indefinite blocking, potentially resulting in deadlocks.
2481 */
2482sysret_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
2509rt_weak int syslog_ctrl(int type, char *buf, int len)
2510{

Callers

nothing calls this directly

Calls 5

lwp_user_accessableFunction · 0.85
kmem_getFunction · 0.85
rt_mb_recvFunction · 0.85
lwp_put_to_userFunction · 0.85
kmem_putFunction · 0.85

Tested by

no test coverage detected