Do not shadow variable, use deprecated MAP_ANON if MAP_ANONYMOUS is not defined #9063

pull paveljanik wants to merge 1 commits into bitcoin:master from paveljanik:20161102_fix_lockedpool changing 1 files +10 −3
  1. paveljanik commented at 1:19 pm on November 2, 2016: contributor
    Two minor fixes after merging #8753.
  2. Do not shadow variable, use deprecated MAP_ANON if MAP_ANONYMOUS is not defined. 4a9f3c50cc
  3. in src/support/lockedpool.cpp: in 4a9f3c50cc
    223@@ -224,6 +224,13 @@ PosixLockedPageAllocator::PosixLockedPageAllocator()
    224     page_size = sysconf(_SC_PAGESIZE);
    225 #endif
    226 }
    227+
    228+// Some systems (at least OS X) do not define MAP_ANONYMOUS yet and define
    229+// MAP_ANON which is deprecated
    


    laanwj commented at 1:21 pm on November 2, 2016:

    If MAP_ANON is deprecated, what is the new name?

    Also: this passed Travis, how is that possible if it didn’t exist on MacOSX?

  4. jonasschnelli commented at 1:23 pm on November 2, 2016: contributor

    utACK

    FreeBSD manpage

    0 MAP_ANON           Map anonymous memory not associated with any specific
    1                    file.  The file descriptor used for creating MAP_ANON
    2                    must be -1.  The offset argument must be 0.
    3
    4 MAP_ANONYMOUS      This flag is identical to MAP_ANON and is provided for
    5                    compatibility.
    

    Linux manpage

    0MAP_ANONYMOUS
    1    The mapping is not backed by any file; the fd and offset arguments are ignored. This flag in conjunction with MAP_SHARED is implemented since Linux 2.4. 
    2MAP_ANON
    3    Alias for MAP_ANONYMOUS. Deprecated. 
    

    OSX 10.11 manpage

    0     MAP_ANONYMOUS     Synonym for MAP_ANON.
    1
    2     MAP_ANON          Map anonymous memory not associated with any specific file.  The offset argument is ignored.  Mac OS X spe-
    3                       cific: the file descriptor used for creating MAP_ANON regions can be used to pass some Mach VM flags, and can
    4                       be specified as -1 if no such flags are associated with the region.  Mach VM flags are defined in
    5                       <mach/vm_statistics.h> and the ones that currently apply to mmap are:
    
  5. laanwj commented at 1:24 pm on November 2, 2016: member
    So apparently all three OSes support MAP_ANONYMOUS? What am I missing?
  6. paveljanik commented at 1:25 pm on November 2, 2016: contributor
    My build machine is 10.10.
  7. jonasschnelli commented at 1:27 pm on November 2, 2016: contributor
    @paveljanik what does you 10.10s man mmap tells you about MAP_ANONYMOUS? IMO travis compiles against 10.9… hmm..
  8. paveljanik commented at 1:28 pm on November 2, 2016: contributor

    @jonasschnelli Nothing… man mmap | grep ANON:

    0     MAP_ANON          Map anonymous memory not associated with any specific
    1                       cific: the file descriptor used for creating MAP_ANON
    2     [ENODEV]           MAP_ANON has not been specified and the file fd refers
    3                        the process.  MAP_ANON was specified and insufficient
    
  9. laanwj commented at 1:30 pm on November 2, 2016: member
    That’s really strange. I really don’t understand MacOSX’ deprecation policy, from release to release it seems to oscillate wildly. In any case utACK.
  10. paveljanik commented at 1:38 pm on November 2, 2016: contributor

    Interesting:

    0$ grep ANON /usr/include/sys/mman.h
    1#define MAP_ANON    0x1000  /* allocated from memory, swap space */
    2$ 
    

    but

    0/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/mman.h:#define MAP_ANONYMOUS   MAP_ANON
    1/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/share/man/man2/mmap.2:.It Dv MAP_ANONYMOUS
    2/Applications/Xcode.app//Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/sys/mman.h:#define    MAP_ANONYMOUS   MAP_ANON
    3/Applications/Xcode.app//Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS2.1.sdk/usr/include/sys/mman.h:#define MAP_ANONYMOUS   MAP_ANON
    
  11. paveljanik commented at 1:40 pm on November 2, 2016: contributor
  12. laanwj merged this on Nov 2, 2016
  13. laanwj closed this on Nov 2, 2016

  14. laanwj referenced this in commit f2a6e8243f on Nov 2, 2016
  15. codablock referenced this in commit 0b4caeeb3d on Sep 19, 2017
  16. codablock referenced this in commit 85c5aea08b on Jan 13, 2018
  17. andvgal referenced this in commit 5ea5aa793c on Jan 6, 2019
  18. CryptoCentric referenced this in commit 3fc4bc129c on Feb 15, 2019
  19. zkbot referenced this in commit 5ef5d8d268 on Jul 31, 2020
  20. zkbot referenced this in commit 7d94064616 on Sep 29, 2020
  21. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me