I'm trying to setup shared memory by building a new kernel and I'm a bit confused by the result.
I want to have 4G of shared memory (which is 2^32 bytes).
First of all, there's 16G of RAM and 20G of swap, so there is enough for what I want to do.
In the kernel options, I set SHMMAXPGS to 1048576 which with 4K pages should end up at 4G for the SHMMAX option. I also set SHMALL to 1048576
When I'm compiling the kernel, I got
cc1: warnings being treated as errors
/usr/src/sys/kern/sysv_shm.c:168: warning: integer overflow in expression
*** Error code 1
Looking into sysv_shm.c, I figure out that SHMMAX (the line at which there's a compilation error) is of type unsigned long (u_long) which should accomodate 2^64 bytes.
But anyway, maybe I was wrong and it's only 2^32 bytes so I change SHMMAXPGS to 524288 which is 2^32 and I still have the same problem. So I try 2^32-1 (524287) and it worked.
But this value only given approximatively 2G of shared memory.
My question is what wrong? the data type should accommodate such size (4G), but I can compile the new kernel
Thanks
I want to have 4G of shared memory (which is 2^32 bytes).
First of all, there's 16G of RAM and 20G of swap, so there is enough for what I want to do.
In the kernel options, I set SHMMAXPGS to 1048576 which with 4K pages should end up at 4G for the SHMMAX option. I also set SHMALL to 1048576
When I'm compiling the kernel, I got
cc1: warnings being treated as errors
/usr/src/sys/kern/sysv_shm.c:168: warning: integer overflow in expression
*** Error code 1
Looking into sysv_shm.c, I figure out that SHMMAX (the line at which there's a compilation error) is of type unsigned long (u_long) which should accomodate 2^64 bytes.
But anyway, maybe I was wrong and it's only 2^32 bytes so I change SHMMAXPGS to 524288 which is 2^32 and I still have the same problem. So I try 2^32-1 (524287) and it worked.
But this value only given approximatively 2G of shared memory.
My question is what wrong? the data type should accommodate such size (4G), but I can compile the new kernel
Thanks