patch-2.1.132 linux/fs/proc/array.c
Next file: linux/fs/proc/root.c
Previous file: linux/fs/nls/nls_iso8859-15.c
Back to the patch index
Back to the overall index
- Lines: 56
- Date:
Sun Dec 20 05:52:02 1998
- Orig file:
v2.1.131/linux/fs/proc/array.c
- Orig date:
Fri Nov 27 13:09:28 1998
diff -u --recursive --new-file v2.1.131/linux/fs/proc/array.c linux/fs/proc/array.c
@@ -60,6 +60,7 @@
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/swap.h>
+#include <linux/swapctl.h>
#include <linux/slab.h>
#include <linux/smp.h>
#include <linux/signal.h>
@@ -371,6 +372,28 @@
i.freeswap >> 10);
}
+static int get_swapstats(char * buffer)
+{
+ unsigned long *w = swapstats.kswap_wakeups;
+
+ return sprintf(buffer,
+ "ProcFreeTry: %8lu\n"
+ "ProcFreeSucc: %8lu\n"
+ "ProcShrinkTry: %8lu\n"
+ "ProcShrinkSucc: %8lu\n"
+ "KswapFreeTry: %8lu\n"
+ "KswapFreeSucc: %8lu\n"
+ "KswapWakeups: %8lu %lu %lu %lu\n",
+ swapstats.gfp_freepage_attempts,
+ swapstats.gfp_freepage_successes,
+ swapstats.gfp_shrink_attempts,
+ swapstats.gfp_shrink_successes,
+ swapstats.kswap_freepage_attempts,
+ swapstats.kswap_freepage_successes,
+ w[0], w[1], w[2], w[3]
+ );
+}
+
static int get_version(char * buffer)
{
extern char *linux_banner;
@@ -1257,6 +1280,9 @@
case PROC_MEMINFO:
return get_meminfo(page);
+ case PROC_SWAPSTATS:
+ return get_swapstats(page);
+
#ifdef CONFIG_PCI_OLD_PROC
case PROC_PCI:
return get_pci_list(page);
@@ -1342,7 +1368,7 @@
static int process_unauthorized(int type, int pid)
{
struct task_struct *p;
- uid_t euid; /* Save the euid keep the lock short */
+ uid_t euid=0; /* Save the euid keep the lock short */
read_lock(&tasklist_lock);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov