Minimal impl of pthread_attr_setstacksize.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@279 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c
index e0f4806..7457dd2 100644
--- a/coregrind/arch/x86-linux/vg_libpthread.c
+++ b/coregrind/arch/x86-linux/vg_libpthread.c
@@ -156,15 +156,6 @@
static void not_inside ( char* msg )
{
VG_(startup)();
- return;
- if (get_pt_trace_level() >= 0) {
- char* ig = "valgrind's libpthread.so: NOT INSIDE VALGRIND "
- "during call to: ";
- write(2, ig, strlen(ig));
- write(2, msg, strlen(msg));
- ig = "\n";
- write(2, ig, strlen(ig));
- }
}
void vgPlain_unimp ( char* what )
@@ -216,6 +207,19 @@
return 0;
}
+__attribute__((weak))
+int pthread_attr_setstacksize (pthread_attr_t *__attr,
+ size_t __stacksize)
+{
+ ensure_valgrind("pthread_attr_setstacksize");
+ if (__stacksize < VG_PTHREAD_STACK_SIZE)
+ return 0;
+ barf("pthread_attr_setstacksize: "
+ "requested size >= VG_PTHREAD_STACK_SIZE\n "
+ "edit vg_include.h and rebuild.");
+}
+
+
/* This is completely bogus. */
int pthread_attr_getschedparam(const pthread_attr_t *attr,
struct sched_param *param)
diff --git a/coregrind/arch/x86-linux/vg_libpthread_unimp.c b/coregrind/arch/x86-linux/vg_libpthread_unimp.c
index 6eb8040..4154a33 100644
--- a/coregrind/arch/x86-linux/vg_libpthread_unimp.c
+++ b/coregrind/arch/x86-linux/vg_libpthread_unimp.c
@@ -227,8 +227,8 @@
{ vgPlain_unimp("pthread_attr_setstack"); }
__attribute__((weak)) void pthread_attr_setstackaddr ( void )
{ vgPlain_unimp("pthread_attr_setstackaddr"); }
-__attribute__((weak)) void pthread_attr_setstacksize ( void )
- { vgPlain_unimp("pthread_attr_setstacksize"); }
+//__attribute__((weak)) void pthread_attr_setstacksize ( void )
+// { vgPlain_unimp("pthread_attr_setstacksize"); }
__attribute__((weak)) void pthread_getconcurrency ( void )
{ vgPlain_unimp("pthread_getconcurrency"); }
__attribute__((weak)) void pthread_kill_other_threads_np ( void )
diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c
index e0f4806..7457dd2 100644
--- a/coregrind/vg_libpthread.c
+++ b/coregrind/vg_libpthread.c
@@ -156,15 +156,6 @@
static void not_inside ( char* msg )
{
VG_(startup)();
- return;
- if (get_pt_trace_level() >= 0) {
- char* ig = "valgrind's libpthread.so: NOT INSIDE VALGRIND "
- "during call to: ";
- write(2, ig, strlen(ig));
- write(2, msg, strlen(msg));
- ig = "\n";
- write(2, ig, strlen(ig));
- }
}
void vgPlain_unimp ( char* what )
@@ -216,6 +207,19 @@
return 0;
}
+__attribute__((weak))
+int pthread_attr_setstacksize (pthread_attr_t *__attr,
+ size_t __stacksize)
+{
+ ensure_valgrind("pthread_attr_setstacksize");
+ if (__stacksize < VG_PTHREAD_STACK_SIZE)
+ return 0;
+ barf("pthread_attr_setstacksize: "
+ "requested size >= VG_PTHREAD_STACK_SIZE\n "
+ "edit vg_include.h and rebuild.");
+}
+
+
/* This is completely bogus. */
int pthread_attr_getschedparam(const pthread_attr_t *attr,
struct sched_param *param)
diff --git a/coregrind/vg_libpthread_unimp.c b/coregrind/vg_libpthread_unimp.c
index 6eb8040..4154a33 100644
--- a/coregrind/vg_libpthread_unimp.c
+++ b/coregrind/vg_libpthread_unimp.c
@@ -227,8 +227,8 @@
{ vgPlain_unimp("pthread_attr_setstack"); }
__attribute__((weak)) void pthread_attr_setstackaddr ( void )
{ vgPlain_unimp("pthread_attr_setstackaddr"); }
-__attribute__((weak)) void pthread_attr_setstacksize ( void )
- { vgPlain_unimp("pthread_attr_setstacksize"); }
+//__attribute__((weak)) void pthread_attr_setstacksize ( void )
+// { vgPlain_unimp("pthread_attr_setstacksize"); }
__attribute__((weak)) void pthread_getconcurrency ( void )
{ vgPlain_unimp("pthread_getconcurrency"); }
__attribute__((weak)) void pthread_kill_other_threads_np ( void )
diff --git a/vg_libpthread.c b/vg_libpthread.c
index e0f4806..7457dd2 100644
--- a/vg_libpthread.c
+++ b/vg_libpthread.c
@@ -156,15 +156,6 @@
static void not_inside ( char* msg )
{
VG_(startup)();
- return;
- if (get_pt_trace_level() >= 0) {
- char* ig = "valgrind's libpthread.so: NOT INSIDE VALGRIND "
- "during call to: ";
- write(2, ig, strlen(ig));
- write(2, msg, strlen(msg));
- ig = "\n";
- write(2, ig, strlen(ig));
- }
}
void vgPlain_unimp ( char* what )
@@ -216,6 +207,19 @@
return 0;
}
+__attribute__((weak))
+int pthread_attr_setstacksize (pthread_attr_t *__attr,
+ size_t __stacksize)
+{
+ ensure_valgrind("pthread_attr_setstacksize");
+ if (__stacksize < VG_PTHREAD_STACK_SIZE)
+ return 0;
+ barf("pthread_attr_setstacksize: "
+ "requested size >= VG_PTHREAD_STACK_SIZE\n "
+ "edit vg_include.h and rebuild.");
+}
+
+
/* This is completely bogus. */
int pthread_attr_getschedparam(const pthread_attr_t *attr,
struct sched_param *param)
diff --git a/vg_libpthread_unimp.c b/vg_libpthread_unimp.c
index 6eb8040..4154a33 100644
--- a/vg_libpthread_unimp.c
+++ b/vg_libpthread_unimp.c
@@ -227,8 +227,8 @@
{ vgPlain_unimp("pthread_attr_setstack"); }
__attribute__((weak)) void pthread_attr_setstackaddr ( void )
{ vgPlain_unimp("pthread_attr_setstackaddr"); }
-__attribute__((weak)) void pthread_attr_setstacksize ( void )
- { vgPlain_unimp("pthread_attr_setstacksize"); }
+//__attribute__((weak)) void pthread_attr_setstacksize ( void )
+// { vgPlain_unimp("pthread_attr_setstacksize"); }
__attribute__((weak)) void pthread_getconcurrency ( void )
{ vgPlain_unimp("pthread_getconcurrency"); }
__attribute__((weak)) void pthread_kill_other_threads_np ( void )