| 1 |
/***************************************************************************** |
| 2 |
|
| 3 |
Copyright (c) 1995, 2026, Oracle and/or its affiliates. |
| 4 |
|
| 5 |
This program is free software; you can redistribute it and/or modify it under |
| 6 |
the terms of the GNU General Public License, version 2.0, as published by the |
| 7 |
Free Software Foundation. |
| 8 |
|
| 9 |
This program is designed to work with certain software (including |
| 10 |
but not limited to OpenSSL) that is licensed under separate terms, |
| 11 |
as designated in a particular file or component or in included license |
| 12 |
documentation. The authors of MySQL hereby grant you an additional |
| 13 |
permission to link the program and your derivative works with the |
| 14 |
separately licensed software that they have either included with |
| 15 |
the program or referenced in the documentation. |
| 16 |
|
| 17 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 18 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 19 |
FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0, |
| 20 |
for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License along with |
| 23 |
this program; if not, write to the Free Software Foundation, Inc., |
| 24 |
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 25 |
|
| 26 |
*****************************************************************************/ |
| 27 |
|
| 28 |
/** @file os/os0proc.cc |
| 29 |
The interface to the operating system |
| 30 |
process control primitives |
| 31 |
|
| 32 |
Created 9/30/1995 Heikki Tuuri |
| 33 |
*******************************************************/ |
| 34 |
|
| 35 |
#include "my_config.h" |
| 36 |
|
| 37 |
#include <errno.h> |
| 38 |
#include <stddef.h> |
| 39 |
#include <sys/types.h> |
| 40 |
#include "ha_prototypes.h" |
| 41 |
#include "os0proc.h" |
| 42 |
#include "srv0srv.h" |
| 43 |
#include "ut0byte.h" |
| 44 |
#include "ut0mem.h" |
| 45 |
|
| 46 |
/** The total amount of memory currently allocated from the operating |
| 47 |
system with os_mem_alloc_large(). */ |
| 48 |
std::atomic<ulint> os_total_large_mem_allocated{0}; |
| 49 |
|
| 50 |
/** Whether to use large pages in the buffer pool */ |
| 51 |
bool os_use_large_pages; |
| 52 |
|
| 53 |
/** Large page size. This may be a boot-time option on some platforms */ |
| 54 |
uint os_large_page_size; |
| 55 |
|
| 56 |
/** Converts the current process id to a number. |
| 57 |
@return process id as a number */ |
| 58 |
ulint os_proc_get_number(void) { |
| 59 |
#ifdef _WIN32 |
| 60 |
return (static_cast<ulint>(GetCurrentProcessId())); |
| 61 |
#else |
| 62 |
return (static_cast<ulint>(getpid())); |
| 63 |
#endif |
| 64 |
} |