comparison random.c @ 811:5de524aec047

limit how much we read from rt_cache etc
author Matt Johnston <matt@ucc.asn.au>
date Tue, 28 May 2013 22:16:57 +0800
parents 7deb6fda1319
children 4095b6d7c9fc
comparison
equal deleted inserted replaced
800:1d1f80fcbcb3 811:5de524aec047
75 75
76 readcount = 0; 76 readcount = 0;
77 while (len == 0 || readcount < len) 77 while (len == 0 || readcount < len)
78 { 78 {
79 int readlen, wantread; 79 int readlen, wantread;
80 unsigned char readbuf[2048]; 80 unsigned char readbuf[4096];
81 if (!already_blocked) 81 if (!already_blocked)
82 { 82 {
83 int ret; 83 int ret;
84 struct timeval timeout = { .tv_sec = 2, .tv_usec = 0}; 84 struct timeval timeout = { .tv_sec = 2, .tv_usec = 0};
85 fd_set read_fds; 85 fd_set read_fds;
206 process_file(&hs, "/proc/interrupts", 0, 0); 206 process_file(&hs, "/proc/interrupts", 0, 0);
207 207
208 process_file(&hs, "/proc/loadavg", 0, 0); 208 process_file(&hs, "/proc/loadavg", 0, 0);
209 process_file(&hs, "/proc/sys/kernel/random/entropy_avail", 0, 0); 209 process_file(&hs, "/proc/sys/kernel/random/entropy_avail", 0, 0);
210 210
211 /* Mostly network visible but useful in some situations */ 211 /* Mostly network visible but useful in some situations.
212 process_file(&hs, "/proc/net/netstat", 0, 0); 212 * Limit size to avoid slowdowns on systems with lots of routes */
213 process_file(&hs, "/proc/net/dev", 0, 0); 213 process_file(&hs, "/proc/net/netstat", 4096, 0);
214 process_file(&hs, "/proc/net/tcp", 0, 0); 214 process_file(&hs, "/proc/net/dev", 4096, 0);
215 process_file(&hs, "/proc/net/tcp", 4096, 0);
215 /* Also includes interface lo */ 216 /* Also includes interface lo */
216 process_file(&hs, "/proc/net/rt_cache", 0, 0); 217 process_file(&hs, "/proc/net/rt_cache", 4096, 0);
217 process_file(&hs, "/proc/vmstat", 0, 0); 218 process_file(&hs, "/proc/vmstat", 0, 0);
218 #endif 219 #endif
219 220
220 pid = getpid(); 221 pid = getpid();
221 sha1_process(&hs, (void*)&pid, sizeof(pid)); 222 sha1_process(&hs, (void*)&pid, sizeof(pid));