Skip to content

Conversation

paveljanik
Copy link
Contributor

Two minor fixes after merging #8753.

@@ -224,6 +224,13 @@ PosixLockedPageAllocator::PosixLockedPageAllocator()
page_size = sysconf(_SC_PAGESIZE);
#endif
}

// Some systems (at least OS X) do not define MAP_ANONYMOUS yet and define
// MAP_ANON which is deprecated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@jonasschnelli
Copy link
Contributor

utACK

FreeBSD manpage

 MAP_ANON           Map anonymous memory not associated with any specific
                    file.  The file descriptor used for creating MAP_ANON
                    must be -1.  The offset argument must be 0.

 MAP_ANONYMOUS      This flag is identical to MAP_ANON and is provided for
                    compatibility.

Linux manpage

MAP_ANONYMOUS
    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. 
MAP_ANON
    Alias for MAP_ANONYMOUS. Deprecated. 

OSX 10.11 manpage

     MAP_ANONYMOUS     Synonym for MAP_ANON.

     MAP_ANON          Map anonymous memory not associated with any specific file.  The offset argument is ignored.  Mac OS X spe-
                       cific: the file descriptor used for creating MAP_ANON regions can be used to pass some Mach VM flags, and can
                       be specified as -1 if no such flags are associated with the region.  Mach VM flags are defined in
                       <mach/vm_statistics.h> and the ones that currently apply to mmap are:

@laanwj
Copy link
Member

laanwj commented Nov 2, 2016

So apparently all three OSes support MAP_ANONYMOUS? What am I missing?

@paveljanik
Copy link
Contributor Author

My build machine is 10.10.

@jonasschnelli
Copy link
Contributor

@paveljanik what does you 10.10s man mmap tells you about MAP_ANONYMOUS?
IMO travis compiles against 10.9... hmm..

@paveljanik
Copy link
Contributor Author

@jonasschnelli Nothing... man mmap | grep ANON:

     MAP_ANON          Map anonymous memory not associated with any specific
                       cific: the file descriptor used for creating MAP_ANON
     [ENODEV]           MAP_ANON has not been specified and the file fd refers
                        the process.  MAP_ANON was specified and insufficient

@laanwj
Copy link
Member

laanwj commented Nov 2, 2016

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.

@paveljanik
Copy link
Contributor Author

Interesting:

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

but

/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/sys/mman.h:#define MAP_ANONYMOUS   MAP_ANON
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/share/man/man2/mmap.2:.It Dv MAP_ANONYMOUS
/Applications/Xcode.app//Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/sys/mman.h:#define    MAP_ANONYMOUS   MAP_ANON
/Applications/Xcode.app//Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS2.1.sdk/usr/include/sys/mman.h:#define MAP_ANONYMOUS   MAP_ANON

@paveljanik
Copy link
Contributor Author

We are not alone: https://gmtk-trac.bitnamiapp.com/trac/gmtk/ticket/371 and others...

@laanwj laanwj merged commit 4a9f3c5 into bitcoin:master Nov 2, 2016
laanwj added a commit that referenced this pull request Nov 2, 2016
…NONYMOUS is not defined

4a9f3c5 Do not shadow variable, use deprecated MAP_ANON if MAP_ANONYMOUS is not defined. (Pavel Janík)
codablock pushed a commit to codablock/dash that referenced this pull request Jan 13, 2018
…f MAP_ANONYMOUS is not defined

4a9f3c5 Do not shadow variable, use deprecated MAP_ANON if MAP_ANONYMOUS is not defined. (Pavel Janík)
andvgal pushed a commit to energicryptocurrency/gen2-energi that referenced this pull request Jan 6, 2019
…f MAP_ANONYMOUS is not defined

4a9f3c5 Do not shadow variable, use deprecated MAP_ANON if MAP_ANONYMOUS is not defined. (Pavel Janík)
CryptoCentric pushed a commit to absolute-community/absolute that referenced this pull request Feb 15, 2019
…f MAP_ANONYMOUS is not defined

4a9f3c5 Do not shadow variable, use deprecated MAP_ANON if MAP_ANONYMOUS is not defined. (Pavel Janík)
zkbot added a commit to zcash/zcash that referenced this pull request Sep 29, 2020
Locked memory manager

Add a pool for locked memory chunks, replacing `LockedPageManager`.

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#8321
- bitcoin/bitcoin#8753
- bitcoin/bitcoin#9063
- bitcoin/bitcoin#9070
- bitcoin/bitcoin#11385
- bitcoin/bitcoin#12048
  - Excludes change to benchmark.
- bitcoin/bitcoin#15117
- bitcoin/bitcoin#16161
  - Excludes Travis CI changes.
  - Includes change from bitcoin/bitcoin#13163
- bitcoin/bitcoin#15600
- bitcoin/bitcoin#18443
- Assorted small changes from:
  - bitcoin/bitcoin#9233
  - bitcoin/bitcoin#10483
  - bitcoin/bitcoin#10645
  - bitcoin/bitcoin#10969
  - bitcoin/bitcoin#11351
- bitcoin/bitcoin#19111
  - Excludes change to `src/rpc/server.cpp`
- bitcoin/bitcoin#9804
  - Only the commit for `src/key.cpp`
- bitcoin/bitcoin#9598
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants