]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/test_and_benchmark/libshared/inc/libshared/libshared_porting_abstraction_layer_operating_system.h
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / test_and_benchmark / libshared / inc / libshared / libshared_porting_abstraction_layer_operating_system.h
1 /****************************************************************************/
2 #if( defined _WIN32 && NTDDI_VERSION >= NTDDI_WINXP && !defined KERNEL_MODE )
3
4   #ifdef LIBSHARED_PAL_OPERATING_SYSTEM
5     #error More than one porting abstraction layer matches current platform in "libshared_porting_abstraction_layer_operating_system.h".
6   #endif
7
8   #define LIBSHARED_PAL_OPERATING_SYSTEM
9
10   #define LIBSHARED_PAL_OS_STRING  "Windows"
11
12   #include <windows.h>
13
14   typedef HANDLE  libshared_pal_thread_handle_t;
15   typedef DWORD   libshared_pal_thread_return_t;
16
17   #define LIBSHARED_PAL_THREAD_CALLING_CONVENTION           WINAPI
18   #define LIBSHARED_PAL_THREAD_RETURN_TYPE                  libshared_pal_thread_return_t
19   #define LIBSHARED_PAL_THREAD_RETURN_CAST( return_value )  return_value
20
21 #endif
22
23
24
25
26
27 /****************************************************************************/
28 #if( defined _WIN32 && NTDDI_VERSION >= NTDDI_WINXP && defined KERNEL_MODE )
29
30   #ifdef LIBSHARED_PAL_OPERATING_SYSTEM
31     #error More than one porting abstraction layer matches current platform in "libshared_porting_abstraction_layer_operating_system.h".
32   #endif
33
34   #define LIBSHARED_PAL_OPERATING_SYSTEM
35
36   #define LIBSHARED_PAL_OS_STRING  "Windows"
37
38   #include <wdm.h>
39
40   typedef HANDLE libshared_pal_thread_handle_t;
41   typedef VOID   libshared_pal_thread_return_t;
42
43   #define LIBSHARED_PAL_THREAD_CALLING_CONVENTION
44   #define LIBSHARED_PAL_THREAD_RETURN_TYPE                  int
45   #define LIBSHARED_PAL_THREAD_RETURN_CAST( return_value )
46
47 #endif
48
49
50
51
52
53 /****************************************************************************/
54 #if( defined __linux__ && !defined KERNEL_MODE )
55
56   #ifdef LIBSHARED_PAL_OPERATING_SYSTEM
57     #error More than one porting abstraction layer matches current platform in "libshared_porting_abstraction_layer_operating_system.h".
58   #endif
59
60   #define LIBSHARED_PAL_OPERATING_SYSTEM
61
62   #define _GNU_SOURCE
63   #include <unistd.h>
64
65   #define LIBSHARED_PAL_OS_STRING  "Linux"
66
67   #if( _POSIX_THREADS >= 0 )
68     #include <pthread.h>
69     #include <sched.h>
70     #include <sys/syscall.h>
71     #include <sys/types.h>
72
73     typedef pthread_t  libshared_pal_thread_handle_t;
74     typedef void *     libshared_pal_thread_return_t;
75
76     #define LIBSHARED_PAL_THREAD_CALLING_CONVENTION
77     #define LIBSHARED_PAL_THREAD_RETURN_TYPE              libshared_pal_thread_return_t
78     #define LIBSHARED_PAL_THREAD_RETURN_CAST( return_value )  ( (libshared_pal_thread_return_t) (return_value) )
79   #endif
80
81   #if( _POSIX_THREADS == -1 )
82     #error No pthread support under Linux in libshared_porting_abstraction_layer_operating_system.h
83   #endif
84
85 #endif
86
87
88
89
90
91 /****************************************************************************/
92 #if( defined __linux__ && defined KERNEL_MODE )
93
94   #ifdef LIBSHARED_PAL_OPERATING_SYSTEM
95     #error More than one porting abstraction layer matches current platform. in "libshared_porting_abstraction_layer_operating_system.h".
96   #endif
97
98   #define LIBSHARED_PAL_OPERATING_SYSTEM
99
100   #define LIBSHARED_PAL_OS_STRING  "Linux"
101
102   #define _GNU_SOURCE
103
104   #include <linux/module.h>
105   #include <linux/kthread.h>
106
107   typedef struct task_struct * libshared_pal_thread_handle_t;
108   typedef int                  libshared_pal_thread_return_t;
109
110   #define LIBSHARED_PAL_THREAD_CALLING_CONVENTION  
111   #define LIBSHARED_PAL_THREAD_RETURN_TYPE              libshared_pal_thread_return_t
112   #define LIBSHARED_PAL_THREAD_RETURN_CAST( return_value )  ( (libshared_pal_thread_return_t) (return_value) )
113
114 #endif
115
116
117
118
119
120 /****************************************************************************/
121 #if( !defined LIBSHARED_PAL_OPERATING_SYSTEM )
122
123   #error No matching porting abstraction layer in "libshared_porting_abstraction_layer_operating_system.h".
124
125 #endif
126