Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug #3790 - patch #3791

Closed
vicuna opened this issue Sep 15, 2005 · 1 comment
Closed

Bug #3790 - patch #3791

vicuna opened this issue Sep 15, 2005 · 1 comment
Assignees

Comments

@vicuna
Copy link

vicuna commented Sep 15, 2005

Original bug ID: 3791
Reporter: administrator
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2007-02-21T15:19:36Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 3.10+dev
Category: ~DO NOT USE (was: OCaml general)
Child of: #3790

Bug description

Hi,

attached is a patch (against ocaml-3.08.3/otherlibs/bigarray/mmap_unix.c)
for the offset problem. It uses currpos of the file descriptor as
offset in mmap. But maybe it would be better to make a new function like
"bigarray_map_file_with_offset".

Best regards,

Christoph Bauer
Dipl. Inf.

LMS Deutschland GmbH
Luxemburgerstr. 7
D-67657 Kaiserslautern

T +49 631 303 22 152

mailto:Christoph.Bauer@lms-gmbh.de
http://www.lmsintl.com


22d21
< #include "memory.h"
47c46
< long currpos, file_size, map_size;

long currpos, file_size;
76,77d74
< map_size = file_size - currpos;
<
81c78
< if ((unsigned long) map_size % array_size != 0)


if ((unsigned long) file_size % array_size != 0)

83,84c80,81
< dim[major_dim] = (unsigned long) map_size / array_size;
< array_size = map_size;

dim[major_dim] = (unsigned long) file_size / array_size;
array_size = file_size;

87c84
< if (map_size < 0 || map_size < array_size) {

if (file_size < array_size) {

97c94
< addr = mmap(NULL, array_size, PROT_READ | PROT_WRITE, shared, fd, currpos);

addr = mmap(NULL, array_size, PROT_READ | PROT_WRITE, shared, fd, 0);
103,107d99
< CAMLprim value ml_get_page_size( value unit ) {
< CAMLparam1( unit );
< CAMLreturn ( Val_int( getpagesize() ) );
< }
<



@vicuna
Copy link
Author

vicuna commented Jun 10, 2006

Comment author: @xavierleroy

See #4024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants