--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fedora8-nontimerfd.patch Mon Aug 06 20:45:50 2012 +0900
@@ -0,0 +1,305 @@
+support Fedora8, timerfd check in configure, macro improvements, fix the issue of scandir imcompatibility
+
+diff -r 4c90fdff71a0 model/dce-dirent.cc
+--- a/model/dce-dirent.cc Mon Jul 16 13:56:16 2012 +0200
++++ b/model/dce-dirent.cc Wed Jul 18 14:28:29 2012 +0900
+@@ -236,9 +236,16 @@
+ rewinddir (dirp);
+ ds->fd = saveFd;
+ }
++
++#ifdef USE_SCANDIR_VOIDPTR
++int dce_scandir (const char *dirp, struct dirent ***namelist,
++ int (*filter)(const struct dirent *),
++ int (*compar)(const void *, const void *))
++#else
+ int dce_scandir (const char *dirp, struct dirent ***namelist,
+ int (*filter)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **))
++#endif
+ {
+ NS_LOG_FUNCTION (Current () << UtilsGetNodeId () );
+ NS_ASSERT (Current () != 0);
+diff -r 4c90fdff71a0 model/dce-dirent.h
+--- a/model/dce-dirent.h Mon Jul 16 13:56:16 2012 +0200
++++ b/model/dce-dirent.h Wed Jul 18 14:28:29 2012 +0900
+@@ -35,9 +35,24 @@
+ int dce_closedir (DIR *dirp);
+ int dce_dirfd (DIR *dirp);
+ void dce_rewinddir (DIR *dirp);
++
++// For the compatibility of 4th argument of scandir()
++#define USE_SCANDIR_VOIDPTR
++#if defined( __GLIBC_PREREQ )
++# if __GLIBC_PREREQ(2,10)
++# undef USE_SCANDIR_VOIDPTR
++# endif
++#endif
++
++#ifdef USE_SCANDIR_VOIDPTR
++int dce_scandir (const char *dirp, struct dirent ***namelist,
++ int (*filter)(const struct dirent *),
++ int (*compar)(const void *, const void *));
++#else
+ int dce_scandir (const char *dirp, struct dirent ***namelist,
+ int (*filter)(const struct dirent *),
+ int (*compar)(const struct dirent **, const struct dirent **));
++#endif
+
+ #ifdef __cplusplus
+ }
+diff -r 4c90fdff71a0 model/libc-dce.cc
+--- a/model/libc-dce.cc Mon Jul 16 13:56:16 2012 +0200
++++ b/model/libc-dce.cc Wed Jul 18 14:28:29 2012 +0900
+@@ -12,7 +12,9 @@
+ #include "sys/dce-mman.h"
+ #include "sys/dce-stat.h"
+ #include "sys/dce-select.h"
++#ifdef HAVE_SYS_TIMER_H
+ #include "sys/dce-timerfd.h"
++#endif
+ #include "dce-unistd.h"
+ #include "dce-netdb.h"
+ #include "dce-pthread.h"
+@@ -67,7 +69,9 @@
+ #include <sys/ioctl.h>
+ #include <sys/io.h>
+ #include <sys/mman.h>
++#ifdef HAVE_SYS_TIMER_H
+ #include <sys/timerfd.h>
++#endif
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/resource.h>
+@@ -142,6 +146,7 @@
+ #define DCE(name) (*libc)->name ## _fn = (func_t)(__typeof(&name))dce_ ## name;
+ #define DCET(rtype,name) DCE(name)
+ #define DCE_EXPLICIT(name,rtype,...) (*libc)->name ## _fn = dce_ ## name;
++#define NATIVE_EXPLICIT2(name,rtype,...) (*libc)->name ## _fn = name;
+
+ #define NATIVE(name) \
+ (*libc)->name ## _fn = (func_t)name;
+diff -r 4c90fdff71a0 model/libc-ns3.h
+--- a/model/libc-ns3.h Mon Jul 16 13:56:16 2012 +0200
++++ b/model/libc-ns3.h Wed Jul 18 14:28:29 2012 +0900
+@@ -108,7 +108,7 @@
+ NATIVE (strerror_r)
+ NATIVE (strcoll)
+ NATIVE (memset)
+-NATIVE (memcpy)
++NATIVE_EXPLICIT2 (memcpy, void *, void *, const void *, size_t)
+ NATIVE (bcopy)
+ NATIVE (memcmp)
+ NATIVE (memmove)
+@@ -426,11 +426,14 @@
+ // CTYPE.H
+ NATIVE (toupper)
+ NATIVE (tolower)
++NATIVE (_tolower)
+
+ // SYS/TIMERFD.H
++#ifdef HAVE_SYS_TIMER_H
+ DCE (timerfd_create)
+ DCE (timerfd_settime)
+ DCE (timerfd_gettime)
++#endif /* HAVE_SYS_TIMER_H */
+
+ // NET/IF.H
+ DCE (if_nametoindex)
+@@ -541,6 +544,7 @@
+ #undef NATIVE_WITH_ALIAS
+ #undef NATIVE_WITH_ALIAS2
+ #undef NATIVE_EXPLICIT
++#undef NATIVE_EXPLICIT2
+ #undef DCE_WITH_ALIAS
+ #undef DCE_WITH_ALIAS2
+
+diff -r 4c90fdff71a0 model/libc.cc
+--- a/model/libc.cc Mon Jul 16 13:56:16 2012 +0200
++++ b/model/libc.cc Wed Jul 18 14:28:29 2012 +0900
+@@ -79,6 +79,12 @@
+ GCC_BUILTIN_APPLY(internal,name) \
+ weak_alias(internal, name);
+
++#define NATIVE_EXPLICIT2(name,rtype,...) \
++ rtype name (FULL_ARGS(__VA_ARGS__)) \
++ { \
++ return g_libc.name ## _fn (ARGS(__VA_ARGS__)); \
++ }
++
+
+ // Note: it looks like that the stdio.h header does
+ // not define putc and getc as macros if you include
+diff -r 4c90fdff71a0 model/libc.h
+--- a/model/libc.h Mon Jul 16 13:56:16 2012 +0200
++++ b/model/libc.h Wed Jul 18 14:28:29 2012 +0900
+@@ -13,6 +13,7 @@
+ #define DCET(rtype, name) DCE(name)
+
+ #define DCE_EXPLICIT(name,rtype,...) rtype (*name ## _fn)(__VA_ARGS__);
++#define NATIVE_EXPLICIT2(name,rtype,...) rtype (*name ## _fn)(__VA_ARGS__);
+ #include "libc-ns3.h"
+
+ };
+diff -r 4c90fdff71a0 test/dce-manager-test.cc
+--- a/test/dce-manager-test.cc Mon Jul 16 13:56:16 2012 +0200
++++ b/test/dce-manager-test.cc Wed Jul 18 14:28:29 2012 +0900
+@@ -156,7 +156,9 @@
+ { "test-netdb", 3600, "", true },
+ { "test-env", 0, "", false },
+ { "test-cond", 0, "", false},
++#ifdef HAVE_SYS_TIMER_H
+ { "test-timer-fd", 0, "", false},
++#endif
+ { "test-stdlib", 0, "", false},
+ { "test-fork", 0, "", false },
+ { "test-select", 3600, "", true },
+diff -r 4c90fdff71a0 test/test-poll.cc
+--- a/test/test-poll.cc Mon Jul 16 13:56:16 2012 +0200
++++ b/test/test-poll.cc Wed Jul 18 14:28:29 2012 +0900
+@@ -1,7 +1,6 @@
+ #include <stdlib.h>
+ #include <sys/time.h>
+ #include <sys/types.h>
+-#include <sys/timerfd.h>
+ #include <unistd.h>
+ #include <pthread.h>
+ #include <stdio.h>
+diff -r 4c90fdff71a0 test/test-select.cc
+--- a/test/test-select.cc Mon Jul 16 13:56:16 2012 +0200
++++ b/test/test-select.cc Wed Jul 18 14:28:29 2012 +0900
+@@ -2,7 +2,9 @@
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #include <sys/select.h>
++#ifdef HAVE_SYS_TIMER_H
+ #include <sys/timerfd.h>
++#endif
+ #include <unistd.h>
+ #include <pthread.h>
+ #include <stdio.h>
+@@ -18,6 +20,7 @@
+ #include "test-macros.h"
+
+ // test, that select () with timeout={0,0} exits immediately
++#ifdef HAVE_SYS_TIMER_H
+ static void
+ test_select_null_null (void)
+ {
+@@ -58,6 +61,7 @@
+
+ close (timerfd);
+ }
++#endif
+
+ static bool
+ test_select_read (int fd, int timeOutSec, bool needSuccess)
+@@ -771,6 +775,7 @@
+ TEST_ASSERT (FD_ISSET (sockfd, &wfds));
+ }
+
++#ifdef HAVE_SYS_TIMER_H
+ // test, that select () returns correctly if there is two fds for reading and only one available
+ // solved with else mustWait=false
+ static void test_select_rfds (void)
+@@ -804,6 +809,7 @@
+ // no fds must be ready and select() should complete without errors
+ TEST_ASSERT_EQUAL (nfds, 1);
+ }
++#endif
+
+ int
+ main (int argc, char *argv[])
+@@ -815,10 +821,14 @@
+ {
+ test_select_stdin ();
+ test_select_stdout_stdin ();
++#ifdef HAVE_SYS_TIMER_H
+ test_select_null_null ();
++#endif
+ test_select_stdout ();
+ test_select_rfds_wfds ();
++#ifdef HAVE_SYS_TIMER_H
+ test_select_rfds ();
++#endif
+ launch (client1, server1);
+ launch (client2, server2);
+ launch (client3, server3);
+diff -r 4c90fdff71a0 wscript
+--- a/wscript Mon Jul 16 13:56:16 2012 +0200
++++ b/wscript Wed Jul 18 14:28:29 2012 +0900
+@@ -37,6 +37,7 @@
+ conf.check(header_name='sys/types.h', define_name='HAVE_SYS_TYPES_H', mandatory=False)
+ conf.check(header_name='sys/stat.h', define_name='HAVE_SYS_STAT_H', mandatory=False)
+ conf.check(header_name='dirent.h', define_name='HAVE_DIRENT_H', mandatory=False)
++ conf.check(header_name='sys/timerfd.h', define_name='HAVE_SYS_TIMER_H', mandatory=False)
+
+ conf.env.prepend_value('LINKFLAGS', '-Wl,--no-as-needed')
+ conf.env.append_value('LINKFLAGS', '-pthread')
+@@ -91,7 +92,9 @@
+
+ if Options.options.kernel_stack is not None and os.path.isdir(Options.options.kernel_stack):
+ conf.check(header_name='sim.h',
+- includes=os.path.join(Options.options.kernel_stack, 'sim/include'))
++ includes=[os.path.join(Options.options.kernel_stack, 'sim/include'),
++ os.path.join(Options.options.kernel_stack, 'net-next-2.6/include')])
++
+ # conf.check()
+ conf.env['KERNEL_STACK'] = Options.options.kernel_stack
+
+@@ -172,7 +175,6 @@
+ ['test-netdb', []],
+ ['test-env', []],
+ ['test-cond', ['PTHREAD']],
+- ['test-timer-fd', []],
+ ['test-stdlib', []],
+ ['test-select', ['PTHREAD']],
+ ['test-random', []],
+@@ -194,6 +196,10 @@
+ ['test-tsearch', []],
+ ['test-signal', []],
+ ]
++
++ if module._bld.env['HAVE_SYS_TIMER_H']:
++ tests = tests + [['test-timer-fd', []]]
++
+ for name,uselib in tests:
+ module.add_test(**dce_kw(target='bin_dce/' + name, source = ['test/' + name + '.cc'],
+ use = uselib + ['lib/test']))
+@@ -201,7 +207,6 @@
+ def build_dce_examples(module):
+ dce_examples = [['udp-server', []],
+ ['udp-client', []],
+- ['udp-perf', ['m']],
+ ['tcp-server', []],
+ ['tcp-client', []],
+ ['tcp-loopback', []],
+@@ -211,6 +216,9 @@
+ ['udp-echo-client', []],
+ # ['little-cout', []],
+ ]
++ if module._bld.env['HAVE_SYS_TIMER_H']:
++ dce_examples = dce_examples + [['udp-perf', ['m']]]
++
+ for name,lib in dce_examples:
+ module.add_example(**dce_kw(target = 'bin_dce/' + name,
+ source = ['example/' + name + '.cc'],
+@@ -359,7 +367,6 @@
+ 'model/dce-string.cc',
+ 'model/dce-env.cc',
+ 'model/dce-pthread-cond.cc',
+- 'model/dce-timerfd.cc',
+ 'model/dce-time.cc',
+ 'model/dce-stat.cc',
+ 'model/dce-syslog.cc',
+@@ -424,6 +431,10 @@
+ 'helper/linux-stack-helper.h',
+ 'helper/ipv4-dce-routing-helper.h',
+ ]
++
++ if bld.env['HAVE_SYS_TIMER_H']:
++ module_source = module_source + ['model/dce-timerfd.cc']
++
+ module_source = module_source + kernel_source
+ module_headers = module_headers + kernel_headers
+ uselib = ns3waf.modules_uselib(bld, ['core', 'network', 'internet', 'netlink'])