--- a/src/core/model/system-path.cc Fri Sep 16 11:22:52 2011 -0400
+++ b/src/core/model/system-path.cc Fri Sep 16 13:45:52 2011 -0700
@@ -20,6 +20,11 @@
#include <mach-o/dyld.h>
#endif /* __APPLE__ */
+#ifdef __FreeBSD__
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
+
#if defined (__win32__)
#define SYSTEM_PATH_SEP "\\"
@@ -110,6 +115,20 @@
filename = buffer;
free (buffer);
}
+#elif defined (__FreeBSD__)
+ {
+ int mib[4];
+ size_t bufSize = 1024;
+ char *buf = (char *) malloc(bufSize);
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PATHNAME;
+ mib[3] = -1;
+
+ sysctl(mib, 4, buf, &bufSize, NULL, 0);
+ filename = buf;
+ }
#endif
return Dirname (filename);
}
--- a/src/internet/model/ipv4-raw-socket-impl.cc Fri Sep 16 11:22:52 2011 -0400
+++ b/src/internet/model/ipv4-raw-socket-impl.cc Fri Sep 16 13:45:52 2011 -0700
@@ -1,5 +1,7 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
#include "ipv4-raw-socket-impl.h"
#include "ipv4-l3-protocol.h"
#include "icmpv4.h"
--- a/src/internet/model/ipv6-raw-socket-impl.cc Fri Sep 16 11:22:52 2011 -0400
+++ b/src/internet/model/ipv6-raw-socket-impl.cc Fri Sep 16 13:45:52 2011 -0700
@@ -19,6 +19,8 @@
*/
#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
#include "ns3/inet6-socket-address.h"
#include "ns3/node.h"
#include "ns3/packet.h"
--- a/src/internet/test/ipv4-raw-test.cc Fri Sep 16 11:22:52 2011 -0400
+++ b/src/internet/test/ipv4-raw-test.cc Fri Sep 16 13:45:52 2011 -0700
@@ -44,6 +44,8 @@
#include <string>
#include <limits>
#include <netinet/in.h>
+#include <sys/socket.h>
+#include <sys/types.h>
namespace ns3 {
static void
--- a/src/lte/model/amc-module.cc Fri Sep 16 11:22:52 2011 -0400
+++ b/src/lte/model/amc-module.cc Fri Sep 16 13:45:52 2011 -0700
@@ -23,6 +23,10 @@
#include <ns3/log.h>
#include <math.h>
+#ifdef __FreeBSD__
+#define log2(x) (log(x)/M_LN2)
+#endif
+
NS_LOG_COMPONENT_DEFINE ("AmcModule");
namespace ns3 {
--- a/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc Fri Sep 16 11:22:52 2011 -0400
+++ b/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc Fri Sep 16 13:45:52 2011 -0700
@@ -40,6 +40,10 @@
#include <ns3/applications-module.h>
#include <ns3/adhoc-aloha-noack-ideal-phy-helper.h>
+#ifdef __FreeBSD__
+#define log2(x) (log(x)/M_LN2)
+#endif
+
NS_LOG_COMPONENT_DEFINE ("TestAdhocOfdmAloha");
using namespace ns3;
--- a/src/spectrum/model/spectrum-value.cc Fri Sep 16 11:22:52 2011 -0400
+++ b/src/spectrum/model/spectrum-value.cc Fri Sep 16 13:45:52 2011 -0700
@@ -23,6 +23,9 @@
#include <math.h>
#include <ns3/log.h>
+#ifdef __FreeBSD__
+#define log2(x) (log(x)/M_LN2)
+#endif
NS_LOG_COMPONENT_DEFINE ("SpectrumValue");
--- a/src/spectrum/test/spectrum-ideal-phy-test.cc Fri Sep 16 11:22:52 2011 -0400
+++ b/src/spectrum/test/spectrum-ideal-phy-test.cc Fri Sep 16 13:45:52 2011 -0700
@@ -49,6 +49,10 @@
#include <ns3/on-off-helper.h>
#include <ns3/config.h>
+#ifdef __FreeBSD__
+#define log2(x) (log(x)/M_LN2)
+#endif
+
NS_LOG_COMPONENT_DEFINE ("SpectrumIdealPhyTest");
namespace ns3 {