diff options
author | Roland McGrath <roland@gnu.org> | 2002-05-10 21:53:44 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-05-10 21:53:44 +0000 |
commit | f469487500d3027bceed1008b4621bf6f0dd2ecc (patch) | |
tree | 785ead2ef2ee8f2c360cfebd69945b880581e3e0 /exec | |
parent | 9f78f6fbce0ad222d472f39f5e15360e8ede4e6e (diff) |
2002-05-10 Roland McGrath <roland@frob.com>
* exec.c (prepare): Do io_stat when io_map fails as for when
io_map_cntl fails.
Diffstat (limited to 'exec')
-rw-r--r-- | exec/exec.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/exec/exec.c b/exec/exec.c index 395b85dc..380fb4cd 100644 --- a/exec/exec.c +++ b/exec/exec.c @@ -740,17 +740,7 @@ prepare (file_t file, struct execdata *e) e->filemap = rd; e->error = /* io_map_cntl (file, &e->cntlmap) */ EOPNOTSUPP; /* XXX */ - if (e->error) - { - /* No shared page. Do a stat to find the file size. */ - struct stat st; - e->error = io_stat (file, &st); - if (e->error) - return; - e->file_size = st.st_size; - e->optimal_block = st.st_blksize; - } - else + if (!e->error) e->error = vm_map (mach_task_self (), (vm_address_t *) &e->cntl, vm_page_size, 0, 1, e->cntlmap, 0, 0, VM_PROT_READ|VM_PROT_WRITE, @@ -792,6 +782,17 @@ prepare (file_t file, struct execdata *e) /* We can't mmap FILE, but perhaps we can do normal I/O to it. */ e->error = 0; + if (!e->error && !e->cntl) + { + /* No shared page. Do a stat to find the file size. */ + struct stat st; + e->error = io_stat (file, &st); + if (e->error) + return; + e->file_size = st.st_size; + e->optimal_block = st.st_blksize; + } + /* Initialize E's stdio stream. */ prepare_stream (e); } |