Page MenuHomeWildfire Games

[BSD] FreeBSD does not have MAP_NORESERVE
ClosedPublic

Authored by madpilot on Jul 5 2018, 5:52 PM.

Details

Summary

As from subject, I added conditionals to remove that flag when compiling in FreeBSD.

As far as I know FreeBSD is always working in overcommit mode, so the flag is implicitly always active.

Test Plan

Tested in FreeBSD.

Similar patch without conditionals, only removing the MAP_NORESERVE flag committed to the FreeBSD ports tree.

Diff Detail

Repository
rP 0 A.D. Public Repository
Branch
/ps/trunk
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 6278
Build 10419: Vulcan BuildJenkins
Build 10418: arc lint + arc unit

Event Timeline

madpilot created this revision.Jul 5 2018, 5:52 PM
Vulcan added a subscriber: Vulcan.Jul 5 2018, 5:58 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/674/display/redirect

Stan added a subscriber: Stan.Dec 4 2020, 9:36 AM

Could be done in source/lib/posix/posix_mman.h maybe. Would save some conditionnals.


#ifndef INCLUDED_POSIX_MMAN
#define INCLUDED_POSIX_MMAN

#if OS_WIN
# include "lib/sysdep/os/win/wposix/wmman.h"
#else
# include <sys/mman.h>
#if defined(__FreeBSD__)
    // FreeBSD doesn't have MAP_NORESERVE.
    // It is always working in overcommit mode
    // so the flag is implicitly always active.
    #define MAP_NORESERVE 0x00 
#endif
#endif

#include "lib/posix/posix_errno.h"	// for user convenience

#endif	// #ifndef INCLUDED_POSIX_MMAN
Stan retitled this revision from FreeBSD does not have MAP_NORESERVE to [BSD] FreeBSD does not have MAP_NORESERVE.Dec 4 2020, 9:37 AM

@Stan Your patch looks alright, but this flag seems to refer to reserving swap space, not memory overcommit (which linux also does per default afaik)

@Stan Your patch looks alright, but this flag seems to refer to reserving swap space, not memory overcommit (which linux also does per default afaik)

Yes, the description I used is wrong, anyway the flag is absent in FreeBSD.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 5 2021, 8:07 PM
This revision was automatically updated to reflect the committed changes.