* @brief Sets the current working directory for the calling LWP or system * * @param[in] buf Pointer to the path string to set as working directory * * @note This function handles both LWP-specific and system-wide working directories: * - For LWPs, sets the working_directory in the LWP structure * - For non-LWP threads, sets the global working_directory variable */
| 105 | * - For non-LWP threads, sets the global working_directory variable |
| 106 | */ |
| 107 | void lwp_setcwd(char *buf) |
| 108 | { |
| 109 | struct rt_lwp *lwp = RT_NULL; |
| 110 | |
| 111 | if(strlen(buf) >= DFS_PATH_MAX) |
| 112 | { |
| 113 | rt_kprintf("buf too long!\n"); |
| 114 | return ; |
| 115 | } |
| 116 | |
| 117 | lwp = (struct rt_lwp *)rt_thread_self()->lwp; |
| 118 | if (lwp) |
| 119 | { |
| 120 | rt_strncpy(lwp->working_directory, buf, DFS_PATH_MAX - 1); |
| 121 | } |
| 122 | else |
| 123 | { |
| 124 | rt_strncpy(working_directory, buf, DFS_PATH_MAX - 1); |
| 125 | } |
| 126 | |
| 127 | return ; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * @brief Get the current working directory for the light-weight process |
no test coverage detected