Fossil SCM

POSIX enhancements for fossil_get_page_size().

mistachkin 2018-03-17 21:16 UTC withMman
Commit fd1bee7279b959c847abb37d55267c0013df18c0d841f9d112b1938251a0e3f6
1 file changed +3
+3
--- src/util.c
+++ src/util.c
@@ -19,10 +19,11 @@
1919
*/
2020
#include "config.h"
2121
#include "util.h"
2222
#if defined(USE_MMAN_H)
2323
# include <sys/mman.h>
24
+# include <unistd.h>
2425
#endif
2526
2627
/*
2728
** For the fossil_timer_xxx() family of functions...
2829
*/
@@ -75,10 +76,12 @@
7576
#if defined(_WIN32)
7677
SYSTEM_INFO sysInfo;
7778
memset(&sysInfo, 0, sizeof(SYSTEM_INFO));
7879
GetSystemInfo(&sysInfo);
7980
*piPageSize = (size_t)sysInfo.dwPageSize;
81
+#elif defined(USE_MMAN_H)
82
+ *piPageSize = (size_t)sysconf(_SC_PAGE_SIZE);
8083
#else
8184
*piPageSize = 4096; /* FIXME: What for POSIX? */
8285
#endif
8386
}
8487
void *fossil_secure_alloc_page(size_t *pN){
8588
--- src/util.c
+++ src/util.c
@@ -19,10 +19,11 @@
19 */
20 #include "config.h"
21 #include "util.h"
22 #if defined(USE_MMAN_H)
23 # include <sys/mman.h>
 
24 #endif
25
26 /*
27 ** For the fossil_timer_xxx() family of functions...
28 */
@@ -75,10 +76,12 @@
75 #if defined(_WIN32)
76 SYSTEM_INFO sysInfo;
77 memset(&sysInfo, 0, sizeof(SYSTEM_INFO));
78 GetSystemInfo(&sysInfo);
79 *piPageSize = (size_t)sysInfo.dwPageSize;
 
 
80 #else
81 *piPageSize = 4096; /* FIXME: What for POSIX? */
82 #endif
83 }
84 void *fossil_secure_alloc_page(size_t *pN){
85
--- src/util.c
+++ src/util.c
@@ -19,10 +19,11 @@
19 */
20 #include "config.h"
21 #include "util.h"
22 #if defined(USE_MMAN_H)
23 # include <sys/mman.h>
24 # include <unistd.h>
25 #endif
26
27 /*
28 ** For the fossil_timer_xxx() family of functions...
29 */
@@ -75,10 +76,12 @@
76 #if defined(_WIN32)
77 SYSTEM_INFO sysInfo;
78 memset(&sysInfo, 0, sizeof(SYSTEM_INFO));
79 GetSystemInfo(&sysInfo);
80 *piPageSize = (size_t)sysInfo.dwPageSize;
81 #elif defined(USE_MMAN_H)
82 *piPageSize = (size_t)sysconf(_SC_PAGE_SIZE);
83 #else
84 *piPageSize = 4096; /* FIXME: What for POSIX? */
85 #endif
86 }
87 void *fossil_secure_alloc_page(size_t *pN){
88

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button