author | Hajime Tazaki <tazaki@nict.go.jp> |
Wed, 30 May 2012 11:24:40 +0900 | |
changeset 21 | c9fa67dd732a |
permissions | -rw-r--r-- |
21
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
1 |
diff -r ae3103c9ee50 model/libc-dce.cc |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
2 |
--- a/model/libc-dce.cc Fri Apr 27 19:40:18 2012 +0900 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
3 |
+++ b/model/libc-dce.cc Tue May 29 18:16:48 2012 +0900 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
4 |
@@ -143,6 +143,9 @@ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
5 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
6 |
#define DCE(name) (*libc)->name ## _fn = (func_t)(__typeof(&name))dce_ ## name; |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
7 |
#define DCET(rtype,name) DCE(name) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
8 |
+#define DCE2(name,rtype,...) (*libc)->name ## _fn = dce_ ## name; |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
9 |
+#define DCE3(name,rtype,t1,t2) (*libc)->name ## _fn = dce_ ## name; |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
10 |
+#define DCE4(name,rtype,t1,t2,t3) (*libc)->name ## _fn = dce_ ## name; |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
11 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
12 |
#define NATIVE(name) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
13 |
(*libc)->name ## _fn = (func_t)name; |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
14 |
diff -r ae3103c9ee50 model/libc-ns3.h |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
15 |
--- a/model/libc-ns3.h Fri Apr 27 19:40:18 2012 +0900 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
16 |
+++ b/model/libc-ns3.h Tue May 29 18:16:48 2012 +0900 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
17 |
@@ -14,6 +14,7 @@ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
18 |
* the internal implementation |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
19 |
*/ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
20 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
21 |
+ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
22 |
#ifndef DCE |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
23 |
#error Macro DCE should be defined before including libc-ns3.h |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
24 |
#endif |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
25 |
@@ -330,8 +331,8 @@ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
26 |
DCE (pthread_key_delete) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
27 |
DCE (pthread_mutex_destroy) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
28 |
DCE (pthread_mutex_init) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
29 |
-DCE (pthread_mutex_lock) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
30 |
-DCE (pthread_mutex_unlock) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
31 |
+DCE2 (pthread_mutex_lock, int, pthread_mutex_t *) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
32 |
+DCE2 (pthread_mutex_unlock, int, pthread_mutex_t *) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
33 |
DCE (pthread_mutex_trylock) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
34 |
DCE (pthread_mutexattr_init) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
35 |
DCE (pthread_mutexattr_destroy) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
36 |
@@ -351,8 +352,8 @@ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
37 |
DCE (pthread_cond_init) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
38 |
DCE (pthread_cond_broadcast) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
39 |
DCE (pthread_cond_signal) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
40 |
-DCE (pthread_cond_timedwait) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
41 |
-DCE (pthread_cond_wait) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
42 |
+DCE4 (pthread_cond_timedwait, int, pthread_cond_t*, pthread_mutex_t*, const struct timespec *) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
43 |
+DCE3 (pthread_cond_wait, int, pthread_cond_t*, pthread_mutex_t*) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
44 |
DCE (pthread_condattr_destroy) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
45 |
DCE (pthread_condattr_init) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
46 |
NATIVE (pthread_rwlock_init) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
47 |
@@ -473,7 +474,8 @@ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
48 |
DCE (initgroups) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
49 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
50 |
// this is wrong. clock should be changed to DCE implementation |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
51 |
-DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
52 |
+DCE3 (clock_gettime, int, clockid_t, struct timespec *) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
53 |
+//DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
54 |
//NATIVE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
55 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
56 |
// setjmp.h |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
57 |
@@ -536,6 +538,9 @@ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
58 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
59 |
#undef DCE |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
60 |
#undef DCET |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
61 |
+#undef DCE2 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
62 |
+#undef DCE3 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
63 |
+#undef DCE4 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
64 |
#undef NATIVE |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
65 |
#undef NATIVE_WITH_ALIAS |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
66 |
#undef NATIVE_WITH_ALIAS2 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
67 |
diff -r ae3103c9ee50 model/libc.cc |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
68 |
--- a/model/libc.cc Fri Apr 27 19:40:18 2012 +0900 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
69 |
+++ b/model/libc.cc Tue May 29 18:16:48 2012 +0900 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
70 |
@@ -38,6 +38,26 @@ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
71 |
#define DCET(rtype,name) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
72 |
GCC_BUILTIN_APPLYT(rtype,name,name) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
73 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
74 |
+#define c99_tail(...) _c99_tail (__VA_ARGS__) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
75 |
+#define _c99_tail(x,...) __VA_ARGS__ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
76 |
+ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
77 |
+#define DCE2(name,rtype,...) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
78 |
+ rtype name (__VA_ARGS__ a1) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
79 |
+ { \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
80 |
+ return g_libc.name ## _fn (a1); \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
81 |
+ } |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
82 |
+ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
83 |
+#define DCE3(name,rtype,t1,t2) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
84 |
+ rtype name (t1 a1, t2 a2) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
85 |
+ { \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
86 |
+ return g_libc.name ## _fn (a1,a2); \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
87 |
+ } |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
88 |
+ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
89 |
+#define DCE4(name,rtype,...) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
90 |
+ rtype name (t1 a1, t2 a2,t3 a3) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
91 |
+ { \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
92 |
+ return g_libc.name ## _fn (a1,a2,a3); \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
93 |
+ } |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
94 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
95 |
#define DCE_WITH_ALIAS(name) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
96 |
GCC_BUILTIN_APPLY(__ ## name,name) \ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
97 |
diff -r ae3103c9ee50 model/libc.h |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
98 |
--- a/model/libc.h Fri Apr 27 19:40:18 2012 +0900 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
99 |
+++ b/model/libc.h Tue May 29 18:16:48 2012 +0900 |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
100 |
@@ -1,13 +1,19 @@ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
101 |
#ifndef LIBC_H |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
102 |
#define LIBC_H |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
103 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
104 |
+#define _SYS_SELECT_H |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
105 |
+#include <sys/types.h> |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
106 |
+#undef _SYS_SELECT_H |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
107 |
+ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
108 |
struct Libc |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
109 |
{ |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
110 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
111 |
#define DCE(name) void (*name ## _fn)(...); |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
112 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
113 |
#define DCET(rtype, name) DCE(name) |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
114 |
- |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
115 |
+#define DCE2(name,rtype,...) rtype (*name ## _fn)(__VA_ARGS__); |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
116 |
+#define DCE3(name,rtype,t1,t2) rtype (*name ## _fn)(t1,t2); |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
117 |
+#define DCE4(name,rtype,t1,t2,t3) rtype (*name ## _fn)(t1,t2,t3); |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
118 |
#include "libc-ns3.h" |
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
119 |
|
c9fa67dd732a
add temporary dce macro alternatives
Hajime Tazaki <tazaki@nict.go.jp>
parents:
diff
changeset
|
120 |
}; |