View | Details | Raw Unified | Return to bug 720
Collapse All | Expand All

(-)a/wscript (-3 / +6 lines)
 Lines 697-708    Link Here 
697
                        self.bld.env, proc_env, force_no_valgrind=True)
697
                        self.bld.env, proc_env, force_no_valgrind=True)
698
698
699
def check_shell(bld):
699
def check_shell(bld):
700
    if 'NS3_MODULE_PATH' not in os.environ:
700
    if ('NS3_MODULE_PATH' not in os.environ) or ('NS3_EXECUTABLE_PATH' not in os.environ):
701
        return
701
        return
702
    env = bld.env
702
    env = bld.env
703
    correct_modpath = os.pathsep.join(env['NS3_MODULE_PATH'])
703
    correct_modpath = os.pathsep.join(env['NS3_MODULE_PATH'])
704
    found_modpath = os.environ['NS3_MODULE_PATH']
704
    found_modpath = os.environ['NS3_MODULE_PATH']
705
    if found_modpath != correct_modpath:
705
    correct_execpath = os.pathsep.join(env['NS3_EXECUTABLE_PATH'])
706
    found_execpath = os.environ['NS3_EXECUTABLE_PATH']
707
    if (found_modpath != correct_modpath) or (correct_execpath != found_execpath):
706
        msg = ("Detected shell (./waf shell) with incorrect configuration\n"
708
        msg = ("Detected shell (./waf shell) with incorrect configuration\n"
707
               "=========================================================\n"
709
               "=========================================================\n"
708
               "Possible reasons for this problem:\n"
710
               "Possible reasons for this problem:\n"
 Lines 728-734    Link Here 
728
        shell = os.environ.get("SHELL", "/bin/sh")
730
        shell = os.environ.get("SHELL", "/bin/sh")
729
731
730
    env = wutils.bld.env
732
    env = wutils.bld.env
731
    wutils.run_argv([shell], env, {'NS3_MODULE_PATH': os.pathsep.join(env['NS3_MODULE_PATH'])})
733
    os_env = {'NS3_MODULE_PATH': os.pathsep.join(env['NS3_MODULE_PATH']), 'NS3_EXECUTABLE_PATH': os.pathsep.join(env['NS3_EXECUTABLE_PATH'])}
734
    wutils.run_argv([shell], env, os_env)
732
735
733
def _doxygen(bld):
736
def _doxygen(bld):
734
    env = wutils.bld.env
737
    env = wutils.bld.env
(-)a/wutils.py (+5 lines)
 Lines 112-117    Link Here 
112
    else:
112
    else:
113
        proc_env['PYTHONPATH'] = pymoddir
113
        proc_env['PYTHONPATH'] = pymoddir
114
114
115
    if 'PATH' in proc_env:
116
        proc_env['PATH'] = os.pathsep.join(list(env['NS3_EXECUTABLE_PATH']) + [proc_env['PATH']])
117
    else:
118
        proc_env['PATH'] = os.pathsep.join(list(env['NS3_EXECUTABLE_PATH']))
119
115
    return proc_env
120
    return proc_env
116
121
117
def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False):
122
def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False):
(-)a/src/devices/emu/emu-net-device.cc (-49 / +3 lines)
 Lines 444-459    Link Here 
444
      //
444
      //
445
      // Execute the socket creation process image.
445
      // Execute the socket creation process image.
446
      //
446
      //
447
      status = ::execl (FindCreator ("emu-sock-creator").c_str (), 
447
      status = ::execlp ("emu-sock-creator", 
448
                        "emu-sock-creator",                             // argv[0] (filename)
448
                        "emu-sock-creator",                             // argv[0] (filename)
449
                        oss.str ().c_str (),                            // argv[1] (-p<path?
449
                        oss.str ().c_str (),                            // argv[1] (-p<path?
450
                        (char *)NULL);
450
                        (char *)NULL);
451
451
452
      //
452
      //
453
      // If the execl successfully completes, it never returns.  If it returns it failed or the OS is
453
      // If the execlp successfully completes, it never returns.  If it returns it failed or the OS is
454
      // broken.  In either case, we bail.
454
      // broken.  In either case, we bail.
455
      //
455
      //
456
      NS_FATAL_ERROR ("EmuNetDevice::CreateSocket(): Back from execl(), errno = " << ::strerror (errno));
456
      NS_FATAL_ERROR ("EmuNetDevice::CreateSocket(): Back from execlp(), errno = " << ::strerror (errno));
457
    }
457
    }
458
  else
458
  else
459
    {
459
    {
 Lines 581-632    Link Here 
581
    }
581
    }
