• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/qt/qt-4.7.1-pthread_getattr_np_webkit.patch
Luca CeresoliLuca Ceresoli committed f53c46ffb2723 Nov 2010
Raw file
Source viewDiff to previous
xxxxxxxxxx
 
1
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp  2010-09-10 11:05:22.000000000 +0200
2
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Collector.cpp  2010-11-15 16:39:53.000000000 +0100
3
@@ -70,6 +70,18 @@
4
 #endif
5
 #include <unistd.h>
6
​
7
+#if defined(__UCLIBC__)
8
+// versions of uClibc 0.9.31 and below do not have
9
+// pthread_getattr_np or pthread_attr_getstack.
10
+#if __UCLIBC_MAJOR__ == 0 && \
11
+    (__UCLIBC_MINOR__ < 9 || \
12
+    (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ <= 31))
13
+#define UCLIBC_USE_PROC_SELF_MAPS 1
14
+#include <stdio_ext.h>
15
+extern int* __libc_stack_end;
16
+#endif
17
+#endif
18
+
19
 #if OS(SOLARIS)
20
 #include <thread.h>
21
 #else
22
@@ -580,6 +592,37 @@
23
     get_thread_info(find_thread(NULL), &threadInfo);
24
     return threadInfo.stack_end;
25
 #elif OS(UNIX)
26
+#ifdef UCLIBC_USE_PROC_SELF_MAPS
27
+    // Read /proc/self/maps and locate the line whose address
28
+    // range contains __libc_stack_end.
29
+    FILE* file = fopen("/proc/self/maps", "r");
30
+    if (!file)
31
+        return 0;
32
+    __fsetlocking(file, FSETLOCKING_BYCALLER);
33
+    char* line = 0;
34
+    size_t lineLen = 0;
35
+    while (!feof_unlocked(file)) {
36
+        if (getdelim(&line, &lineLen, '\n', file) <= 0)
37
+            break;
38
+
39
+        long from;
40
+        long to;
41
+        if (sscanf (line, "%lx-%lx", &from, &to) != 2)
42
+            continue;
43
+        if (from <= (long)__libc_stack_end && (long)__libc_stack_end < to) {
44
+            fclose(file);
45
+            free(line);
46
+#ifdef _STACK_GROWS_UP
47
+            return (void *)from;
48
+#else
49
+            return (void *)to;
50
+#endif
51
+        }
52
+    }
53
+    fclose(file);
54
+    free(line);
55
+    return 0;
56
+#else
57
     AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
58
     MutexLocker locker(mutex);
59
     static void* stackBase = 0;
60
@@ -603,6 +646,7 @@
61
         stackThread = thread;
62
     }
63
     return static_cast<char*>(stackBase) + stackSize;
64
+#endif
65
 #elif OS(WINCE)
66
     AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex);
67
     MutexLocker locker(mutex);
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.