]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Cancellation wrapper for __pwrite64 (Adam Zell(?))
authorJulian Seward <jseward@acm.org>
Sat, 18 May 2002 10:43:22 +0000 (10:43 +0000)
committerJulian Seward <jseward@acm.org>
Sat, 18 May 2002 10:43:22 +0000 (10:43 +0000)
Be more paranoid in pthread_attr_setstacksize

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

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

index fba83c50ba5e0bad7868e09f348210d39fd4f0c9..93cb7373ddaa2811c70cd3b77542b713f58c23ab 100644 (file)
@@ -211,8 +211,11 @@ __attribute__((weak))
 int pthread_attr_setstacksize (pthread_attr_t *__attr,
                                size_t __stacksize)
 {
+   size_t limit;
    ensure_valgrind("pthread_attr_setstacksize");
-   if (__stacksize < VG_PTHREAD_STACK_SIZE)
+   limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB 
+                                 - 1000; /* paranoia */
+   if (__stacksize < limit)
       return 0;
    barf("pthread_attr_setstacksize: "
         "requested size >= VG_PTHREAD_STACK_SIZE\n   "
@@ -1125,6 +1128,15 @@ ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes,
 }
 
 
+extern
+ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __nbytes,
+                        __off64_t __offset);
+ssize_t __pwrite64 (int __fd, const void *__buf, size_t __nbytes,
+                   __off64_t __offset)
+{
+   return __libc_pwrite64(__fd, __buf, __nbytes, __offset);
+}
+
 
 extern  
 void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn));
@@ -1553,6 +1565,7 @@ strong_alias(connect, __connect)
 strong_alias(send, __send)
 
 weak_alias (__pread64, pread64)
+weak_alias (__pwrite64, pwrite64)
 weak_alias(__fork, fork)
 //weak_alias(__vfork, vfork)
 
index d3a38b21594e18a39dd4e860d3ee5a51b945c320..93a12469454e99770b9f7a07c206628b3717800d 100644 (file)
@@ -67,7 +67,7 @@ void __libc_current_sigrtmin ( void )  { unimp("__libc_current_sigrtmin"); }
 //void __pthread_mutexattr_settype ( void )  { unimp("__pthread_mutexattr_settype"); }
 //void __pthread_once ( void )  { unimp("__pthread_once"); }
 //void __pthread_setspecific ( void )  { unimp("__pthread_setspecific"); }
-void __pwrite64 ( void )  { unimp("__pwrite64"); }
+//void __pwrite64 ( void )  { unimp("__pwrite64"); }
 //void __read ( void )  { unimp("__read"); }
 //void __res_state ( void )  { unimp("__res_state"); }
 //void __send ( void )  { unimp("__send"); }
@@ -193,8 +193,6 @@ void pthread_attr_init@GLIBC_2.0 ( void )  { unimp("pthread_attr_init@GLIBC_2.0"
 # define weak_alias(name, aliasname) \
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
 
-weak_alias (__pwrite64, pwrite64)
-
 weak_alias(pthread_rwlock_destroy, __pthread_rwlock_destroy)
 weak_alias(pthread_rwlock_init, __pthread_rwlock_init)
 weak_alias(pthread_rwlock_tryrdlock, __pthread_rwlock_tryrdlock)
index fba83c50ba5e0bad7868e09f348210d39fd4f0c9..93cb7373ddaa2811c70cd3b77542b713f58c23ab 100644 (file)
@@ -211,8 +211,11 @@ __attribute__((weak))
 int pthread_attr_setstacksize (pthread_attr_t *__attr,
                                size_t __stacksize)
 {
+   size_t limit;
    ensure_valgrind("pthread_attr_setstacksize");
-   if (__stacksize < VG_PTHREAD_STACK_SIZE)
+   limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB 
+                                 - 1000; /* paranoia */
+   if (__stacksize < limit)
       return 0;
    barf("pthread_attr_setstacksize: "
         "requested size >= VG_PTHREAD_STACK_SIZE\n   "
@@ -1125,6 +1128,15 @@ ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes,
 }
 
 
+extern
+ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __nbytes,
+                        __off64_t __offset);
+ssize_t __pwrite64 (int __fd, const void *__buf, size_t __nbytes,
+                   __off64_t __offset)
+{
+   return __libc_pwrite64(__fd, __buf, __nbytes, __offset);
+}
+
 
 extern  
 void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn));
@@ -1553,6 +1565,7 @@ strong_alias(connect, __connect)
 strong_alias(send, __send)
 
 weak_alias (__pread64, pread64)
