MySQL 9.7.0
Source Code Documentation
my_system_api.h
Go to the documentation of this file.
1/* Copyright (c) 2025, 2026, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#pragma once
25
26#include <optional>
27
28/**
29 Determines if the current process is running in a container.
30 @return true if running in either cgroup v1 or cgroup v2, false otherwise
31*/
33
34/**
35 Determines if cgroup restricts resources
36 @return true if cgroup restricts resources like memory
37*/
39
40/**
41 Read the memory limit set by the container. Try cgroup v2, and then cgroup v1
42 @return memory limit set by cgroup v2 or cgroup v1; or 0
43 @note Return value of 0 implies either no limits are set or server is not
44 running in a container
45*/
46uint64_t my_cgroup_mem_limit();
47
48/**
49 Find number of VCPUs as seen by the current process based on the
50 affinity between each process and VCPU.
51*/
53
54/**
55 Get the number of VCPUS based on system configuration.
56*/
57uint32_t num_vcpus_using_config();
58
59/**
60 Get the number of VCPU.
61*/
62uint32_t my_system_num_vcpus();
uint64_t my_cgroup_mem_limit()
Read the memory limit set by the container.
Definition: my_system_api_cgroup.cc:297
bool does_cgroup_limit_resources()
Determines if cgroup restricts resources.
Definition: my_system_api_cgroup.cc:286
uint32_t my_system_num_vcpus()
Get the number of VCPU.
Definition: my_system_api_common.cc:35
uint32_t num_vcpus_using_config()
Get the number of VCPUS based on system configuration.
Definition: my_system_api_apple.cc:38
uint32_t num_vcpus_using_affinity()
Find number of VCPUs as seen by the current process based on the affinity between each process and VC...
Definition: my_system_api_apple.cc:36
bool is_running_in_cgroup()
Determines if the current process is running in a container.
Definition: my_system_api_cgroup.cc:282