memsize_solaris.go 579 B

12345678910111213141516171819202122232425262728
  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. // +build solaris
  7. package ur
  8. import (
  9. "os/exec"
  10. "strconv"
  11. )
  12. func memorySize() (int64, error) {
  13. cmd := exec.Command("prtconf", "-m")
  14. out, err := cmd.CombinedOutput()
  15. if err != nil {
  16. return 0, err
  17. }
  18. mb, err := strconv.ParseInt(string(out), 10, 64)
  19. if err != nil {
  20. return 0, err
  21. }
  22. return mb * 1024 * 1024, nil
  23. }