|
From: <sv...@va...> - 2005-09-13 18:22:16
|
Author: sewardj
Date: 2005-09-13 19:22:01 +0100 (Tue, 13 Sep 2005)
New Revision: 4643
Log:
Reinstate fd->(dev,ino) resolution. This facilitates reinstating
segment preening.
Modified:
branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c
Modified: branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.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
--- branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-13 18:08:0=
5 UTC (rev 4642)
+++ branches/ASPACEM/coregrind/m_aspacemgr/aspacemgr.c 2005-09-13 18:22:0=
1 UTC (rev 4643)
@@ -1499,27 +1499,38 @@
return res;
}
=20
-static
-SysRes do_munmap_NO_NOTIFY(Addr start, SizeT length)
+static SysRes do_munmap_NO_NOTIFY(Addr start, SizeT length)
{
return VG_(do_syscall2)(__NR_munmap, (UWord)start, length );
}
=20
-static
-Int aspacem_readlink(HChar* path, HChar* buf, UInt bufsiz)
+static Int aspacem_readlink(HChar* path, HChar* buf, UInt bufsiz)
{
SysRes res;
res =3D VG_(do_syscall3)(__NR_readlink, (UWord)path, (UWord)buf, bufs=
iz);
return res.isError ? -1 : res.val;
}
=20
+static Int aspacem_fstat( Int fd, struct vki_stat* buf )
+{
+ SysRes res =3D VG_(do_syscall2)(__NR_fstat, fd, (UWord)buf);
+ return res.isError ? (-1) : 0;
+}
=20
+
//--------------------------------------------------------------
// Functions for extracting information about file descriptors.
=20
static=20
Bool get_inode_for_fd ( Int fd, /*OUT*/UInt* dev, /*OUT*/UInt* ino )
{
+ struct vki_stat buf;
+ Int r =3D aspacem_fstat(fd, &buf);
+ if (r =3D=3D 0) {
+ *dev =3D buf.st_dev;
+ *ino =3D buf.st_ino;
+ return True;
+ }
return False;
}
=20
@@ -2022,6 +2033,14 @@
aspacem_assert(sizeof(SizeT) =3D=3D sizeof(void*));
aspacem_assert(sizeof(SSizeT) =3D=3D sizeof(void*));
=20
+ {=20
+ /* If these fail, we'd better change the type of dev and ino in
+ NSegment accordingly. */
+ struct vki_stat buf;
+ aspacem_assert(sizeof(buf.st_dev) =3D=3D sizeof(UInt));
+ aspacem_assert(sizeof(buf.st_ino) =3D=3D sizeof(UInt));
+ }
+
/* Add a single interval covering the entire address space. */
init_nsegment(&seg);
seg.kind =3D SkFree;
|