diff -r ae3103c9ee50 model/libc-dce.cc
--- a/model/libc-dce.cc Fri Apr 27 19:40:18 2012 +0900
+++ b/model/libc-dce.cc Tue May 29 18:16:48 2012 +0900
@@ -143,6 +143,9 @@
#define DCE(name) (*libc)->name ## _fn = (func_t)(__typeof(&name))dce_ ## name;
#define DCET(rtype,name) DCE(name)
+#define DCE2(name,rtype,...) (*libc)->name ## _fn = dce_ ## name;
+#define DCE3(name,rtype,t1,t2) (*libc)->name ## _fn = dce_ ## name;
+#define DCE4(name,rtype,t1,t2,t3) (*libc)->name ## _fn = dce_ ## name;
#define NATIVE(name) \
(*libc)->name ## _fn = (func_t)name;
diff -r ae3103c9ee50 model/libc-ns3.h
--- a/model/libc-ns3.h Fri Apr 27 19:40:18 2012 +0900
+++ b/model/libc-ns3.h Tue May 29 18:16:48 2012 +0900
@@ -14,6 +14,7 @@
* the internal implementation
*/
+
#ifndef DCE
#error Macro DCE should be defined before including libc-ns3.h
#endif
@@ -330,8 +331,8 @@
DCE (pthread_key_delete)
DCE (pthread_mutex_destroy)
DCE (pthread_mutex_init)
-DCE (pthread_mutex_lock)
-DCE (pthread_mutex_unlock)
+DCE2 (pthread_mutex_lock, int, pthread_mutex_t *)
+DCE2 (pthread_mutex_unlock, int, pthread_mutex_t *)
DCE (pthread_mutex_trylock)
DCE (pthread_mutexattr_init)
DCE (pthread_mutexattr_destroy)
@@ -351,8 +352,8 @@
DCE (pthread_cond_init)
DCE (pthread_cond_broadcast)
DCE (pthread_cond_signal)
-DCE (pthread_cond_timedwait)
-DCE (pthread_cond_wait)
+DCE4 (pthread_cond_timedwait, int, pthread_cond_t*, pthread_mutex_t*, const struct timespec *)
+DCE3 (pthread_cond_wait, int, pthread_cond_t*, pthread_mutex_t*)
DCE (pthread_condattr_destroy)
DCE (pthread_condattr_init)
NATIVE (pthread_rwlock_init)
@@ -473,7 +474,8 @@
DCE (initgroups)
// this is wrong. clock should be changed to DCE implementation
-DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
+DCE3 (clock_gettime, int, clockid_t, struct timespec *)
+//DCE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
//NATIVE_WITH_ALIAS2 (clock_gettime, __vdso_clock_gettime)
// setjmp.h
@@ -536,6 +538,9 @@
#undef DCE
#undef DCET
+#undef DCE2
+#undef DCE3
+#undef DCE4
#undef NATIVE
#undef NATIVE_WITH_ALIAS
#undef NATIVE_WITH_ALIAS2
diff -r ae3103c9ee50 model/libc.cc
--- a/model/libc.cc Fri Apr 27 19:40:18 2012 +0900
+++ b/model/libc.cc Tue May 29 18:16:48 2012 +0900
@@ -38,6 +38,26 @@
#define DCET(rtype,name) \
GCC_BUILTIN_APPLYT(rtype,name,name)
+#define c99_tail(...) _c99_tail (__VA_ARGS__)
+#define _c99_tail(x,...) __VA_ARGS__
+
+#define DCE2(name,rtype,...) \
+ rtype name (__VA_ARGS__ a1) \
+ { \
+ return g_libc.name ## _fn (a1); \
+ }
+
+#define DCE3(name,rtype,t1,t2) \
+ rtype name (t1 a1, t2 a2) \
+ { \
+ return g_libc.name ## _fn (a1,a2); \
+ }
+
+#define DCE4(name,rtype,...) \
+ rtype name (t1 a1, t2 a2,t3 a3) \
+ { \
+ return g_libc.name ## _fn (a1,a2,a3); \
+ }
#define DCE_WITH_ALIAS(name) \
GCC_BUILTIN_APPLY(__ ## name,name) \
diff -r ae3103c9ee50 model/libc.h
--- a/model/libc.h Fri Apr 27 19:40:18 2012 +0900
+++ b/model/libc.h Tue May 29 18:16:48 2012 +0900
@@ -1,13 +1,19 @@
#ifndef LIBC_H
#define LIBC_H
+#define _SYS_SELECT_H
+#include <sys/types.h>
+#undef _SYS_SELECT_H
+
struct Libc
{
#define DCE(name) void (*name ## _fn)(...);
#define DCET(rtype, name) DCE(name)
-
+#define DCE2(name,rtype,...) rtype (*name ## _fn)(__VA_ARGS__);
+#define DCE3(name,rtype,t1,t2) rtype (*name ## _fn)(t1,t2);
+#define DCE4(name,rtype,t1,t2,t3) rtype (*name ## _fn)(t1,t2,t3);
#include "libc-ns3.h"
};