|
From: <sv...@va...> - 2005-06-19 15:46:29
|
Author: njn
Date: 2005-06-19 16:46:27 +0100 (Sun, 19 Jun 2005)
New Revision: 3948
Log:
Don't #include <sys/stat.h>, which was causing problems due to
it redefining certain names which clashed with field names in vki*.h.
There are plenty more glibc-isms that can be removed from m_main.c.
Modified:
trunk/coregrind/m_main.c
Modified: trunk/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_main.c 2005-06-19 15:34:59 UTC (rev 3947)
+++ trunk/coregrind/m_main.c 2005-06-19 15:46:27 UTC (rev 3948)
@@ -64,7 +64,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
-#include <sys/stat.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -419,21 +418,21 @@
{
# define FLEN 512
Int fd, n;
- struct stat s1;
+ struct vki_stat s1;
char* f_clo =3D NULL;
char filename[FLEN];
=20
snprintf(filename, FLEN, "%s/.valgrindrc", ( NULL =3D=3D dir ? "" : d=
ir ) );
fd =3D VG_(open)(filename, 0, VKI_S_IRUSR);
if ( fd > 0 ) {
- if ( 0 =3D=3D fstat(fd, &s1) ) {
+ if ( 0 =3D=3D VG_(fstat)(fd, &s1) ) {
f_clo =3D malloc(s1.st_size+1);
vg_assert(f_clo);
- n =3D read(fd, f_clo, s1.st_size);
+ n =3D VG_(read)(fd, f_clo, s1.st_size);
if (n =3D=3D -1) n =3D 0;
f_clo[n] =3D '\0';
}
- close(fd);
+ VG_(close)(fd);
}
return f_clo;
# undef FLEN
@@ -1293,9 +1292,9 @@
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
=20
typedef struct {
- char* killpad_start;
- char* killpad_end;
- struct stat* killpad_padstat;
+ char* killpad_start;
+ char* killpad_end;
+ struct vki_stat* killpad_padstat;
} killpad_extra;
=20
static int killpad(char *segstart, char *segend, const char *perm, off_t=
off,=20
@@ -1333,13 +1332,13 @@
// Remove padding of 'padfile' from a range of address space.
static void as_unpad(void *start, void *end, int padfile)
{
- static struct stat padstat;
+ static struct vki_stat padstat;
killpad_extra extra;
int res;
=20
vg_assert(padfile >=3D 0);
=20
- res =3D fstat(padfile, &padstat);
+ res =3D VG_(fstat)(padfile, &padstat);
vg_assert(0 =3D=3D res);
extra.killpad_padstat =3D &padstat;
extra.killpad_start =3D start;
|