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

Function sys_syslog

components/lwp/lwp_syscall.c:2537–2558  ·  view source on GitHub ↗

* @brief Sends a log message to the system log. * * This system call sends a message to the system log for recording or debugging purposes. * * @param[in] type The type of the log message, typically representing the severity * or category (e.g., debug, info, warning, error). This should be * a valid predefined log type. * @param[in] buf A pointer to a bu

Source from the content-addressed store, hash-verified

2535 * @warning Sending excessively large or frequent log messages may impact system performance.
2536 */
2537sysret_t sys_syslog(int type, char *buf, int len)
2538{
2539 char *tmp;
2540 int ret = -1;
2541
2542 if (!lwp_user_accessable((void *)buf, len))
2543 {
2544 return -EFAULT;
2545 }
2546
2547 tmp = (char *)rt_malloc(len);
2548 if (!tmp)
2549 {
2550 return -ENOMEM;
2551 }
2552
2553 ret = syslog_ctrl(type, tmp, len);
2554 lwp_put_to_user(buf, tmp, len);
2555 rt_free(tmp);
2556
2557 return ret;
2558}
2559
2560/**
2561 * @brief Creates a message queue.

Callers

nothing calls this directly

Calls 5

lwp_user_accessableFunction · 0.85
rt_mallocFunction · 0.85
syslog_ctrlFunction · 0.85
lwp_put_to_userFunction · 0.85
rt_freeFunction · 0.85

Tested by

no test coverage detected