740 |
e->filemap = rd; |
e->filemap = rd; |
741 |
|
|
742 |
e->error = /* io_map_cntl (file, &e->cntlmap) */ EOPNOTSUPP; /* XXX */ |
e->error = /* io_map_cntl (file, &e->cntlmap) */ EOPNOTSUPP; /* XXX */ |
743 |
if (e->error) |
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 |
|
744 |
e->error = vm_map (mach_task_self (), (vm_address_t *) &e->cntl, |
e->error = vm_map (mach_task_self (), (vm_address_t *) &e->cntl, |
745 |
vm_page_size, 0, 1, e->cntlmap, 0, 0, |
vm_page_size, 0, 1, e->cntlmap, 0, 0, |
746 |
VM_PROT_READ|VM_PROT_WRITE, |
VM_PROT_READ|VM_PROT_WRITE, |
782 |
/* We can't mmap FILE, but perhaps we can do normal I/O to it. */ |
/* We can't mmap FILE, but perhaps we can do normal I/O to it. */ |
783 |
e->error = 0; |
e->error = 0; |
784 |
|
|
785 |
|
if (!e->error && !e->cntl) |
786 |
|
{ |
787 |
|
/* No shared page. Do a stat to find the file size. */ |
788 |
|
struct stat st; |
789 |
|
e->error = io_stat (file, &st); |
790 |
|
if (e->error) |
791 |
|
return; |
792 |
|
e->file_size = st.st_size; |
793 |
|
e->optimal_block = st.st_blksize; |
794 |
|
} |
795 |
|
|
796 |
/* Initialize E's stdio stream. */ |
/* Initialize E's stdio stream. */ |
797 |
prepare_stream (e); |
prepare_stream (e); |
798 |
} |
} |