// SPDX-FileCopyrightText: Copyright The Lima Authors1// SPDX-License-Identifier: Apache-2.023package osutil45import (6"errors"7"fmt"89"github.com/sirupsen/logrus"10"golang.org/x/sys/unix"11)1213func IsBeingRosettaTranslated() bool {14ret, err := unix.SysctlUint32("sysctl.proc_translated")15if err != nil {16const fallback = false17if errors.Is(err, unix.ENOENT) {18return false19}2021err = fmt.Errorf(`failed to read sysctl "sysctl.proc_translated": %w`, err)22logrus.WithError(err).Warnf("failed to detect whether running under rosetta, assuming %v", fallback)23return fallback24}2526return ret != 027}282930