incus: patch for 32bit

This commit is contained in:
dkwo 2024-06-05 13:17:11 -04:00 committed by Andrew J. Hesford
parent 4eef8d1cb4
commit 5611ff89c9
1 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
From f11c0b04f2e90a19e900ca077e21edf02c589db2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber@stgraber.org>
Date: Wed, 5 Jun 2024 11:35:50 -0400
Subject: [PATCH] incusd/seccomp: Fix sysinfo logic on 32bit platforms
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #918
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
---
internal/server/seccomp/sysinfo_32.go | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/internal/server/seccomp/sysinfo_32.go b/internal/server/seccomp/sysinfo_32.go
index 56bcd23ace..0445473147 100644
--- a/internal/server/seccomp/sysinfo_32.go
+++ b/internal/server/seccomp/sysinfo_32.go
@@ -8,13 +8,13 @@ import (
// ToNative fills fields from s into native fields.
func (s *Sysinfo) ToNative(n *unix.Sysinfo_t) {
- n.Bufferram = uint32(s.Bufferram / s.Unit)
- n.Freeram = uint32(s.Freeram / s.Unit)
- n.Freeswap = uint32(s.Freeswap / s.Unit)
+ n.Bufferram = uint32(s.Bufferram) / s.Unit
+ n.Freeram = uint32(s.Freeram) / s.Unit
+ n.Freeswap = uint32(s.Freeswap) / s.Unit
n.Procs = s.Procs
- n.Sharedram = uint32(s.Sharedram / s.Unit)
- n.Totalram = uint32(s.Totalram / s.Unit)
- n.Totalswap = uint32(s.Totalswap / s.Unit)
+ n.Sharedram = uint32(s.Sharedram) / s.Unit
+ n.Totalram = uint32(s.Totalram) / s.Unit
+ n.Totalswap = uint32(s.Totalswap) / s.Unit
n.Uptime = int32(s.Uptime)
n.Unit = uint32(s.Unit)
}