lkml.org 
[lkml]   [1998]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
Subjectsmall procfs bug & fix

Hi,

In 2.1.119, when you cd into some /proc/<pid>/ directory and call /bin/pwd,
it reports "cannot get current directory". This is because readdir() of
/proc/ returns ino=2 for all of these /proc/<pid>/ directories. Here is a fix:

*** linux-2.1.119/fs/proc/root.c.orig Mon Aug 31 00:43:25 1998
--- linux-2.1.119/fs/proc/root.c Tue Sep 1 00:05:55 1998
***************
*** 945,950 ****
--- 945,951 ----

for (i = 0; i < nr_pids; i++) {
int pid = pid_array[i];
+ ino_t ino = (pid << 16) + PROC_PID_INO;
unsigned long j = PROC_NUMBUF;

do {
***************
*** 953,959 ****
pid /= 10;
} while (pid);

! if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, (pid << 16) + PROC_PID_INO) < 0)
break;
filp->f_pos++;
}
--- 954,960 ----
pid /= 10;
} while (pid);

! if (filldir(dirent, buf+j, PROC_NUMBUF-j, filp->f_pos, ino) < 0)
break;
filp->f_pos++;
}

Bruno

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:44    [W:0.058 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site