Remove valgrind's use of libc-supplied stat() and sbrk(). Now the only
sysbols we need from libc are __umoddi3 and __udivdi3 ; other than that
valgrind.so is completely self-contained.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@244 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_mylibc.c b/coregrind/vg_mylibc.c
index 77dd153..fec258a 100644
--- a/coregrind/vg_mylibc.c
+++ b/coregrind/vg_mylibc.c
@@ -288,7 +288,6 @@
args[4] = (UInt)timeout;
res = vg_do_syscall1(__NR_select, (UInt)(&(args[0])) );
return VG_(is_kerror)(res) ? -1 : res;
- return res;
}
/* Returns -1 on error, 0 if ok, 1 if interrupted. */
@@ -302,6 +301,13 @@
return 0;
}
+void* VG_(brk) ( void* end_data_segment )
+{
+ Int res;
+ res = vg_do_syscall1(__NR_brk, (UInt)end_data_segment);
+ return (void*)( VG_(is_kerror)(res) ? -1 : res );
+}
+
/* ---------------------------------------------------------------------
printf implementation. The key function, vg_vprintf(), emits chars
@@ -953,6 +959,14 @@
return res;
}
+Int VG_(stat) ( Char* file_name, struct vki_stat* buf )
+{
+ Int res;
+ res = vg_do_syscall2(__NR_stat, (UInt)file_name, (UInt)buf);
+ return
+ VG_(is_kerror)(res) ? (-1) : 0;
+}
+
/* Misc functions looking for a proper home. */
/* We do getenv without libc's help by snooping around in