diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-02 18:21:47 -0400 |
---|---|---|
committer | Alexey Dobriyan <adobriyan@gmail.com> | 2008-10-23 05:45:28 -0400 |
commit | 5b3acc8de8b2bc459afae6e09ada45c7e5b11bbf (patch) | |
tree | 295a8d4401fb63e7c0f32090f1fafce1835765d6 /fs/proc/proc_misc.c | |
parent | 6c2f91e077f1b60e7f83b7ee044f965f469cfdb3 (diff) |
proc: switch /proc/loadavg to seq_file
and move it to fs/proc/loadavg.c while I'm at it.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Diffstat (limited to 'fs/proc/proc_misc.c')
-rw-r--r-- | fs/proc/proc_misc.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 7ea52c79b2da..ff42206c8aed 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -57,8 +57,6 @@ | |||
57 | #include <asm/div64.h> | 57 | #include <asm/div64.h> |
58 | #include "internal.h" | 58 | #include "internal.h" |
59 | 59 | ||
60 | #define LOAD_INT(x) ((x) >> FSHIFT) | ||
61 | #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) | ||
62 | /* | 60 | /* |
63 | * Warning: stuff below (imported functions) assumes that its output will fit | 61 | * Warning: stuff below (imported functions) assumes that its output will fit |
64 | * into one page. For some of those functions it may be wrong. Moreover, we | 62 | * into one page. For some of those functions it may be wrong. Moreover, we |
@@ -80,29 +78,6 @@ static int proc_calc_metrics(char *page, char **start, off_t off, | |||
80 | return len; | 78 | return len; |
81 | } | 79 | } |
82 | 80 | ||
83 | static int loadavg_read_proc(char *page, char **start, off_t off, | ||
84 | int count, int *eof, void *data) | ||
85 | { | ||
86 | int a, b, c; | ||
87 | int len; | ||
88 | unsigned long seq; | ||
89 | |||
90 | do { | ||
91 | seq = read_seqbegin(&xtime_lock); | ||
92 | a = avenrun[0] + (FIXED_1/200); | ||
93 | b = avenrun[1] + (FIXED_1/200); | ||
94 | c = avenrun[2] + (FIXED_1/200); | ||
95 | } while (read_seqretry(&xtime_lock, seq)); | ||
96 | |||
97 | len = sprintf(page,"%d.%02d %d.%02d %d.%02d %ld/%d %d\n", | ||
98 | LOAD_INT(a), LOAD_FRAC(a), | ||
99 | LOAD_INT(b), LOAD_FRAC(b), | ||
100 | LOAD_INT(c), LOAD_FRAC(c), | ||
101 | nr_running(), nr_threads, | ||
102 | task_active_pid_ns(current)->last_pid); | ||
103 | return proc_calc_metrics(page, start, off, count, eof, len); | ||
104 | } | ||
105 | |||
106 | static int uptime_read_proc(char *page, char **start, off_t off, | 81 | static int uptime_read_proc(char *page, char **start, off_t off, |
107 | int count, int *eof, void *data) | 82 | int count, int *eof, void *data) |
108 | { | 83 | { |
@@ -861,7 +836,6 @@ void __init proc_misc_init(void) | |||
861 | char *name; | 836 | char *name; |
862 | int (*read_proc)(char*,char**,off_t,int,int*,void*); | 837 | int (*read_proc)(char*,char**,off_t,int,int*,void*); |
863 | } *p, simple_ones[] = { | 838 | } *p, simple_ones[] = { |
864 | {"loadavg", loadavg_read_proc}, | ||
865 | {"uptime", uptime_read_proc}, | 839 | {"uptime", uptime_read_proc}, |
866 | {"meminfo", meminfo_read_proc}, | 840 | {"meminfo", meminfo_read_proc}, |
867 | {"version", version_read_proc}, | 841 | {"version", version_read_proc}, |