| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. |
| 4 | Copyright (c) 2017, MariaDB Corporation. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify it under |
| 7 | the terms of the GNU General Public License as published by the Free Software |
| 8 | Foundation; version 2 of the License. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 12 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License along with |
| 15 | this program; if not, write to the Free Software Foundation, Inc., |
| 16 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
| 17 | |
| 18 | *****************************************************************************/ |
| 19 | |
| 20 | /**************************************************//** |
| 21 | @file include/os0proc.h |
| 22 | The interface to the operating system |
| 23 | process control primitives |
| 24 | |
| 25 | Created 9/30/1995 Heikki Tuuri |
| 26 | *******************************************************/ |
| 27 | |
| 28 | #ifndef os0proc_h |
| 29 | #define os0proc_h |
| 30 | |
| 31 | #include "univ.i" |
| 32 | |
| 33 | #ifdef UNIV_LINUX |
| 34 | #include <sys/ipc.h> |
| 35 | #include <sys/shm.h> |
| 36 | #endif |
| 37 | |
| 38 | typedef void* os_process_t; |
| 39 | typedef unsigned long int os_process_id_t; |
| 40 | |
| 41 | /** The total amount of memory currently allocated from the operating |
| 42 | system with os_mem_alloc_large(). */ |
| 43 | extern ulint os_total_large_mem_allocated; |
| 44 | |
| 45 | /** Whether to use large pages in the buffer pool */ |
| 46 | extern my_bool os_use_large_pages; |
| 47 | |
| 48 | /** Large page size. This may be a boot-time option on some platforms */ |
| 49 | extern uint os_large_page_size; |
| 50 | |
| 51 | /** Converts the current process id to a number. |
| 52 | @return process id as a number */ |
| 53 | ulint |
| 54 | os_proc_get_number(void); |
| 55 | |
| 56 | /** Allocates large pages memory. |
| 57 | @param[in,out] n Number of bytes to allocate |
| 58 | @return allocated memory */ |
| 59 | void* |
| 60 | os_mem_alloc_large( |
| 61 | ulint* n); |
| 62 | |
| 63 | /** Frees large pages memory. |
| 64 | @param[in] ptr pointer returned by os_mem_alloc_large() |
| 65 | @param[in] size size returned by os_mem_alloc_large() */ |
| 66 | void |
| 67 | os_mem_free_large( |
| 68 | void *ptr, |
| 69 | ulint size); |
| 70 | |
| 71 | #endif |
| 72 | |