Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/python/genbinds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys
import os, errno
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ int main ()
return

gccxml_version_line = os.popen(gccxml[0] + " --version").readline().strip()
m = re.match( "^GCC-XML version (\d\.\d(\.\d)?)$", gccxml_version_line)
m = re.match(r'^GCC-XML version (\d\.\d(\.\d)?)$', gccxml_version_line)
gccxml_version = m.group(1)
gccxml_version_ok = ([int(s) for s in gccxml_version.split('.')] >= [0, 9])
conf.msg('Checking for gccxml version', gccxml_version)
Expand Down
2 changes: 1 addition & 1 deletion example/examples-to-run.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-

# A list of C++ examples to run in order to ensure that they remain
Expand Down
2 changes: 1 addition & 1 deletion model/dce-application.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ DceApplication::StartApplication (void)

Ptr<Node> node = GetNode ();
Ptr<DceManager> manager = node->GetObject<DceManager> ();
if (manager == 0)
if (!manager)
{
NS_FATAL_ERROR ("You forgot to aggregate a DceManager to node=" << node->GetId ());
}
Expand Down
48 changes: 45 additions & 3 deletions model/dce-at.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NS_LOG_COMPONENT_DEFINE ("DceAt");

using namespace ns3;

int dce___fxstatat (int ver, int fd, const char *pathname, struct stat *buf, int flag)
int dce_fstatat (int fd, const char *pathname, struct stat *buf, int flag)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << pathname << buf);
Expand All @@ -58,12 +58,12 @@ int dce___fxstatat (int ver, int fd, const char *pathname, struct stat *buf, int
current->err = EBADF;
return -1;
}
retval = ::__fxstatat (ver, realFd, pathname, buf, flag);
retval = ::fstatat (realFd, pathname, buf, flag);
}
else
{
std::string path = UtilsGetCurrentDirName () + "/" + UtilsGetRealFilePath (pathname);
retval = ::__fxstatat (ver, fd, path.c_str (), buf, flag);
retval = ::fstatat (fd, path.c_str (), buf, flag);
}
if (retval == -1)
{
Expand All @@ -72,6 +72,48 @@ int dce___fxstatat (int ver, int fd, const char *pathname, struct stat *buf, int
}
return retval;
}

int dce_fstatat64(int dirfd, const char * path, struct stat64 * stat_buf, int flags)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << path << stat_buf);
NS_ASSERT (current != 0);
int retval = -1;

if ((0 == path) || (0 == stat_buf))
{
current->err = EFAULT;
return -1;
}
if (std::string (path) == "")
{
current->err = ENOENT;
return -1;
}
if (dirfd != AT_FDCWD && path[0] != '/')
{
int realFd = getRealFd (dirfd, current);

if (realFd < 0)
{
current->err = EBADF;
return -1;
}
retval = ::fstatat64 (realFd, path, stat_buf, flags);
}
else
{
std::string path = UtilsGetCurrentDirName () + "/" + UtilsGetRealFilePath (path);
retval = ::fstatat64 (dirfd, path.c_str (), stat_buf, flags);
}
if (retval == -1)
{
current->err = errno;
return -1;
}
return retval;
}

void unlink_notify (std::string fullpath);
int dce_unlinkat (int fd, const char *pathname, int flags)
{
Expand Down
4 changes: 2 additions & 2 deletions model/dce-fd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,12 @@ void unlink_notify (std::string fullpath)

Ptr<SocketFdFactory> factory = Current ()->process->manager->GetObject<LocalSocketFdFactory> ();

if (0 != factory)
if (factory)
{
factory->UnlinkNotify (fullpath);
}
factory = Current ()->process->manager->GetObject<SocketFdFactory> ();
if (0 != factory)
if (factory)
{
factory->UnlinkNotify (fullpath);
}
Expand Down
2 changes: 1 addition & 1 deletion model/dce-misc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ NS_LOG_COMPONENT_DEFINE ("DceMisc");
int dce_uname (struct utsname *buf)
{
Ptr<DceNodeContext> nodeContext = DceNodeContext::GetNodeContext ();
NS_ASSERT (0 != nodeContext);
NS_ASSERT (nodeContext);

return nodeContext->UName (buf);
}
Expand Down
2 changes: 1 addition & 1 deletion model/dce-node-context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ DceNodeContext::UName (struct utsname *buf)
{
uint32_t nodeId = UtilsGetNodeId ();
Ptr<Node> node = NodeList::GetNode (nodeId);
NS_ASSERT (node != 0);
NS_ASSERT (node);
std::string nodeName = Names::FindName (node);
std::ostringstream oss;

Expand Down
33 changes: 12 additions & 21 deletions model/dce-stat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace ns3;

NS_LOG_COMPONENT_DEFINE ("DceStat");

int dce___xstat (int ver, const char *path, struct stat *buf)
int dce_stat (const char *path, struct stat *buf)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << path << buf);
Expand All @@ -22,15 +22,15 @@ int dce___xstat (int ver, const char *path, struct stat *buf)
current->err = ENOENT;
return -1;
}
int retval = ::__xstat (ver, UtilsGetRealFilePath (path).c_str (), buf);
int retval = ::stat (UtilsGetRealFilePath (path).c_str (), buf);
if (retval == -1)
{
current->err = errno;
return -1;
}
return retval;
}
int dce___xstat64 (int ver, const char *path, struct stat64 *buf)
int dce_stat64 (const char *path, struct stat64 *buf)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << path << buf);
Expand All @@ -40,31 +40,31 @@ int dce___xstat64 (int ver, const char *path, struct stat64 *buf)
current->err = ENOENT;
return -1;
}
int retval = ::__xstat64 (ver, UtilsGetRealFilePath (path).c_str (), buf);
int retval = ::stat64 (UtilsGetRealFilePath (path).c_str (), buf);
if (retval == -1)
{
current->err = errno;
return -1;
}
return retval;
}
int dce___fxstat (int ver, int fd, struct stat *buf)
int dce_fstat (int fd, struct stat *buf)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << fd);
NS_ASSERT (current != 0);

