Discussion:
vma-iter: Improvements for BSD platforms
(too old to reply)
Bruno Haible
2017-09-26 00:48:25 UTC
Permalink
Raw Message
I'm improving the support of BSD platforms in the 'vma-iter' module
(used by GNU clisp).

2017-09-25 Bruno Haible <***@clisp.org>

vma-iter: Improvements for BSD platforms.
- Add support for GNU/kFreeBSD.
- Make it work on FreeBSD and NetBSD even when /proc is not mounted.
- Speed up on OpenBSD.
* lib/vma-iter.c (struct rofile, rof*): Define also on GNU/kFreeBSD.
(vma_iterate_bsd): New function.
(vma_iterate): Use it as fallback on FreeBSD and NetBSD. Use it as
first choice on OpenBSD. Treat GNU/kFreeBSD like Linux.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on GNU/kFreeBSD.
* modules/vma-iter (configure.ac): Require AC_C_INLINE.
Bruno Haible
2017-09-26 23:52:39 UTC
Permalink
Raw Message
I pushed two more improvements of this module:

2017-09-26 Bruno Haible <***@clisp.org>

vma-iter: Improvements for Linux and BSD platforms.
- Add support for DragonFly BSD.
- Make it more reliable on Linux, GNU/kFreeBSD, FreeBSD, NetBSD.
* lib/vma-iter.c (struct rofile, rof_open, rof_peekchar, rof_close):
Read the entire file into memory in a single system call.
(vma_iterate): Update. Read from /proc on DragonFly BSD like on FreeBSD.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on DragonFly BSD.

2017-09-26 Bruno Haible <***@clisp.org>

vma-iter: Provide the protection flags on FreeBSD.
* lib/vma-iter.c (vma_iterate) [FreeBSD]: When reading from /proc,
skip three fields between the addresses and the protection flags.
Bruno Haible
2017-10-01 20:37:34 UTC
Permalink
Raw Message
One more improvement of this module:

2017-10-01 Bruno Haible <***@clisp.org>

vma-iter: Add support for GNU/Hurd.
* lib/vma-iter.c: Treat GNU/Hurd like Linux.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on GNU/kFreeBSD.
Bruno Haible
2017-10-07 11:03:42 UTC
Permalink
Raw Message
Post by Bruno Haible
vma-iter: Add support for GNU/Hurd.
* lib/vma-iter.c: Treat GNU/Hurd like Linux.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on GNU/kFreeBSD.
but this implementation does not show the VMAs from anonymous mmap. Sigh.
This fixes it.


2017-10-07 Bruno Haible <***@clisp.org>

vma-iter: Improve support for GNU/Hurd.
* lib/vma-iter.c (vma_iterate): On GNU/Hurd, use the Mach vm_region()
API, not the /proc file system.
Bruno Haible
2017-10-08 15:53:07 UTC
Permalink
Raw Message
Post by Bruno Haible
but this implementation does not show the VMAs from anonymous mmap. Sigh.
This fixes it.
The same problem exists on FreeBSD: the /proc file system does not show the
VMAs from anonymous mmap. This fixes it: Use sysctl in the first place.


2017-10-08 Bruno Haible <***@clisp.org>

vma-iter: Improve support for FreeBSD.
* lib/vma-iter.c (vma_iterate_proc): New function, extracted from
vma_iterate.
(vma_iterate): Use it. For FreeBSD, try vma_iterate_bsd first.

Bruno Haible
2017-10-07 12:10:02 UTC
Permalink
Raw Message
Post by Bruno Haible
vma-iter: Improvements for Linux and BSD platforms.
- Add support for DragonFly BSD.
- Make it more reliable on Linux, GNU/kFreeBSD, FreeBSD, NetBSD.
Read the entire file into memory in a single system call.
(vma_iterate): Update. Read from /proc on DragonFly BSD like on FreeBSD.
* lib/vma-iter.h (VMA_ITERATE_SUPPORTED): Define also on DragonFly BSD.
But on Linux (and not on the BSD systems), this has the effect that
vma_iterate() produces a truncated list of VMAs. This fixes it.


2017-10-07 Bruno Haible <***@clisp.org>

vma-iter: Fix truncated result on Linux (regression from 2017-09-26).
* lib/vma-iter.c (MIN_LEFTOVER): New macro.
(STACK_ALLOCATED_BUFFER_SIZE): Set to a minimal value if not needed.
(rof_open): On Linux, do multiple read() calls and make sure
MIN_LEFTOVER bytes are left when read() returns.
Loading...