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

Function dfs_fd_dump

components/dfs/dfs_v2/src/dfs.c:1160–1191  ·  view source on GitHub ↗

* @brief Dump all file descriptors information in the global file descriptor table * * @param[in] argc Number of command line arguments (unused) * @param[in] argv Array of command line arguments (unused) * * @return int 0 on success, * -RT_ENOSYS if failed to acquire file system lock */

Source from the content-addressed store, hash-verified

1158 * -RT_ENOSYS if failed to acquire file system lock
1159 */
1160int dfs_fd_dump(int argc, char** argv)
1161{
1162 int index;
1163
1164 if (dfs_file_lock() != RT_EOK)
1165 {
1166 return -RT_ENOSYS;
1167 }
1168
1169 for (index = 0; index < _fdtab.maxfd; index++)
1170 {
1171 struct dfs_file *file = _fdtab.fds[index];
1172 if (file)
1173 {
1174 char* fullpath = dfs_dentry_full_path(file->dentry);
1175 if (fullpath)
1176 {
1177 printf("[%d] - %s, ref_count %zd\n", index,
1178 fullpath, (size_t)rt_atomic_load(&(file->ref_count)));
1179 rt_free(fullpath);
1180 }
1181 else
1182 {
1183 printf("[%d] - %s, ref_count %zd\n", index,
1184 file->dentry->pathname, (size_t)rt_atomic_load(&(file->ref_count)));
1185 }
1186 }
1187 }
1188 dfs_file_unlock();
1189
1190 return 0;
1191}
1192MSH_CMD_EXPORT_ALIAS(dfs_fd_dump, fd_dump, fd dump);
1193
1194#ifdef PKG_USING_DLOG

Callers

nothing calls this directly

Calls 5

dfs_dentry_full_pathFunction · 0.85
rt_freeFunction · 0.85
dfs_file_lockFunction · 0.70
dfs_file_unlockFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected