Intel® OpenMP* Runtime Library
Main Page
Modules
Classes
All
Classes
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
src
kmp_wrapper_getpid.h
1
/*
2
* kmp_wrapper_getpid.h -- getpid() declaration.
3
*/
4
5
/* <copyright>
6
Copyright (c) 1997-2015 Intel Corporation. All Rights Reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions
10
are met:
11
12
* Redistributions of source code must retain the above copyright
13
notice, this list of conditions and the following disclaimer.
14
* Redistributions in binary form must reproduce the above copyright
15
notice, this list of conditions and the following disclaimer in the
16
documentation and/or other materials provided with the distribution.
17
* Neither the name of Intel Corporation nor the names of its
18
contributors may be used to endorse or promote products derived
19
from this software without specific prior written permission.
20
21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33
</copyright> */
34
35
#ifndef KMP_WRAPPER_GETPID_H
36
#define KMP_WRAPPER_GETPID_H
37
38
#if KMP_OS_UNIX
39
40
// On Unix-like systems (Linux* OS and OS X*) getpid() is declared in standard headers.
41
#include <sys/types.h>
42
#include <unistd.h>
43
44
#elif KMP_OS_WINDOWS
45
46
// On Windows* OS _getpid() returns int (not pid_t) and is declared in "process.h".
47
#include <process.h>
48
// Let us simulate Unix.
49
typedef
int
pid_t;
50
#define getpid _getpid
51
52
#else
53
54
#error Unknown or unsupported OS.
55
56
#endif
57
58
/*
59
TODO: All the libomp source code uses pid_t type for storing the result of getpid(), it is good.
60
But often it printed as "%d", that is not good, because it ignores pid_t definition (may pid_t
61
be longer that int?). It seems all pid prints should be rewritten as
62
63
printf( "%" KMP_UINT64_SPEC, (kmp_uint64) pid );
64
65
or (at least) as
66
67
printf( "%" KMP_UINT32_SPEC, (kmp_uint32) pid );
68
69
(kmp_uint32, kmp_uint64, KMP_UINT64_SPEC, and KMP_UNIT32_SPEC are defined in "kmp_os.h".)
70
71
*/
72
73
#endif // KMP_WRAPPER_GETPID_H
74
75
// end of file //
Generated by
1.8.6