case LIMITS:
{
struct ipc_limits lim;
+ uint64_t tmp, pgsz = getpagesize();
if (ipc_shm_get_limits(&lim)) {
printf (_("unable to fetch shared memory limits\n"));
printf (_("max number of segments = %ju\n"), lim.shmmni);
ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_KB : unit,
_("max seg size"), lim.shmmax, "\n", 0);
+
+ tmp = (uint64_t) lim.shmall * pgsz;
+ /* overflow handling, at least we don't print ridiculous small values */
+ if (lim.shmall != 0 && tmp / lim.shmall != pgsz) {
+ tmp = UINT64_MAX - (UINT64_MAX % pgsz);
+ }
ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_KB : unit,
- _("max total shared memory"),
- (uint64_t) lim.shmall * getpagesize(), "\n", 0);
+ _("max total shared memory"), tmp, "\n", 0);
ipc_print_size(unit == IPC_UNIT_DEFAULT ? IPC_UNIT_BYTES : unit,
_("min seg size"), lim.shmmin, "\n", 0);
return;
#echo "IPCS-CMD: ${IPCS_CMD[$i]}"
#echo
+ # overflow is handled differently because we don't have large
+ # int math, see https://github.com/karelzak/util-linux/issues/51
+ if [ $(bc <<<"$a >= 2^64/1024") -eq 1 ]; then
+ a=$(bc <<<"(2^64 - $PAGE_SIZE)/1024")
+ fi
+
if [ x"$a" == x"$b" ]; then
echo " OK"
else
. $TS_SELF/functions.sh
-# TODO https://github.com/karelzak/util-linux/issues/51
-SHMALL=$(</proc/sys/kernel/shmall)
-if [ $(bc <<<"(2^64 / $PAGE_SIZE) <= $SHMALL") -eq 1 ]; then
- TS_KNOWN_FAIL="yes"
-fi
-
ts_log "check for difference between kernel and IPC"
ipcs_limits_check >> $TS_OUTPUT