* @brief This function will return the name of the specified object container * * @param object the specified object to be get name * @param name buffer to store the object name string * @param name_size maximum size of the buffer to store object name * * @return -RT_EINVAL if any parameter is invalid or RT_EOK if the operation is successfully executed * * @note this function shal
| 743 | * @note this function shall not be invoked in interrupt status |
| 744 | */ |
| 745 | rt_err_t rt_object_get_name(rt_object_t object, char *name, rt_uint8_t name_size) |
| 746 | { |
| 747 | rt_err_t result = -RT_EINVAL; |
| 748 | if ((object != RT_NULL) && (name != RT_NULL) && (name_size != 0U)) |
| 749 | { |
| 750 | const char *obj_name = object->name; |
| 751 | rt_strncpy(name, obj_name, (rt_size_t)name_size); |
| 752 | /* Ensure null-termination */ |
| 753 | name[name_size - 1] = '\0'; |
| 754 | result = RT_EOK; |
| 755 | } |
| 756 | |
| 757 | return result; |
| 758 | } |
| 759 | |
| 760 | #ifdef RT_USING_HEAP |
| 761 | /** |