From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- ipc/chromium/src/base/linux_memfd_defs.h | 69 ++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 ipc/chromium/src/base/linux_memfd_defs.h (limited to 'ipc/chromium/src/base/linux_memfd_defs.h') diff --git a/ipc/chromium/src/base/linux_memfd_defs.h b/ipc/chromium/src/base/linux_memfd_defs.h new file mode 100644 index 0000000000..f5b0de1de8 --- /dev/null +++ b/ipc/chromium/src/base/linux_memfd_defs.h @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#ifndef BASE_LINUX_MEMFD_DEFS_H +#define BASE_LINUX_MEMFD_DEFS_H + +#include + +// glibc before 2.27 didn't have a memfd_create wrapper, and if the +// build system is old enough then it won't have the syscall number +// and various related constants either. + +#if defined(__x86_64__) +# define MEMFD_CREATE_NR 319 +#elif defined(__i386__) +# define MEMFD_CREATE_NR 356 +#elif defined(__aarch64__) +# define MEMFD_CREATE_NR 279 +#elif defined(__arm__) +# define MEMFD_CREATE_NR 385 +#elif defined(__powerpc__) +# define MEMFD_CREATE_NR 360 +#elif defined(__s390__) +# define MEMFD_CREATE_NR 350 +#elif defined(__mips__) +# include +# if _MIPS_SIM == _MIPS_SIM_ABI32 +# define MEMFD_CREATE_NR 4354 +# elif _MIPS_SIM == _MIPS_SIM_ABI64 +# define MEMFD_CREATE_NR 5314 +# elif _MIPS_SIM == _MIPS_SIM_NABI32 +# define MEMFD_CREATE_NR 6318 +# endif // mips subarch +#endif // arch + +#ifdef MEMFD_CREATE_NR +# ifdef SYS_memfd_create +static_assert(MEMFD_CREATE_NR == SYS_memfd_create, + "MEMFD_CREATE_NR should match the actual SYS_memfd_create value"); +# else // defined here but not in system headers +# define SYS_memfd_create MEMFD_CREATE_NR +# endif +#endif + +#ifndef MFD_CLOEXEC +# define MFD_CLOEXEC 0x0001U +# define MFD_ALLOW_SEALING 0x0002U +#endif + +#ifndef F_ADD_SEALS +# ifndef F_LINUX_SPECIFIC_BASE +# define F_LINUX_SPECIFIC_BASE 1024 +# endif +# define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9) +# define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10) +# define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */ +# define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */ +# define F_SEAL_GROW 0x0004 /* prevent file from growing */ +# define F_SEAL_WRITE 0x0008 /* prevent writes */ +#endif + +#ifndef F_SEAL_FUTURE_WRITE +# define F_SEAL_FUTURE_WRITE 0x0010 +#endif + +#endif // BASE_LINUX_MEMFD_DEFS_H -- cgit v1.2.3