]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add more pthread wrappers in a failed attempt to get Opera 6.0TP2
authorJulian Seward <jseward@acm.org>
Tue, 16 Apr 2002 04:40:49 +0000 (04:40 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 16 Apr 2002 04:40:49 +0000 (04:40 +0000)
to run.  Now it creates some threads but segfaults.  Also add
wrapper for syscall __NR_mremap; it is way wrong, but finding
a decent description of what mremap() really does is nearly
impossible.

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

coregrind/arch/x86-linux/vg_libpthread.c
coregrind/vg_libpthread.c
vg_libpthread.c
vg_syscall_mem.c

index 08abf328116d47349f1e95e77f9c65edc7276b42..ab397457de2ed08bb54093b5fcf0fb4ab33adc96 100644 (file)
@@ -32,7 +32,7 @@
    ------------------------------------------------------------------ */
 
 /* Set to 1 to see IGNORED debugging messages. */
-static int show_IGNORED = 0;
+static int show_IGNORED = 1;
 
 
 /* ---------------------------------------------------------------------
@@ -108,6 +108,19 @@ static void ignored ( char* msg )
    Pass pthread_ calls to Valgrind's request mechanism.
    ------------------------------------------------------------------ */
 
+int pthread_attr_init(pthread_attr_t *attr)
+{
+   ignored("pthread_attr_init");
+   return 0;
+}
+
+int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
+{
+   ignored("pthread_attr_setdetachstate");
+   return 0;
+}
+
+
 int
 pthread_create (pthread_t *__restrict __thread,
                 __const pthread_attr_t *__restrict __attr,
@@ -188,8 +201,14 @@ int pthread_mutex_init(pthread_mutex_t *mutex,
 
 int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
 {
-  ignored("pthread_mutexattr_destroy");
-  return 0;
+   ignored("pthread_mutexattr_destroy");
+   return 0;
+}
+
+int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
+{
+   ignored("pthread_mutexattr_settype");
+   return 0;
 }
 
 int pthread_mutex_lock(pthread_mutex_t *mutex)
@@ -437,6 +456,20 @@ off_t lseek(int fildes, off_t offset, int whence)
   return __libc_lseek(fildes, offset, whence);
 }
 
+extern  
+void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn));
+void longjmp(jmp_buf env, int val)
+{
+   __libc_longjmp(env, val);
+}
+
+extern
+int __libc_send(int s, const void *msg, size_t len, int flags);
+int send(int s, const void *msg, size_t len, int flags)
+{
+   return __libc_send(s, msg, len, flags);
+}
+
 /*--------------------------------------------------*/
 
 /* I've no idea what these are, but they get called quite a lot.
index 08abf328116d47349f1e95e77f9c65edc7276b42..ab397457de2ed08bb54093b5fcf0fb4ab33adc96 100644 (file)
@@ -32,7 +32,7 @@
    ------------------------------------------------------------------ */
 
 /* Set to 1 to see IGNORED debugging messages. */
-static int show_IGNORED = 0;
+static int show_IGNORED = 1;
 
 
 /* ---------------------------------------------------------------------
@@ -108,6 +108,19 @@ static void ignored ( char* msg )
    Pass pthread_ calls to Valgrind's request mechanism.
    ------------------------------------------------------------------ */
 
+int pthread_attr_init(pthread_attr_t *attr)
+{
+   ignored("pthread_attr_init");
+   return 0;
+}
+
+int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
+{
+   ignored("pthread_attr_setdetachstate");
+   return 0;
+}
+
+
 int
 pthread_create (pthread_t *__restrict __thread,
                 __const pthread_attr_t *__restrict __attr,
@@ -188,8 +201,14 @@ int pthread_mutex_init(pthread_mutex_t *mutex,
 
 int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
 {
-  ignored("pthread_mutexattr_destroy");
-  return 0;
+   ignored("pthread_mutexattr_destroy");
+   return 0;
+}
+
+int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
+{
+   ignored("pthread_mutexattr_settype");
+   return 0;
 }
 
 int pthread_mutex_lock(pthread_mutex_t *mutex)
@@ -437,6 +456,20 @@ off_t lseek(int fildes, off_t offset, int whence)
   return __libc_lseek(fildes, offset, whence);
 }
 
+extern  
+void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn));
+void longjmp(jmp_buf env, int val)
+{
+   __libc_longjmp(env, val);
+}
+
+extern
+int __libc_send(int s, const void *msg, size_t len, int flags);
+int send(int s, const void *msg, size_t len, int flags)
+{
+   return __libc_send(s, msg, len, flags);
+}
+
 /*--------------------------------------------------*/
 
 /* I've no idea what these are, but they get called quite a lot.
index 08abf328116d47349f1e95e77f9c65edc7276b42..ab397457de2ed08bb54093b5fcf0fb4ab33adc96 100644 (file)
@@ -32,7 +32,7 @@
    ------------------------------------------------------------------ */
 
 /* Set to 1 to see IGNORED debugging messages. */
