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