Do pthread_atter_{set,get}scope.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@360 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/arch/x86-linux/vg_libpthread.c b/coregrind/arch/x86-linux/vg_libpthread.c
index 953f3d1..56f435b 100644
--- a/coregrind/arch/x86-linux/vg_libpthread.c
+++ b/coregrind/arch/x86-linux/vg_libpthread.c
@@ -269,6 +269,25 @@
return 0;
}
+/* These are no-ops, as with LinuxThreads. */
+int pthread_attr_setscope ( pthread_attr_t *attr, int scope )
+{
+ ensure_valgrind("pthread_attr_setscope");
+ if (scope == PTHREAD_SCOPE_SYSTEM)
+ return 0;
+ if (scope == PTHREAD_SCOPE_PROCESS)
+ return ENOTSUP;
+ return EINVAL;
+}
+
+int pthread_attr_getscope ( const pthread_attr_t *attr, int *scope )
+{
+ ensure_valgrind("pthread_attr_setscope");
+ if (scope)
+ *scope = PTHREAD_SCOPE_SYSTEM;
+ return 0;
+}
+
/* ---------------------------------------------------
Helper functions for running a thread
and for clearing up afterwards.
diff --git a/coregrind/arch/x86-linux/vg_libpthread_unimp.c b/coregrind/arch/x86-linux/vg_libpthread_unimp.c
index de92468..b5d1349 100644
--- a/coregrind/arch/x86-linux/vg_libpthread_unimp.c
+++ b/coregrind/arch/x86-linux/vg_libpthread_unimp.c
@@ -86,13 +86,13 @@
void pthread_attr_getinheritsched ( void ) { unimp("pthread_attr_getinheritsched"); }
//void pthread_attr_getschedparam ( void ) { unimp("pthread_attr_getschedparam"); }
void pthread_attr_getschedpolicy ( void ) { unimp("pthread_attr_getschedpolicy"); }
-void pthread_attr_getscope ( void ) { unimp("pthread_attr_getscope"); }
+//void pthread_attr_getscope ( void ) { unimp("pthread_attr_getscope"); }
//void pthread_attr_setdetachstate ( void ) { unimp("pthread_attr_setdetachstate"); }
//void pthread_attr_setinheritsched ( void ) { unimp("pthread_attr_setinheritsched"); }
//void pthread_attr_setschedparam ( void ) { unimp("pthread_attr_setschedparam"); }
void pthread_attr_setschedpolicy ( void ) { unimp("pthread_attr_setschedpolicy"); }
-void pthread_attr_setscope ( void ) { unimp("pthread_attr_setscope"); }
+//void pthread_attr_setscope ( void ) { unimp("pthread_attr_setscope"); }
void pthread_barrier_destroy ( void ) { unimp("pthread_barrier_destroy"); }
void pthread_barrier_init ( void ) { unimp("pthread_barrier_init"); }
void pthread_barrier_wait ( void ) { unimp("pthread_barrier_wait"); }
diff --git a/coregrind/vg_libpthread.c b/coregrind/vg_libpthread.c
index 953f3d1..56f435b 100644
--- a/coregrind/vg_libpthread.c
+++ b/coregrind/vg_libpthread.c
@@ -269,6 +269,25 @@
return 0;
}
+/* These are no-ops, as with LinuxThreads. */
+int pthread_attr_setscope ( pthread_attr_t *attr, int scope )
+{
+ ensure_valgrind("pthread_attr_setscope");
+ if (scope == PTHREAD_SCOPE_SYSTEM)
+ return 0;
+ if (scope == PTHREAD_SCOPE_PROCESS)
+ return ENOTSUP;
+ return EINVAL;
+}
+
+int pthread_attr_getscope ( const pthread_attr_t *attr, int *scope )
+{
+ ensure_valgrind("pthread_attr_setscope");
+ if (scope)
+ *scope = PTHREAD_SCOPE_SYSTEM;
+ return 0;
+}
+
/* ---------------------------------------------------
Helper functions for running a thread
and for clearing up afterwards.
diff --git a/coregrind/vg_libpthread_unimp.c b/coregrind/vg_libpthread_unimp.c
index de92468..b5d1349 100644
--- a/coregrind/vg_libpthread_unimp.c
+++ b/coregrind/vg_libpthread_unimp.c
@@ -86,13 +86,13 @@
void pthread_attr_getinheritsched ( void ) { unimp("pthread_attr_getinheritsched"); }
//void pthread_attr_getschedparam ( void ) { unimp("pthread_attr_getschedparam"); }
void pthread_attr_getschedpolicy ( void ) { unimp("pthread_attr_getschedpolicy"); }
-void pthread_attr_getscope ( void ) { unimp("pthread_attr_getscope"); }
+//void pthread_attr_getscope ( void ) { unimp("pthread_attr_getscope"); }
//void pthread_attr_setdetachstate ( void ) { unimp("pthread_attr_setdetachstate"); }
//void pthread_attr_setinheritsched ( void ) { unimp("pthread_attr_setinheritsched"); }
//void pthread_attr_setschedparam ( void ) { unimp("pthread_attr_setschedparam"); }
void pthread_attr_setschedpolicy ( void ) { unimp("pthread_attr_setschedpolicy"); }
-void pthread_attr_setscope ( void ) { unimp("pthread_attr_setscope"); }
+//void pthread_attr_setscope ( void ) { unimp("pthread_attr_setscope"); }
void pthread_barrier_destroy ( void ) { unimp("pthread_barrier_destroy"); }
void pthread_barrier_init ( void ) { unimp("pthread_barrier_init"); }
void pthread_barrier_wait ( void ) { unimp("pthread_barrier_wait"); }