
Instead of pulling in process tables itself, ProcFS now queries the MIB service for process information. This reduces ProcFS's memory usage by about 1MB. The change does have two negative consequences. First, getting all the original /proc/<pid>/psinfo fields filled in would take a lot of extra effort. Since the only program that uses those files at all is mtop(1), we reformat psinfo to expose only the information used by mtop(1). This means that with this patch, older copies of MINIX3 ps and top will cease to work. Second, since both MIB and ProcFS update their own view of the process list only once per clock tick, ProcFS' view may now be outdated by up to two clock ticks. This is unlikely to pose a problem in practice. Change-Id: Iaa6b60450c8fb52d092962394d33d08bd638bc01
33 lines
967 B
C
33 lines
967 B
C
#ifndef _PROCFS_PROTO_H
|
|
#define _PROCFS_PROTO_H
|
|
|
|
/* buf.c */
|
|
void buf_init(char *ptr, size_t len, off_t start);
|
|
void buf_printf(char *fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
|
|
void buf_append(char *data, size_t len);
|
|
ssize_t buf_result(void);
|
|
|
|
/* cpuinfo.c */
|
|
void root_cpuinfo(void);
|
|
|
|
/* service.c */
|
|
void service_init(void);
|
|
void service_lookup(struct inode *parent, clock_t now);
|
|
void service_getdents(struct inode *node);
|
|
void service_read(struct inode *node);
|
|
|
|
/* tree.c */
|
|
int init_tree(void);
|
|
int lookup_hook(struct inode *parent, char *name, cbdata_t cbdata);
|
|
int getdents_hook(struct inode *inode, cbdata_t cbdata);
|
|
ssize_t read_hook(struct inode *inode, char *ptr, size_t len, off_t off,
|
|
cbdata_t cbdata);
|
|
int rdlink_hook(struct inode *inode, char *ptr, size_t max, cbdata_t cbdata);
|
|
pid_t pid_from_slot(int slot);
|
|
void out_of_inodes(void);
|
|
|
|
/* util.c */
|
|
int procfs_getloadavg(struct load *loadavg, int nelem);
|
|
|
|
#endif /* _PROCFS_PROTO_H */
|