+weak_alias (__pwrite64, pwrite64)
 weak_alias(__fork, fork)
 //weak_alias(__vfork, vfork)
 
index d3a38b21594e18a39dd4e860d3ee5a51b945c320..93a12469454e99770b9f7a07c206628b3717800d 100644 (file)
@@ -67,7 +67,7 @@ void __libc_current_sigrtmin ( void )  { unimp("__libc_current_sigrtmin"); }
 //void __pthread_mutexattr_settype ( void )  { unimp("__pthread_mutexattr_settype"); }
 //void __pthread_once ( void )  { unimp("__pthread_once"); }
 //void __pthread_setspecific ( void )  { unimp("__pthread_setspecific"); }
-void __pwrite64 ( void )  { unimp("__pwrite64"); }
+//void __pwrite64 ( void )  { unimp("__pwrite64"); }
 //void __read ( void )  { unimp("__read"); }
 //void __res_state ( void )  { unimp("__res_state"); }
 //void __send ( void )  { unimp("__send"); }
@@ -193,8 +193,6 @@ void pthread_attr_init@GLIBC_2.0 ( void )  { unimp("pthread_attr_init@GLIBC_2.0"
 # define weak_alias(name, aliasname) \
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
 
-weak_alias (__pwrite64, pwrite64)
-
 weak_alias(pthread_rwlock_destroy, __pthread_rwlock_destroy)
 weak_alias(pthread_rwlock_init, __pthread_rwlock_init)
 weak_alias(pthread_rwlock_tryrdlock, __pthread_rwlock_tryrdlock)
index fba83c50ba5e0bad7868e09f348210d39fd4f0c9..93cb7373ddaa2811c70cd3b77542b713f58c23ab 100644 (file)
@@ -211,8 +211,11 @@ __attribute__((weak))
 int pthread_attr_setstacksize (pthread_attr_t *__attr,
                                size_t __stacksize)
 {
+   size_t limit;
    ensure_valgrind("pthread_attr_setstacksize");
-   if (__stacksize < VG_PTHREAD_STACK_SIZE)
+   limit = VG_PTHREAD_STACK_SIZE - VG_AR_CLIENT_STACKBASE_REDZONE_SZB 
+                                 - 1000; /* paranoia */
+   if (__stacksize < limit)
       return 0;
    barf("pthread_attr_setstacksize: "
         "requested size >= VG_PTHREAD_STACK_SIZE\n   "
@@ -1125,6 +1128,15 @@ ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes,
 }
 
 
+extern
+ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __nbytes,
+                        __off64_t __offset);
+ssize_t __pwrite64 (int __fd, const void *__buf, size_t __nbytes,
+                   __off64_t __offset)
+{
+   return __libc_pwrite64(__fd, __buf, __nbytes, __offset);
+}
+
 
 extern  
 void __libc_longjmp(jmp_buf env, int val) __attribute((noreturn));
@@ -1553,6 +1565,7 @@ strong_alias(connect, __connect)
 strong_alias(send, __send)
 
 weak_alias (__pread64, pread64)
+weak_alias (__pwrite64, pwrite64)
 weak_alias(__fork, fork)
 //weak_alias(__vfork, vfork)
 
index d3a38b21594e18a39dd4e860d3ee5a51b945c320..93a12469454e99770b9f7a07c206628b3717800d 100644 (file)
@@ -67,7 +67,7 @@ void __libc_current_sigrtmin ( void )  { unimp("__libc_current_sigrtmin"); }
 //void __pthread_mutexattr_settype ( void )  { unimp("__pthread_mutexattr_settype"); }
 //void __pthread_once ( void )  { unimp("__pthread_once"); }
 //void __pthread_setspecific ( void )  { unimp("__pthread_setspecific"); }
-void __pwrite64 ( void )  { unimp("__pwrite64"); }
+//void __pwrite64 ( void )  { unimp("__pwrite64"); }
 //void __read ( void )  { unimp("__read"); }
 //void __res_state ( void )  { unimp("__res_state"); }
 //void __send ( void )  { unimp("__send"); }
@@ -193,8 +193,6 @@ void pthread_attr_init@GLIBC_2.0 ( void )  { unimp("pthread_attr_init@GLIBC_2.0"
 # define weak_alias(name, aliasname) \
   extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
 
-weak_alias (__pwrite64, pwrite64)
-
 weak_alias(pthread_rwlock_destroy, __pthread_rwlock_destroy)
 weak_alias(pthread_rwlock_init, __pthread_rwlock_init)
 weak_alias(pthread_rwlock_tryrdlock, __pthread_rwlock_tryrdlock)