* fhandler.h (fhandler_proc::opendir): Declare.
(fhandler_proc::closedir): Declare. * fhandler_proc.cc (fhandler_proc::opendir): New method. Fetch list of active processes here once to avoid potential duplicates. (fhandler_proc::closedir): New method.
This commit is contained in:
parent
6e2c582323
commit
1f08558f14
|
@ -1,3 +1,11 @@
|
||||||
|
2011-08-12 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler.h (fhandler_proc::opendir): Declare.
|
||||||
|
(fhandler_proc::closedir): Declare.
|
||||||
|
* fhandler_proc.cc (fhandler_proc::opendir): New method. Fetch list
|
||||||
|
of active processes here once to avoid potential duplicates.
|
||||||
|
(fhandler_proc::closedir): New method.
|
||||||
|
|
||||||
2011-08-11 Corinna Vinschen <corinna@vinschen.de>
|
2011-08-11 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Don't allow to
|
* fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Don't allow to
|
||||||
|
|
|
@ -1440,6 +1440,8 @@ class fhandler_proc: public fhandler_virtual
|
||||||
public:
|
public:
|
||||||
fhandler_proc ();
|
fhandler_proc ();
|
||||||
virtual_ftype_t exists();
|
virtual_ftype_t exists();
|
||||||
|
DIR *opendir (int fd) __attribute__ ((regparm (2)));
|
||||||
|
int closedir (DIR *);
|
||||||
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
|
int readdir (DIR *, dirent *) __attribute__ ((regparm (3)));
|
||||||
static fh_devices get_proc_fhandler (const char *path);
|
static fh_devices get_proc_fhandler (const char *path);
|
||||||
|
|
||||||
|
|
|
@ -220,6 +220,26 @@ fhandler_proc::fstat (struct __stat64 *buf)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DIR *
|
||||||
|
fhandler_proc::opendir (int fd)
|
||||||
|
{
|
||||||
|
DIR *dir = fhandler_virtual::opendir (fd);
|
||||||
|
if (dir && !(dir->__handle = (void *) new winpids ((DWORD) 0)))
|
||||||
|
{
|
||||||
|
free (dir);
|
||||||
|
dir = NULL;
|
||||||
|
set_errno (ENOMEM);
|
||||||
|
}
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
fhandler_proc::closedir (DIR *dir)
|
||||||
|
{
|
||||||
|
free (dir->__handle);
|
||||||
|
return fhandler_virtual::closedir (dir);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fhandler_proc::readdir (DIR *dir, dirent *de)
|
fhandler_proc::readdir (DIR *dir, dirent *de)
|
||||||
{
|
{
|
||||||
|
@ -232,7 +252,7 @@ fhandler_proc::readdir (DIR *dir, dirent *de)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
winpids pids ((DWORD) 0);
|
winpids &pids = *(winpids *) dir->__handle;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
res = ENMFILE;
|
res = ENMFILE;
|
||||||
for (unsigned i = 0; i < pids.npids; i++)
|
for (unsigned i = 0; i < pids.npids; i++)
|
||||||
|
|
Loading…
Reference in New Issue