summaryrefslogtreecommitdiff
path: root/debian/patches/dyson-qv4engine-getStackLimit.patch
blob: 6d5019bbc52bfade973b9a57ec391fa018938934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Index: qtdeclarative/src/qml/jsruntime/qv4engine.cpp
===================================================================
--- qtdeclarative.orig/src/qml/jsruntime/qv4engine.cpp
+++ qtdeclarative/src/qml/jsruntime/qv4engine.cpp
@@ -84,6 +84,10 @@
 #if HAVE(PTHREAD_NP_H)
 #  include <pthread_np.h>
 #endif
+#  if OS(SOLARIS)
+#    include <thread.h>
+#    include <errno.h>
+#  endif
 #endif
 
 QT_BEGIN_NAMESPACE
@@ -113,6 +117,19 @@ quintptr getStackLimit()
     } else
         size = pthread_get_stacksize_np(thread_self);
     stackLimit -= size;
+#  elif OS(SOLARIS)
+    stack_t ss;
+    int rc;
+    do {
+        rc = thr_stksegment(&ss); // can fail only with EAGAIN
+    } while ((rc != 0) && (errno == EAGAIN));
+    // Is stack "unlimited" ?
+    if (ss.ss_size == RLIM_INFINITY) {
+        stackLimit = 0xFFFF800000000000L;
+    } else {
+        stackLimit = reinterpret_cast<quintptr>(ss.ss_sp);
+        stackLimit -= ss.ss_size;
+    }
 #  else
     void* stackBottom = 0;
     pthread_attr_t attr;