* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and

'ZwQueryVirtualMemory'.
* fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual
from int to size_t.  Change type of position member from __off32_t to
__off64_t.  Add new fileid member to fhandler_virtual class.  Make seekdir take
an __off64_t argument.  Make lseek take an __off64_t argument.  Add
fill_filebuf method to fhandler_virtual.  Add fill_filebuf method to
fhandler_proc.  Add fill_filebuf method to fhandler_registry.  Add fill_filebuf
method to fhandler_process.  Add saved_pid and saved_p members to
fhandler_process.
* fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'.
(proc_fhandlers array): Ditto.
(fhandler_proc::open): Use fill_filebuf to flesh out the file contents.
(fhandler_proc::fill_filebuf): New method.
(fhandler_proc::format_proc_meminfo): Ditto.
(fhandler_proc::format_proc_stat): Ditto.
(fhandler_proc::format_proc_uptime): Ditto.
* fhandler_process.cc (process_listing): Add 'stat' and 'statm'.
(fhandler_process::fstat): Find the _pinfo structure for the process named in
the filename.  Return ENOENT if the process is no longer around.  Set the gid
and uid fields of the stat structure.
(fhandler_process::open): Store pid and pointer to _pinfo structure in
saved_pid and saved_p respectively.  Use fill_filebuf to flesh out file
contents.
(fhandler_proc::fill_filebuf): New method.
(format_process_stat): New function.
(format_process_status): Ditto.
(format_process_statm): Ditto.
(get_process_state): Ditto.
(get_mem_values): Ditto.
* fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from
__off32_t to __off64_t.
(fhandler_registry::fill_filebuf): New method.
* fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from
__off32_t to __off64_t.
(fhandler_virtual::lseek): Ditto.
(fhandler_virtual::fill_filebuf): New method.
(fhandler_virtual::fhandler_virtual): Initialise fileid to -1.
* wincap.cc: Set flag has_process_io_counters appropriately.
* wincap.h: Add flag has_process_io_counters.
This commit is contained in:
Christopher Faylor
2002-05-12 01:37:48 +00:00
parent 558ab81ed1
commit 9ba913a56d
10 changed files with 1059 additions and 131 deletions

View File

@ -1043,8 +1043,9 @@ class fhandler_virtual : public fhandler_base
{
protected:
char *filebuf;
int bufalloc, filesize;
__off32_t position;
size_t bufalloc, filesize;
__off64_t position;
int fileid; // unique within each class
public:
fhandler_virtual (DWORD devtype);
@ -1053,16 +1054,17 @@ class fhandler_virtual : public fhandler_base
virtual int exists(const char *path);
DIR *opendir (path_conv& pc);
__off64_t telldir (DIR *);
void seekdir (DIR *, __off32_t);
void seekdir (DIR *, __off64_t);
void rewinddir (DIR *);
int closedir (DIR *);
int write (const void *ptr, size_t len);
int __stdcall read (void *ptr, size_t len) __attribute__ ((regparm (3)));
__off64_t lseek (__off32_t, int);
__off64_t lseek (__off64_t, int);
int dup (fhandler_base * child);
int open (path_conv *, int flags, mode_t mode = 0);
int close (void);
int __stdcall fstat (struct stat *buf, path_conv *pc) __attribute__ ((regparm (3)));
virtual void fill_filebuf ();
};
class fhandler_proc: public fhandler_virtual
@ -1076,6 +1078,7 @@ class fhandler_proc: public fhandler_virtual
int open (path_conv *real_path, int flags, mode_t mode = 0);
int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
void fill_filebuf ();
};
class fhandler_registry: public fhandler_proc
@ -1085,23 +1088,29 @@ class fhandler_registry: public fhandler_proc
int exists(const char *path);
struct dirent *readdir (DIR *);
__off64_t telldir (DIR *);
void seekdir (DIR *, __off32_t);
void seekdir (DIR *, __off64_t);
void rewinddir (DIR *);
int closedir (DIR *);
int open (path_conv *real_path, int flags, mode_t mode = 0);
int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
HKEY open_key(const char *name, REGSAM access = KEY_READ, bool isValue = false);
void fill_filebuf ();
};
struct _pinfo;
class fhandler_process: public fhandler_proc
{
private:
pid_t saved_pid;
_pinfo *saved_p;
public:
fhandler_process ();
int exists(const char *path);
struct dirent *readdir (DIR *);
int open (path_conv *real_path, int flags, mode_t mode = 0);
int __stdcall fstat (struct __stat64 *buf, path_conv *) __attribute__ ((regparm (3)));
void fill_filebuf ();
};
typedef union