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

vicuna opened this Issue Sep 15, 2005 · 1 comment


None yet
2 participants
Copy link

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


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

Best regards,

Christoph Bauer
Dipl. Inf.

LMS Deutschland GmbH
Luxemburgerstr. 7
D-67657 Kaiserslautern

T +49 631 303 22 152

< #include "memory.h"
< long currpos, file_size, map_size;

long currpos, file_size;
< map_size = file_size - currpos;
< if ((unsigned long) map_size % array_size != 0)

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

< 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;

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

if (file_size < array_size) {

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

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


This comment has been minimized.

Copy link
Collaborator Author

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
You can’t perform that action at this time.