mmap fails when compiled for 32bit
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- operating-systems
Research direction
Start by tracing the Haskell FFI call to mmap and the C interface described in the issue, then inspect the cbits boundary for how file offsets are passed on 32-bit builds. Confirm the existing behavior with a 32-bit compilation and make the call use the large-file-support path; done means mmap works correctly on 32-bit platforms.
Written by the indexing model from the issue text.
Description
https://users.suse.com/~aj/linux_lfs.html
#ifndef __USE_FILE_OFFSET64
extern void *mmap (void *__addr, size_t __len, int __prot,
int __flags, int __fd, __off_t __offset) __THROW;
#else
# ifdef __REDIRECT_NTH
extern void * __REDIRECT_NTH (mmap,
(void *__addr, size_t __len, int __prot,
int __flags, int __fd, __off64_t __offset),
mmap64);
# else
# define mmap mmap64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern void *mmap64 (void *__addr, size_t __len, int __prot,
int __flags, int __fd, __off64_t __offset) __THROW;
#endif
on 32bit platforms, behind the scenes, the type of off_t changes depending on how a program is compiled
glibc then uses a macro to map mmap to either the real mmap or the mmap64 version, based on the size of off_t
haskell base was compiled with large-file-support, so COff is 64bits, but then the ffi grabs the raw mmap symbol, the 32bit version
the simplest solution is to use cbits and Word64 to get the values into c code, then (with LFS enabled), call mmap from c, and let the macro do its job
- Dominant language
- Haskell
- Stars
- 9
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
halogenandtoast/ArkhamHorror#5825 · 1 comment ·
-
docs: install-manifest download links use main instead of master (404)Possibly taken @ChinmayaBisoi claimed this 1 day ago. Open
Difficulty 2/5 Under an hour Newbie friendliness 78/100
hasura/graphql-engine#10884 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AccelerateHS/accelerate#583 · 2 comments ·
-
component: hls-refactor-plugin status: needs triage type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 60/100
haskell/haskell-language-server#5111 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
alunduil/network-arbitrary#193 ·
Maintainers usually reply within 1 day