diff --git a/src/core/model/system-path.cc b/src/core/model/system-path.cc index e2209cc39..37a1213b1 100644 --- a/src/core/model/system-path.cc +++ b/src/core/model/system-path.cc @@ -20,6 +20,11 @@ #include #endif /* __APPLE__ */ +#ifdef __FreeBSD__ +#include +#include +#endif + #if defined (__win32__) #define SYSTEM_PATH_SEP "\\" @@ -110,6 +115,20 @@ std::string FindSelfDirectory (void) 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); } diff --git a/src/internet/model/ipv4-raw-socket-impl.cc b/src/internet/model/ipv4-raw-socket-impl.cc index dda5e1e6f..bcc26e8be 100644 --- a/src/internet/model/ipv4-raw-socket-impl.cc +++ b/src/internet/model/ipv4-raw-socket-impl.cc @@ -1,5 +1,7 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ #include +#include +#include #include "ipv4-raw-socket-impl.h" #include "ipv4-l3-protocol.h" #include "icmpv4.h" diff --git a/src/internet/model/ipv6-raw-socket-impl.cc b/src/internet/model/ipv6-raw-socket-impl.cc index 5e5367c36..9d519e89d 100644 --- a/src/internet/model/ipv6-raw-socket-impl.cc +++ b/src/internet/model/ipv6-raw-socket-impl.cc @@ -19,6 +19,8 @@ */ #include +#include +#include #include "ns3/inet6-socket-address.h" #include "ns3/node.h" #include "ns3/packet.h" diff --git a/src/internet/test/ipv4-raw-test.cc b/src/internet/test/ipv4-raw-test.cc index d9ddb3a48..ed8e999ee 100644 --- a/src/internet/test/ipv4-raw-test.cc +++ b/src/internet/test/ipv4-raw-test.cc @@ -44,6 +44,8 @@ #include #include #include +#include +#include namespace ns3 { static void diff --git a/src/lte/model/amc-module.cc b/src/lte/model/amc-module.cc index 6d756de5c..828ba2684 100644 --- a/src/lte/model/amc-module.cc +++ b/src/lte/model/amc-module.cc @@ -23,6 +23,10 @@ #include #include +#ifdef __FreeBSD__ +#define log2(x) (log(x)/M_LN2) +#endif + NS_LOG_COMPONENT_DEFINE ("AmcModule"); namespace ns3 { diff --git a/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc b/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc index b1e8eba30..36f316f87 100644 --- a/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc +++ b/src/spectrum/examples/adhoc-aloha-ideal-phy-matrix-propagation-loss-model.cc @@ -40,6 +40,10 @@ #include #include +#ifdef __FreeBSD__ +#define log2(x) (log(x)/M_LN2) +#endif + NS_LOG_COMPONENT_DEFINE ("TestAdhocOfdmAloha"); using namespace ns3; diff --git a/src/spectrum/model/spectrum-value.cc b/src/spectrum/model/spectrum-value.cc index 7edea361f..88fc136b0 100644 --- a/src/spectrum/model/spectrum-value.cc +++ b/src/spectrum/model/spectrum-value.cc @@ -23,6 +23,9 @@ #include #include +#ifdef __FreeBSD__ +#define log2(x) (log(x)/M_LN2) +#endif NS_LOG_COMPONENT_DEFINE ("SpectrumValue"); diff --git a/src/spectrum/test/spectrum-ideal-phy-test.cc b/src/spectrum/test/spectrum-ideal-phy-test.cc index 3429dbe50..b6e2e0576 100644 --- a/src/spectrum/test/spectrum-ideal-phy-test.cc +++ b/src/spectrum/test/spectrum-ideal-phy-test.cc @@ -49,6 +49,10 @@ #include #include +#ifdef __FreeBSD__ +#define log2(x) (log(x)/M_LN2) +#endif + NS_LOG_COMPONENT_DEFINE ("SpectrumIdealPhyTest"); namespace ns3 {