-static int show_IGNORED = 0;
+static int show_IGNORED = 1;
 
 
 /* ---------------------------------------------------------------------
@@ -108,6 +108,19 @@ static void ignored ( char* msg )
    Pass pthread_ calls to Valgrind's request mechanism.
    ------------------------------------------------------------------ */
 
+int pthread_attr_init(pthread_attr_t *attr)
+{
+   ignored("pthread_attr_init");
+   return 0;
+}
+
+int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
+{
+   ignored("pthread_attr_setdetachstate");
+   return 0;
+}
+
+
 int
 pthread_create (pthread_t *__restrict __thread,
                 __const pthread_attr_t *__restrict __attr,
@@ -188,8 +201,14 @@ int pthread_mutex_init(pthread_mutex_t *mutex,
 
 int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
 {
-  ignored("pthread_mutexattr_destroy");
-  return 0;
+   ignored("pthread_mutexattr_destroy");
+   return 0;
+}
+
+int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
+{
+   ignored("pthread_mutexattr_settype");
+   return 0;
 }
 
 int pthread_mutex_lock(pthread_mutex_t *mutex)
@@ -437,6 +456,20 @@ off_t lseek(int fildes, off_t offset, int whence)
   return __libc_lseek(fildes, offset, whence);
 }
 
+extern  
+void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn));
+void longjmp(jmp_buf env, int val)
+{
+   __libc_longjmp(env, val);
+}
+
+extern
+int __libc_send(int s, const void *msg, size_t len, int flags);
+int send(int s, const void *msg, size_t len, int flags)
+{
+   return __libc_send(s, msg, len, flags);
+}
+
 /*--------------------------------------------------*/
 
 /* I've no idea what these are, but they get called quite a lot.
index e9c788234c7c7b322d3085d7cf0602c2072ed73b..aebd4e0e632f9f7ecbafd4b4b4db4ff542b123ca 100644 (file)
@@ -354,6 +354,33 @@ void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid )
 
       /* !!!!!!!!!! New, untested syscalls !!!!!!!!!!!!!!!!!!!!! */
 
+#     if defined(__NR_mremap)
+      /* Is this really right?  Perhaps it should copy the permissions
+         from the old area into the new.  Unclear from the Linux man
+         pages what this really does.  Also, the flags don't look like
+         they mean the same as the standard mmap flags, so that's
+         probably wrong too. */
+      case __NR_mremap: /* syscall 163 */
+         /* void* mremap(void * old_address, size_t old_size, 
+                         size_t new_size, unsigned long flags); */
+         if (VG_(clo_trace_syscalls))
+            VG_(printf)("mremap ( %p, %d, %d, 0x%x )\n", 
+                        arg1, arg2, arg3, arg4);
+         must_be_writable ( tst, "mremap(old_address)", arg1, arg2 );
+         KERNEL_DO_SYSCALL(tid,res);
+         if (!VG_(is_kerror)(res)) {
+            /* Copied from munmap() wrapper. */
+            Addr start  = arg1;
+            Addr length = arg2;
+            while ((start % VKI_BYTES_PER_PAGE) > 0) { start--; length++; }
+            while (((start+length) % VKI_BYTES_PER_PAGE) > 0) { length++; }
+            make_noaccess( start, length );
+            VG_(symtab_notify_munmap) ( start, length );
+            approximate_mmap_permissions( (Addr)res, arg3, arg4 );
+         }
+         break;         
+#     endif
+
       case __NR_nice: /* syscall 34 */
          /* int nice(int inc); */
          if (VG_(clo_trace_syscalls))