1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "mozilla/ipc/SharedMemory.h"
14 void SharedMemory::SystemProtect(char* aAddr
, size_t aSize
, int aRights
) {
15 if (!SystemProtectFallible(aAddr
, aSize
, aRights
)) {
16 MOZ_CRASH("can't VirtualProtect()");
20 bool SharedMemory::SystemProtectFallible(char* aAddr
, size_t aSize
,
23 if ((aRights
& RightsRead
) && (aRights
& RightsWrite
))
24 flags
= PAGE_READWRITE
;
25 else if (aRights
& RightsRead
)
26 flags
= PAGE_READONLY
;
28 flags
= PAGE_NOACCESS
;
31 return VirtualProtect(aAddr
, aSize
, flags
, &oldflags
);
34 size_t SharedMemory::SystemPageSize() {
41 } // namespace mozilla