mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
filesystem: add flag to open files in a RAM
On Linux, it uses memfd_create syscall that can be found on Linux 3.17 and higher. By default memfds are executable, so we set MFD_NOEXEC_SEAL flag to prevent execution at creation time.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
MEMFD_CREATE_TEST = '''#define _GNU_SOURCE
|
||||
#include <sys/mman.h>
|
||||
int main(int argc, char **argv) { return memfd_create(argv[0], 0); }'''
|
||||
|
||||
def options(opt):
|
||||
pass
|
||||
|
||||
@@ -11,6 +15,9 @@ def configure(conf):
|
||||
elif conf.env.cxxshlib_PATTERN.startswith('lib'): # remove lib prefix for other systems than Android
|
||||
conf.env.cxxshlib_PATTERN = conf.env.cxxshlib_PATTERN[3:]
|
||||
|
||||
if conf.check_cc(fragment=MEMFD_CREATE_TEST, msg='Checking for memfd_create', mandatory=False):
|
||||
conf.define('HAVE_MEMFD_CREATE', 1)
|
||||
|
||||
def build(bld):
|
||||
bld(name = 'filesystem_includes', export_includes = '.')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user