summaryrefslogtreecommitdiff
path: root/exec
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2010-09-14 04:15:17 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2010-09-14 04:15:17 +0200
commitd3a93bfdd33107dea491ffdf5e55b34eebae475a (patch)
tree5b4378f2f28a4629714b359a91cb34032c518d1c /exec
parent5d2cf1ea07ecd65f4c276e5b3cbd9e062d9361cf (diff)
Fix in-memory mapping
* exec/exec.c (map): When e->file_data is not NULL, return it plus `posn'. (prepare_in_memory): Call prepare_stream to clear stream positions.
Diffstat (limited to 'exec')
-rw-r--r--exec/exec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/exec/exec.c b/exec/exec.c
index 272b7899..9273a4cb 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -443,7 +443,9 @@ map (struct execdata *e, off_t posn, size_t len)
else if (posn + len > size)
/* The requested data wouldn't fit in the file. */
return NULL;
- else if (e->filemap == MACH_PORT_NULL)
+ else if (e->file_data != NULL) {
+ return e->file_data + posn;
+ } else if (e->filemap == MACH_PORT_NULL)
{
/* No mapping for the file. Read the data by RPC. */
char *buffer = map_buffer (e);
@@ -519,7 +521,10 @@ prepare_stream (struct execdata *e)
e->map_filepos = 0;
}
-static void prepare_in_memory (struct execdata *e) {}
+static void prepare_in_memory (struct execdata *e)
+{
+ prepare_stream(e);
+}
#else