comparison nspr/pr/src/md/prosdep.c @ 0:1e5118fa0cb1

This is NSS with a Cmake Buildsyste To compile a static NSS library for Windows we've used the Chromium-NSS fork and added a Cmake buildsystem to compile it statically for Windows. See README.chromium for chromium changes and README.trustbridge for our modifications.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 28 Jul 2014 10:47:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e5118fa0cb1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "prbit.h"
7 #include "prsystem.h"
8
9 #ifdef XP_UNIX
10 #include <unistd.h>
11 #endif
12 #ifdef _WIN32
13 #include <windows.h>
14 #endif
15 #ifdef XP_BEOS
16 #include <OS.h>
17 #endif
18
19 PRInt32 _pr_pageShift;
20 PRInt32 _pr_pageSize;
21
22 /*
23 ** Get system page size
24 */
25 static void GetPageSize(void)
26 {
27 PRInt32 pageSize;
28
29 /* Get page size */
30 #ifdef XP_UNIX
31 #if defined BSDI || defined AIX \
32 || defined LINUX || defined __GNU__ || defined __GLIBC__ \
33 || defined FREEBSD || defined NETBSD || defined OPENBSD \
34 || defined DARWIN || defined SYMBIAN
35 _pr_pageSize = getpagesize();
36 #elif defined(HPUX)
37 /* I have no idea. Don't get me started. --Rob */
38 _pr_pageSize = sysconf(_SC_PAGE_SIZE);
39 #else
40 _pr_pageSize = sysconf(_SC_PAGESIZE);
41 #endif
42 #endif /* XP_UNIX */
43
44 #ifdef XP_BEOS
45 _pr_pageSize = B_PAGE_SIZE;
46 #endif
47
48 #ifdef XP_PC
49 #ifdef _WIN32
50 SYSTEM_INFO info;
51 GetSystemInfo(&info);
52 _pr_pageSize = info.dwPageSize;
53 #else
54 _pr_pageSize = 4096;
55 #endif
56 #endif /* XP_PC */
57
58 pageSize = _pr_pageSize;
59 PR_CEILING_LOG2(_pr_pageShift, pageSize);
60 }
61
62 PR_IMPLEMENT(PRInt32) PR_GetPageShift(void)
63 {
64 if (!_pr_pageSize) {
65 GetPageSize();
66 }
67 return _pr_pageShift;
68 }
69
70 PR_IMPLEMENT(PRInt32) PR_GetPageSize(void)
71 {
72 if (!_pr_pageSize) {
73 GetPageSize();
74 }
75 return _pr_pageSize;
76 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)