summaryrefslogtreecommitdiffstats
path: root/meta/packages/gcc/gcc-4.3.1/debian/boehm-gc-getnprocs.dpatch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/gcc/gcc-4.3.1/debian/boehm-gc-getnprocs.dpatch')
-rw-r--r--meta/packages/gcc/gcc-4.3.1/debian/boehm-gc-getnprocs.dpatch39
1 files changed, 39 insertions, 0 deletions
diff --git a/meta/packages/gcc/gcc-4.3.1/debian/boehm-gc-getnprocs.dpatch b/meta/packages/gcc/gcc-4.3.1/debian/boehm-gc-getnprocs.dpatch
new file mode 100644
index 0000000000..8d85cdcbb0
--- /dev/null
+++ b/meta/packages/gcc/gcc-4.3.1/debian/boehm-gc-getnprocs.dpatch
@@ -0,0 +1,39 @@
1#! /bin/sh -e
2
3# DP: boehm-gc/pthread_support.c (GC_get_nprocs): Use sysconf as fallback.
4
5dir=
6if [ $# -eq 3 -a "$2" = '-d' ]; then
7 pdir="-d $3"
8 dir="$3/"
9elif [ $# -ne 1 ]; then
10 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
11 exit 1
12fi
13case "$1" in
14 -patch)
15 patch $pdir -f --no-backup-if-mismatch -p0 < $0
16 ;;
17 -unpatch)
18 patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
19 ;;
20 *)
21 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
22 exit 1
23esac
24exit 0
25
26Index: boehm-gc/pthread_support.c
27===================================================================
28--- boehm-gc/pthread_support.c (revision 127207)
29+++ boehm-gc/pthread_support.c (working copy)
30@@ -724,7 +724,8 @@
31 f = open("/proc/stat", O_RDONLY);
32 if (f < 0 || (len = STAT_READ(f, stat_buf, STAT_BUF_SIZE)) < 100) {
33 WARN("Couldn't read /proc/stat\n", 0);
34- return -1;
35+ /* Fallback to sysconf after the warning */
36+ return sysconf(_SC_NPROCESSORS_ONLN);
37 }
38 for (i = 0; i < len - 100; ++i) {
39 if (stat_buf[i] == '\n' && stat_buf[i+1] == 'c'