* @brief Get system information. * * This function retrieves information about the current system, such as the system name, * version, release, architecture, and other details. The information is stored in the * `utsname` structure pointed to by the `uts` parameter. * * @param[out] uts A pointer to a `utsname` structure where the system information will * be stored. The st
| 9468 | * @see sys_gethostname, sys_uname |
| 9469 | */ |
| 9470 | sysret_t sys_uname(struct utsname *uts) |
| 9471 | { |
| 9472 | struct utsname utsbuff = {0}; |
| 9473 | int ret = 0; |
| 9474 | const char *machine; |
| 9475 | |
| 9476 | if (!lwp_user_accessable((void *)uts, sizeof(struct utsname))) |
| 9477 | { |
| 9478 | return -EFAULT; |
| 9479 | } |
| 9480 | rt_strncpy(utsbuff.sysname, "RT-Thread", sizeof(utsbuff.sysname)); |
| 9481 | utsbuff.nodename[0] = '\0'; |
| 9482 | ret = rt_snprintf(utsbuff.release, sizeof(utsbuff.release), "%u.%u.%u", |
| 9483 | RT_VERSION_MAJOR, RT_VERSION_MINOR, RT_VERSION_PATCH); |
| 9484 | if (ret < 0) |
| 9485 | { |
| 9486 | return -EIO; |
| 9487 | } |
| 9488 | ret = rt_snprintf(utsbuff.version, sizeof(utsbuff.version), "RT-Thread %u.%u.%u %s %s", |
| 9489 | RT_VERSION_MAJOR, RT_VERSION_MINOR, RT_VERSION_PATCH, __DATE__, __TIME__); |
| 9490 | if (ret < 0) |
| 9491 | { |
| 9492 | return -EIO; |
| 9493 | } |
| 9494 | |
| 9495 | machine = rt_hw_cpu_arch(); |
| 9496 | rt_strncpy(utsbuff.machine, machine, sizeof(utsbuff.machine)); |
| 9497 | |
| 9498 | utsbuff.domainname[0] = '\0'; |
| 9499 | lwp_put_to_user(uts, &utsbuff, sizeof utsbuff); |
| 9500 | return 0; |
| 9501 | } |
| 9502 | |
| 9503 | /** |
| 9504 | * @brief Get filesystem statistics. |
nothing calls this directly
no test coverage detected