memsize_solaris.go 574 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (C) 2014 The Syncthing Authors.
  2. //
  3. // This Source Code Form is subject to the terms of the Mozilla Public
  4. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  5. // You can obtain one at https://mozilla.org/MPL/2.0/.
  6. //go:build solaris
  7. // +build solaris
  8. package ur
  9. import (
  10. "os/exec"
  11. "strconv"
  12. )
  13. func memorySize() int64 {
  14. cmd := exec.Command("prtconf", "-m")
  15. out, err := cmd.CombinedOutput()
  16. if err != nil {
  17. return 0
  18. }
  19. mb, err := strconv.ParseInt(string(out), 10, 64)
  20. if err != nil {
  21. return 0
  22. }
  23. return mb * 1024 * 1024
  24. }