MySQL 9.0.0
Source Code Documentation
process.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2020, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24*/
25#ifndef MYSQL_HARNESS_STDX_PROCESS_INCLUDED
26#define MYSQL_HARNESS_STDX_PROCESS_INCLUDED
27
28// partial implementation of P1750R1
29//
30// see: http://wg21.link/p1750
31#include <sys/types.h>
32#ifdef _WIN32
33#include <process.h>
34#else
35#include <unistd.h>
36#endif
37
38namespace stdx {
39namespace this_process {
40#ifdef _WIN32
42using pid_type = int;
43#else
44using native_handle_type = pid_t;
45using pid_type = pid_t;
46#endif
47
48inline pid_type get_id() {
49#ifdef _WIN32
50 return _getpid();
51#else
52 return getpid();
53#endif
54}
55
57#ifdef _WIN32
58 return GetCurrentProcess();
59#else
60 return getpid();
61#endif
62}
63
64} // namespace this_process
65} // namespace stdx
66#endif
pid_t pid_type
Definition: process.h:45
pid_type get_id()
Definition: process.h:48
pid_t native_handle_type
Definition: process.h:44
native_handle_type native_handle()
Definition: process.h:56
Definition: bit.h:32
#define HANDLE
Definition: violite.h:159