diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c index fbf622f1f6..14211f4f2c 100644 --- a/fs/procfs/fs_procfsproc.c +++ b/fs/procfs/fs_procfsproc.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -68,7 +69,7 @@ * to handle the longest line generated by this logic. */ -#define STATUS_LINELEN 32 +#define STATUS_LINELEN PATH_MAX /**************************************************************************** * Private Type Definitions @@ -1164,6 +1165,7 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile, { FAR struct task_group_s *group = tcb->group; FAR struct file *file; + char path[PATH_MAX]; size_t remaining; size_t linesize; size_t copysize; @@ -1177,8 +1179,8 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile, totalsize = 0; linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, - "\n%-3s %-8s %s\n", - "FD", "POS", "OFLAGS"); + "\n%-3s %-8s %-8s %s\n", + "FD", "POS", "OFLAGS", "PATH"); copysize = procfs_memcpy(procfile->line, linesize, buffer, remaining, &offset); @@ -1203,8 +1205,13 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile, if (file->f_inode && !INODE_IS_SOCKET(file->f_inode)) { + if (file_ioctl(file, FIOC_FILEPATH, path) < 0) + { + path[0] = '\0'; + } + linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, - "%3d %8ld %04x\n", + "%3d %8ld %8x", i * CONFIG_NFILE_DESCRIPTORS_PER_BLOCK + j, (long)file->f_pos, file->f_oflags); @@ -1215,6 +1222,15 @@ static ssize_t proc_groupfd(FAR struct proc_file_s *procfile, buffer += copysize; remaining -= copysize; + linesize = procfs_snprintf(procfile->line, STATUS_LINELEN, + " %s\n", path); + copysize = procfs_memcpy(procfile->line, linesize, buffer, + remaining, &offset); + + totalsize += copysize; + buffer += copysize; + remaining -= copysize; + if (totalsize >= buflen) { return totalsize;