MySQL 8.2.0
Source Code Documentation
process.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2020, 2023, 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 also distributed 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 included with MySQL.
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 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#ifndef MYSQL_HARNESS_STDX_PROCESS_INCLUDED
25#define MYSQL_HARNESS_STDX_PROCESS_INCLUDED
26
27// partial implementation of P1750R1
28//
29// see: http://wg21.link/p1750
30#include <sys/types.h>
31#ifdef _WIN32
32#include <process.h>
33#else
34#include <unistd.h>
35#endif
36
37namespace stdx {
38namespace this_process {
39#ifdef _WIN32
41using pid_type = int;
42#else
43using native_handle_type = pid_t;
44using pid_type = pid_t;
45#endif
46
47inline pid_type get_id() {
48#ifdef _WIN32
49 return _getpid();
50#else
51 return getpid();
52#endif
53}
54
56#ifdef _WIN32
57 return GetCurrentProcess();
58#else
59 return getpid();
60#endif
61}
62
63} // namespace this_process
64} // namespace stdx
65#endif
pid_t pid_type
Definition: process.h:44
pid_type get_id()
Definition: process.h:47
pid_t native_handle_type
Definition: process.h:43
native_handle_type native_handle()
Definition: process.h:55
Definition: bit.h:33
#define HANDLE
Definition: violite.h:158