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/dce-tcp-simple.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main (int argc, char *argv[])
apps = dce.Install (nodes.Get (0));
apps.Start (Seconds (4.0));

Simulator::Stop (Seconds (1000100.0));
Simulator::Stop (Seconds (60.0));
Simulator::Run ();
Simulator::Destroy ();

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
1 change: 1 addition & 0 deletions example/tcp-loopback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <pthread.h>
#include <iostream>

#define SERVER_PORT 2000
Expand Down
1 change: 1 addition & 0 deletions example/unix-client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <stdio.h>
#include <errno.h>
#include <sys/un.h>
#include <ctime>

#define SOCK_PATH "/tmp/socket"
#define BUF_LEN 128 * 1024 + 255
Expand Down
1 change: 1 addition & 0 deletions example/unix-server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <sys/un.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <ctime>

#define SOCK_PATH "/tmp/socket"
#define BUF_LEN 256
Expand Down
17 changes: 10 additions & 7 deletions helper/dce-manager-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ TypeId
DceManagerHelper::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::DceManagerHelper")
.SetParent<ObjectBase> ()
.SetParent<Object> ()
.SetGroupName ("Dce")
.AddConstructor<DceManagerHelper> ()
.AddAttribute ("LoaderFactory",
"The kind of loader factory created when Install is called",
StringValue ("ns3::CoojaLoaderFactory[]"),
Expand All @@ -39,22 +41,23 @@ DceManagerHelper::GetTypeId (void)
;
return tid;
}
TypeId
DceManagerHelper::GetInstanceTypeId (void) const
{
return DceManagerHelper::GetTypeId ();
}

DceManagerHelper::DceManagerHelper ()
{
ConstructSelf (AttributeConstructionList ());
m_loaderFactory.SetTypeId ("ns3::CoojaLoaderFactory");
m_taskManagerFactory.SetTypeId ("ns3::TaskManager");
m_schedulerFactory.SetTypeId ("ns3::RrTaskScheduler");
m_managerFactory.SetTypeId ("ns3::DceManager");
m_networkStackFactory.SetTypeId ("ns3::Ns3SocketFdFactory");
m_delayFactory.SetTypeId ("ns3::RandomProcessDelayModel");
m_virtualPath = "";
}

void
DceManagerHelper::NotifyConstructionCompleted (void)
{
Object::NotifyConstructionCompleted ();
}
void
DceManagerHelper::SetScheduler (std::string type,
std::string n0, const AttributeValue &v0,
Expand Down
3 changes: 2 additions & 1 deletion helper/dce-manager-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ class DceManagerHelper : public Object
{
public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;

/**
* Construct a DceManagerHelper
*/
DceManagerHelper ();

void NotifyConstructionCompleted (void) override;

/**
* \param type the name of the TaskScheduler to set
* \param n0 the name of the attribute to set to the TaskScheduler
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
7 changes: 1 addition & 6 deletions model/dce-node-context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ DceNodeContext::GetTypeId (void)

return tid;
}
TypeId
DceNodeContext::GetInstanceTypeId (void) const
{
return DceNodeContext::GetTypeId ();
}
DceNodeContext::DceNodeContext ()
{
m_randomCtx = CreateObject<NormalRandomVariable> ();
Expand Down Expand Up @@ -79,7 +74,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
1 change: 0 additions & 1 deletion model/dce-node-context.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class DceNodeContext : public Object
{
public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;

DceNodeContext ();
virtual ~DceNodeContext ();
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);
}
Loading