OPENED_FD_METHOD (int, Fxstat (ver, buf))
OPENED_FD_METHOD (int, Fxstat (0, buf))
}
int dce___fxstat64 (int ver, int fd, struct stat64 *buf)
int dce_fstat64 (int fd, struct stat64 *buf)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << fd);
NS_ASSERT (current != 0);

OPENED_FD_METHOD (int, Fxstat64 (ver, buf))
OPENED_FD_METHOD (int, Fxstat64 (0, buf))
}
int dce___lxstat (int ver, const char *pathname, struct stat *buf)
int dce_lstat (const char *pathname, struct stat *buf)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << pathname << buf);
Expand All @@ -74,15 +74,15 @@ int dce___lxstat (int ver, const char *pathname, struct stat *buf)
current->err = ENOENT;
return -1;
}
int retval = ::__lxstat (ver, UtilsGetRealFilePath (pathname).c_str (), buf);
int retval = ::lstat (UtilsGetRealFilePath (pathname).c_str (), buf);
if (retval == -1)
{
current->err = errno;
return -1;
}
return retval;
}
int dce___lxstat64 (int ver, const char *pathname, struct stat64 *buf)
int dce_lstat64 (const char *pathname, struct stat64 *buf)
{
Thread *current = Current ();
NS_LOG_FUNCTION (current << UtilsGetNodeId () << pathname << buf);
Expand All @@ -92,20 +92,11 @@ int dce___lxstat64 (int ver, const char *pathname, struct stat64 *buf)
current->err = ENOENT;
return -1;
}
int retval = ::__lxstat64 (ver, UtilsGetRealFilePath (pathname).c_str (), buf);
int retval = ::lstat64 (UtilsGetRealFilePath (pathname).c_str (), buf);
if (retval == -1)
{
current->err = errno;
return -1;
}
return retval;
}

int dce_fstat (int fd, struct stat *buf)
{
return dce___fxstat (_STAT_VER, fd, buf);
}
int dce_fstat64 (int fd, struct stat64 *buf)
{
return dce___fxstat64 (_STAT_VER, fd, buf);
}
14 changes: 0 additions & 14 deletions model/dce-stdio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -498,27 +498,13 @@ int dce_getchar (void)
return fgetc (*Current ()->process->pstdin);
}

int dce__IO_getc (FILE *stream)
{
NS_LOG_FUNCTION (Current () << UtilsGetNodeId ());
NS_ASSERT (Current () != 0);
return fgetc (stream);
}

int dce_putchar (int __c)
{
NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << (char)__c);
NS_ASSERT (Current () != 0);
return fputc (__c, *Current ()->process->pstdout);
}

int dce__IO_putc (int __c, FILE *__stream)
{
NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << (char)__c);
NS_ASSERT (Current () != 0);
return fputc (__c, __stream);
}

