summaryrefslogtreecommitdiff
path: root/pthread_support.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-04-22 23:40:15 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:58 +0200
commitd1afd6d5538d21c7ff854563bcedab00d2c0b8ee (patch)
treefa6907e8f93f0f990cf80595793f71875fb6178b /pthread_support.c
parent583e58963af8a38848e91d5fab2039e42d6cb911 (diff)
2011-04-22 Ivan Maidanski <ivmai@mail.ru>
* os_dep.c (GC_get_maps): Always close the file. * pthread_support.c (GC_get_nprocs): Ditto. * os_dep.c (READ): Define similarly across the file (without parameters). * pthread_support.c (GC_get_nprocs): Use signed int type for "i" and "len" local variables (since read() may return -1). * include/private/gc_pmark.h (LONG_MULT): Add prefix/suffix double underscore; add "volatile" for asm. * include/private/gc_pmark.h (LONG_MULT): Add missing parentheses. * include/private/gc_priv.h (OR_WORD): Ditto. * include/private/gc_priv.h (OR_WORD): Remove unnecessary brackets and ';' symbol.
Diffstat (limited to 'pthread_support.c')
-rw-r--r--pthread_support.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pthread_support.c b/pthread_support.c
index 16d0dc9..d9c3792 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -727,13 +727,14 @@ STATIC void GC_remove_all_threads_but_me(void)
/* Some old kernels only have a single "cpu nnnn ..." */
/* entry in /proc/stat. We identify those as */
/* uniprocessors. */
- size_t i, len = 0;
+ int i, len;
f = open("/proc/stat", O_RDONLY);
- if (f < 0 || (len = STAT_READ(f, stat_buf, STAT_BUF_SIZE)) < 100) {
+ if (f < 0) {
WARN("Couldn't read /proc/stat\n", 0);
return 1; /* assume an uniprocessor */
}
+ len = STAT_READ(f, stat_buf, STAT_BUF_SIZE);
close(f);
for (i = 0; i < len - 100; ++i) {