summaryrefslogtreecommitdiffstats
path: root/base/sys_info_mac.cc
blob: caec74d125987bb8e54b572c15ec3821ce39d4b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/sys_info.h"

#include <CoreServices/CoreServices.h>

namespace base {

// static
void SysInfo::OperatingSystemVersionNumbers(int32 *major_version,
                                            int32 *minor_version,
                                            int32 *bugfix_version) {
  int32 major_version_cached = 0;
  int32 minor_version_cached = 0;
  int32 bugfix_version_cached = 0;

  // Gestalt can't be called in the sandbox, so we cache its return value.
  Gestalt(gestaltSystemVersionMajor,
      reinterpret_cast<SInt32*>(&major_version_cached));
  Gestalt(gestaltSystemVersionMinor,
      reinterpret_cast<SInt32*>(&minor_version_cached));
  Gestalt(gestaltSystemVersionBugFix,
      reinterpret_cast<SInt32*>(&bugfix_version_cached));

  *major_version = major_version_cached;
  *minor_version = minor_version_cached;
  *bugfix_version = bugfix_version_cached;
}

}  // namespace base