]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Implement pthread_condattr_setpshared and pthread_condattr_getpshared.
authorTom Hughes <tom@compton.nu>
Fri, 29 Oct 2004 18:22:38 +0000 (18:22 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 29 Oct 2004 18:22:38 +0000 (18:22 +0000)
BUG: 92264

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2877

coregrind/vg_libpthread.c
coregrind/vg_libpthread_unimp.c

index db6a726b8052697d199750709eb280883db9a73b..bf6d31ead4a7c3129c072445279dca4f4569bb53 100644 (file)
@@ -138,6 +138,11 @@ typedef struct
    int __vg_mutexkind;
 } vg_pthread_mutexattr_t;
 
+typedef struct
+{
+   int __vg_pshared;
+} vg_pthread_condattr_t;
+
 typedef struct _vg_pthread_rwlock_t
 {
    struct _vg_pthread_fastlock __vg_rw_lock; /* Lock to guarantee mutual exclusion */
@@ -1068,7 +1073,7 @@ pthread_create (pthread_t *__restrict __thredd,
    info->arg     = __arg;
    sigprocmask(SIG_SETMASK, NULL, &info->sigmask);
 
-   if (__vg_attr) {
+   if (__attr) {
       si.base = (Addr)__vg_attr->__vg_stackaddr;
       si.size = __vg_attr->__vg_stacksize;
       si.guardsize = __vg_attr->__vg_guardsize;
@@ -1341,6 +1346,10 @@ int __pthread_mutex_destroy(pthread_mutex_t *mutex)
 
 int pthread_condattr_init(pthread_condattr_t *attr)
 {
+   vg_pthread_condattr_t* vg_attr;
+   CONVERT(condattr, attr, vg_attr);
+
+   vg_attr->__vg_pshared = 0;
    return 0;
 }
 
@@ -1348,6 +1357,32 @@ int pthread_condattr_destroy(pthread_condattr_t *attr)
 {
    return 0;
 }
+int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
+{ 
+   static int moans = N_MOANS;
+   vg_pthread_condattr_t* vg_attr;
+   CONVERT(condattr, attr, vg_attr);
+
+   if (pshared != PTHREAD_PROCESS_PRIVATE && 
+       pshared != PTHREAD_PROCESS_SHARED)
+      return EINVAL;
+
+   if (pshared == PTHREAD_PROCESS_SHARED && moans-- > 0) 
+      kludged("pthread_setschedparam", "(process shared condition variables not supported)");
+
+   vg_attr->__vg_pshared = pshared;
+   return 0;
+}
+
+int pthread_condattr_getpshared (const pthread_condattr_t *attr, int *pshared)
+{
+   vg_pthread_condattr_t* vg_attr;
+   CONVERT(condattr, attr, vg_attr);
+
+   *pshared = vg_attr->__vg_pshared;
+   return 0;
+}
 
 int pthread_cond_init( pthread_cond_t *cond,
                       const pthread_condattr_t *cond_attr)
index f40c57d9cff2616efbb1eea04f43b07af6d82f58..c39a08bed317d35dd34afb7ffd77392cc4b503b6 100644 (file)
@@ -119,9 +119,9 @@ void pthread_barrierattr_setpshared ( void )  { unimp("pthread_barrierattr_setps
 //void pthread_cond_timedwait ( void )  { unimp("pthread_cond_timedwait"); }
 //void pthread_cond_wait ( void )  { unimp("pthread_cond_wait"); }
 //void pthread_condattr_destroy ( void )  { unimp("pthread_condattr_destroy"); }
-void pthread_condattr_getpshared ( void )  { unimp("pthread_condattr_getpshared"); }
+//void pthread_condattr_getpshared ( void )  { unimp("pthread_condattr_getpshared"); }
 //void pthread_condattr_init ( void )  { unimp("pthread_condattr_init"); }
-void pthread_condattr_setpshared ( void )  { unimp("pthread_condattr_setpshared"); }
+//void pthread_condattr_setpshared ( void )  { unimp("pthread_condattr_setpshared"); }
 //void pthread_detach ( void )  { unimp("pthread_detach"); }
 //void pthread_equal ( void )  { unimp("pthread_equal"); }
 //void pthread_exit ( void )  { unimp("pthread_exit"); }