582
}
582
}
583
583
584
std::string
585
EmuNetDevice::FindCreator (std::string creatorName)
586
{
587
  NS_LOG_FUNCTION (creatorName);
588
589
  std::list<std::string> locations;
590
591
  // The path to the bits if we're sitting there with them
592
  locations.push_back ("./");
593
  locations.push_back ("./");
594
595
  // The path to the bits if we're sitting in the root of the repo
596
  locations.push_back ("./build/optimized/src/devices/emu/");
597
  locations.push_back ("./build/debug/src/devices/emu/");
598
599
  // if at the level of src (or build)
600
  locations.push_back ("../build/optimized/src/devices/emu/");
601
  locations.push_back ("../build/debug/src/devices/emu/");
602
603
  // src/devices (or build/debug)
604
  locations.push_back ("../../build/optimized/src/devices/emu/");
605
  locations.push_back ("../../build/debug/src/devices/emu/");
606
607
  // src/devices/emu (or build/debug/examples)
608
  locations.push_back ("../../../build/optimized/src/devices/emu/");
609
  locations.push_back ("../../../build/debug/src/devices/emu/");
610
611
  // src/devices/emu (or build/debug/examples/emulation)
612
  locations.push_back ("../../../../build/optimized/src/devices/emu/");
613
  locations.push_back ("../../../../build/debug/src/devices/emu/");
614
615
  for (std::list<std::string>::const_iterator i = locations.begin (); i != locations.end (); ++i)
616
    {
617
      struct stat st;
618
619
      if (::stat ((*i + creatorName).c_str (), &st) == 0)
620
	{
621
          NS_LOG_INFO ("Found Creator " << *i + creatorName);                  
622
	  return *i + creatorName;
623
	}
624
    }
625
626
  NS_FATAL_ERROR ("EmuNetDevice::FindCreator(): Couldn't find creator");
627
  return ""; // quiet compiler
628
}
629
630
void
584
void
631
EmuNetDevice::StopDevice (void)
585
EmuNetDevice::StopDevice (void)
632
{
586
{
(-)a/src/devices/emu/emu-net-device.h (-5 lines)
 Lines 214-224    Link Here 
214
  void CreateSocket (void);
214
  void CreateSocket (void);
215
215
216
  /**
216
  /**
217
   * Figure out where the raw socket creation process lives on the system.
218
   */
219
  std::string FindCreator (std::string creatorName);
220
221
  /**
222
   * Get a copy of the attached Queue.
217
   * Get a copy of the attached Queue.
223
   *
218
   *
224
   * This method is provided for any derived class that may need to get
219
   * This method is provided for any derived class that may need to get
(-)a/src/devices/emu/wscript (+7 lines)
 Lines 1-5    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
import os.path
4
3
def configure(conf):
5
def configure(conf):
4
    if conf.env['ENABLE_THREADING']:
6
    if conf.env['ENABLE_THREADING']:
5
        conf.env['ENABLE_EMU'] = conf.check(header_name='netpacket/packet.h',
7
        conf.env['ENABLE_EMU'] = conf.check(header_name='netpacket/packet.h',
 Lines 12-17    Link Here 
12
                                     False,
14
                                     False,
13
                                     "needs threading support which is not available")
15
                                     "needs threading support which is not available")
14
16
17
    if conf.env['ENABLE_EMU']:
18
        blddir = os.path.abspath(os.path.join(conf.blddir, conf.env.variant()))
19
        emucreatordir = os.path.abspath(os.path.join(blddir, "src/devices/emu"))
20
        conf.env.append_value('NS3_EXECUTABLE_PATH', emucreatordir)
21
15
def build(bld):
22
def build(bld):
16
    module = bld.create_ns3_module('emu', ['node'])
23
    module = bld.create_ns3_module('emu', ['node'])
17
    module.source = [
24
    module.source = [
(-)a/src/devices/tap-bridge/tap-bridge.cc (-42 / +4 lines)
 Lines 477-484    Link Here 
477
      //
477
      //
478
      // Execute the socket creation process image.
478
      // Execute the socket creation process image.
479
      //
479
      //
480
      status = ::execl (FindCreator ("tap-creator").c_str (), 
480
      status = ::execlp ("tap-creator", 
481
                        FindCreator ("tap-creator").c_str (), // argv[0] (filename)
481
                        "tap-creator",                        // argv[0] (filename)
482
                        ossDeviceName.str ().c_str (),        // argv[1] (-d<device name>)
482
                        ossDeviceName.str ().c_str (),        // argv[1] (-d<device name>)
483
                        ossGateway.str ().c_str (),           // argv[2] (-g<gateway>)
483
                        ossGateway.str ().c_str (),           // argv[2] (-g<gateway>)
484
                        ossIp.str ().c_str (),                // argv[3] (-i<IP address>)
484
                        ossIp.str ().c_str (),                // argv[3] (-i<IP address>)
 Lines 489-498    Link Here 
489
                        (char *)NULL);
489
                        (char *)NULL);
490
490
491
      //
491
      //
492
      // If the execl successfully completes, it never returns.  If it returns it failed or the OS is
492
      // If the execlp successfully completes, it never returns.  If it returns it failed or the OS is
493
      // broken.  In either case, we bail.
493
      // broken.  In either case, we bail.
494
      //
494
      //
495
      NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execl(), errno = " << ::strerror (errno));
495
      NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execlp(), errno = " << ::strerror (errno));
496
    }
496
    }
497
  else
497
  else
498
    {
498
    {
 Lines 614-657    Link Here 
614
    }
614
    }
615
}
615
}
616
616
617
std::string
618
TapBridge::FindCreator (std::string creatorName)
619
{
620
  NS_LOG_FUNCTION (creatorName);
621
622
  std::list<std::string> locations;
623
624
  // The path to the bits if we're sitting in the root of the repo
625
  locations.push_back ("./build/optimized/src/devices/tap-bridge/");
626
  locations.push_back ("./build/debug/src/devices/tap-bridge/");
627
628
  // if in src
629
  locations.push_back ("../build/optimized/src/devices/tap-bridge/");
630
  locations.push_back ("../build/debug/src/devices/tap-bridge/");
631
632
  // if in src/devices
633
  locations.push_back ("../../build/optimized/src/devices/tap-bridge/");
634
  locations.push_back ("../../build/debug/src/devices/tap-bridge/");
635
636
  // if in src/devices/tap-bridge
637
  locations.push_back ("../../../build/optimized/src/devices/tap-bridge/");
638
  locations.push_back ("../../../build/debug/src/devices/tap-bridge/");
639
640
  for (std::list<std::string>::const_iterator i = locations.begin (); i != locations.end (); ++i)
641
    {
642
      struct stat st;
643
644
      if (::stat ((*i + creatorName).c_str (), &st) == 0)
645
	{
646
          NS_LOG_INFO ("Found Creator " << *i + creatorName);                  
647
	  return *i + creatorName;
648
	}
649
    }
650
651
  NS_FATAL_ERROR ("TapBridge::FindCreator(): Couldn't find creator");
652
  return ""; // quiet compiler
653
}
654
655
void
617
void
656
TapBridge::ReadThread (void)
618
TapBridge::ReadThread (void)
657
{
619
{
(-)a/src/devices/tap-bridge/tap-bridge.h (-10 lines)
 Lines 234-249    Link Here 
234
  /**
234
  /**
235
   * \internal
235
   * \internal
236
   *
236
   *
237
   * Figure out where the tap creation program lives on the system.
238
   *
239
   * \param creatorName The name of the program used to create the Tap.
240
   * \returns A path name to use when you want to create a Tap.
241
   */
242
  std::string FindCreator (std::string creatorName);
243
244
  /**
245
   * \internal
246
   *
247
   * Spin up the device
237
   * Spin up the device
248
   */
238
   */
249
  void StartTapDevice (void);
239
  void StartTapDevice (void);
(-)a/src/devices/tap-bridge/wscript (+7 lines)
 Lines 1-5    Link Here 
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
1
## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
2
3
import os.path
4
3
def configure(conf):
5
def configure(conf):
4
    if conf.env['ENABLE_THREADING']:
6
    if conf.env['ENABLE_THREADING']:
5
        conf.env['ENABLE_TAP'] = conf.check(header_name='linux/if_tun.h',
7
        conf.env['ENABLE_TAP'] = conf.check(header_name='linux/if_tun.h',
 Lines 12-17    Link Here 
12
                                     False,
14
                                     False,
13
                                     "needs threading support which is not available")
15
                                     "needs threading support which is not available")
14
16
17
    if conf.env['ENABLE_TAP']:
18
        blddir = os.path.abspath(os.path.join(conf.blddir, conf.env.variant()))
19
        tapcreatordir = os.path.abspath(os.path.join(blddir, "src/devices/tap-bridge"))
20
        conf.env.append_value('NS3_EXECUTABLE_PATH', tapcreatordir)
21
15
def build(bld):
22
def build(bld):
16
    module = bld.create_ns3_module('tap-bridge', ['node'])
23
    module = bld.create_ns3_module('tap-bridge', ['node'])
17
    module.source = [
24
    module.source = [

Return to bug 720