blob: 30600a7e84fd565b5cae5d1d21710c8c0f455fd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
$NetBSD: patch-ad,v 1.3 2008/08/17 21:00:20 dholland Exp $
--- utility.c.orig 2008-04-15 18:41:49.000000000 -0400
+++ utility.c 2008-08-17 16:41:20.000000000 -0400
@@ -2788,6 +2788,15 @@
#if defined(UNIX)
int shmid;
void *shared;
+ long pagesize;
+
+ /* round to page boundary */
+ pagesize = sysconf(_SC_PAGESIZE);
+ if (pagesize == -1) {
+ /* just in case, guess */
+ pagesize = 4096;
+ }
+ size = size + pagesize - (size % pagesize);
shmid = shmget(IPC_PRIVATE, size, (IPC_CREAT | 0600));
if (shmid < 0) {
|