This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GC patch: close /proc/stat file descriptor


The linux threads port looks at /proc/stat on startup to check for
multiprocessors, but never closes it.  I can't see any reason to waste a
file descriptor on it.

Tested on i686-linux.

2002-03-24  Jeff Sturm  <jsturm@one-point.com>

	* linux_threads.c (GC_get_nprocs): Close file descriptor.

Index: linux_threads.c
===================================================================
RCS file: /cvs/gcc/gcc/boehm-gc/linux_threads.c,v
retrieving revision 1.18
diff -u -p -r1.18 linux_threads.c
--- linux_threads.c	2002/02/12 04:37:53	1.18
+++ linux_threads.c	2002/03/25 02:38:36
@@ -1015,6 +1015,7 @@ int GC_get_nprocs()
 	WARN("Couldn't read /proc/stat\n", 0);
 	return -1;
     }
+    close(f);
     for (i = 0; i < len - 100; ++i) {
         if (stat_buf[i] == '\n' && stat_buf[i+1] == 'c'
 	    && stat_buf[i+2] == 'p' && stat_buf[i+3] == 'u') {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]