int dce_puts (const char *__s)
{
NS_LOG_FUNCTION (Current () << UtilsGetNodeId () << __s);
Expand Down
3 changes: 3 additions & 0 deletions model/elf-cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ ElfCache::EditBuffer (uint8_t *map, uint32_t selfId) const
cur = dyn;
while (cur->d_tag != DT_NULL)
{
if (cur->d_tag == DT_FLAGS_1) {
cur->d_un.d_val = cur->d_un.d_val & ~DF_1_PIE;
}
if (cur->d_tag == DT_FINI)
{
cur->d_tag = DT_INIT;
Expand Down
4 changes: 2 additions & 2 deletions model/freebsd-socket-fd-factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ FreeBSDSocketFdFactory::NotifyNewAggregate (void)
Ptr<Node> node = this->GetObject<Node> ();
Ptr<LoaderFactory> loaderFactory = this->GetObject<LoaderFactory> ();
Ptr<TaskManager> taskManager = this->GetObject<TaskManager> ();
if (node != 0 && loaderFactory != 0 && taskManager != 0 && m_loader == 0)
if (node && loaderFactory && taskManager && m_loader == 0)
{
m_manager = taskManager;
m_loader = loaderFactory->Create (0, 0, 0);
Expand Down Expand Up @@ -120,7 +120,7 @@ FreeBSDSocketFdFactory::SetTask (std::string path, std::string value)
void
FreeBSDSocketFdFactory::Set (std::string path, std::string value)
{
if (m_manager == 0)
if (!m_manager)
{
m_earlySysfs.push_back (std::make_pair (path,value));
}
Expand Down
24 changes: 18 additions & 6 deletions model/freebsd/ipv4-freebsd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ Ipv4FreeBSD::AddAddress (uint32_t i, Ipv4InterfaceAddress address)
NS_LOG_FUNCTION (this << i << address);
Ptr<Ipv4Interface> interface = GetInterface (i);
bool retVal = interface->AddAddress (address);
if (m_routingProtocol != 0)
if (m_routingProtocol)
{
m_routingProtocol->NotifyAddAddress (i, address);
}
Expand Down Expand Up @@ -341,7 +341,7 @@ Ipv4FreeBSD::RemoveAddress (uint32_t i, uint32_t addressIndex)
Ipv4InterfaceAddress address = interface->RemoveAddress (addressIndex);
if (address != Ipv4InterfaceAddress ())
{
if (m_routingProtocol != 0)
if (m_routingProtocol)
{
m_routingProtocol->NotifyRemoveAddress (i, address);
}
Expand All @@ -364,7 +364,7 @@ Ipv4FreeBSD::RemoveAddress (uint32_t i, Ipv4Address address)
Ipv4InterfaceAddress ifAddr = interface->RemoveAddress (address);
if (ifAddr != Ipv4InterfaceAddress ())
{
if (m_routingProtocol != 0)
if (m_routingProtocol)
{
m_routingProtocol->NotifyRemoveAddress (i, ifAddr);
}
Expand All @@ -388,7 +388,7 @@ Ipv4FreeBSD::SelectSourceAddress (Ptr<const NetDevice> device,
Ipv4InterfaceAddress iaddr;
bool found = false;

if (device != 0)
if (device)
{
int32_t i = GetInterfaceForDevice (device);
NS_ASSERT_MSG (i >= 0, "No device found on node");
Expand Down Expand Up @@ -477,7 +477,7 @@ Ipv4FreeBSD::SetUp (uint32_t i)
Ptr<Ipv4Interface> interface = GetInterface (i);
interface->SetUp ();

if (m_routingProtocol != 0)
if (m_routingProtocol)
{
m_routingProtocol->NotifyInterfaceUp (i);
}
Expand All @@ -490,7 +490,7 @@ Ipv4FreeBSD::SetDown (uint32_t ifaceIndex)
Ptr<Ipv4Interface> interface = GetInterface (ifaceIndex);
interface->SetDown ();

if (m_routingProtocol != 0)
if (m_routingProtocol)
{
m_routingProtocol->NotifyInterfaceDown (ifaceIndex);
}
Expand Down Expand Up @@ -542,6 +542,18 @@ Ipv4FreeBSD::GetWeakEsModel (void) const
return m_weakEsModel;
}

void
Ipv4FreeBSD::SetStrongEndSystemModel(bool model)
{
m_strongEsModel = model;
}

bool
Ipv4FreeBSD::GetStrongEndSystemModel() const
{
return m_strongEsModel;
}

void
Ipv4FreeBSD::InstallNode (Ptr<Node> node)
{
Expand Down
3 changes: 3 additions & 0 deletions model/freebsd/ipv4-freebsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,16 @@ class Ipv4FreeBSD : public Ipv4
virtual bool GetIpForward (void) const;
virtual void SetWeakEsModel (bool model);
virtual bool GetWeakEsModel (void) const;
virtual void SetStrongEndSystemModel(bool model);
virtual bool GetStrongEndSystemModel() const;
uint32_t AddIpv4Interface (Ptr<Ipv4Interface> interface);
Ptr<Ipv4Interface> GetInterface (uint32_t i) const;

typedef std::vector<Ptr<Ipv4Interface> > Ipv4InterfaceList;
Ptr<Ipv4RoutingProtocol> m_routingProtocol;
bool m_ipForward;
bool m_weakEsModel;
bool m_strongEsModel;
Ipv4InterfaceList m_interfaces;
uint64_t m_nanoSec;
};
Expand Down
Loading