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

(-)a/src/devices/emu/emu-net-device.cc (-45 / +3 lines)
 Lines 399-414    Link Here 
399
      //
399
      //
400
      // Execute the socket creation process image.
400
      // Execute the socket creation process image.
401
      //
401
      //
402
      status = ::execl (FindCreator ("emu-sock-creator").c_str (), 
402
      status = ::execlp ("emu-sock-creator", 
403
                        "emu-sock-creator",                             // argv[0] (filename)
403
                        "emu-sock-creator",                             // argv[0] (filename)
404
                        oss.str ().c_str (),                            // argv[1] (-p<path?
404
                        oss.str ().c_str (),                            // argv[1] (-p<path?
405
                        (char *)NULL);
405
                        (char *)NULL);
406
406
407
      //
407
      //
408
      // If the execl successfully completes, it never returns.  If it returns it failed or the OS is
408
      // If the execlp successfully completes, it never returns.  If it returns it failed or the OS is
409
      // broken.  In either case, we bail.
409
      // broken.  In either case, we bail.
410
      //
410
      //
411
      NS_FATAL_ERROR ("EmuNetDevice::CreateSocket(): Back from execl(), errno = " << ::strerror (errno));
411
      NS_FATAL_ERROR ("EmuNetDevice::CreateSocket(): Back from execlp(), errno = " << ::strerror (errno));
412
    }
412
    }
413
  else
413
  else
414
    {
414
    {
 Lines 536-583    Link Here 
536
    }
536
    }
537
}
537
}
538
538
539
std::string
540
EmuNetDevice::FindCreator (std::string creatorName)
541
{
542
  NS_LOG_FUNCTION (creatorName);
543
544
  std::list<std::string> locations;
545
546
  // The path to the bits if we're sitting there with them
547
  locations.push_back ("./");
548
  locations.push_back ("./");
549
550
  // The path to the bits if we're sitting in the root of the repo
551
  locations.push_back ("./build/optimized/src/devices/emu/");
552
  locations.push_back ("./build/debug/src/devices/emu/");
553
554
  // if at the level of src (or build)
555
  locations.push_back ("../build/optimized/src/devices/emu/");
556
  locations.push_back ("../build/debug/src/devices/emu/");
557
558
  // src/devices (or build/debug)
559
  locations.push_back ("../../build/optimized/src/devices/emu/");
560
  locations.push_back ("../../build/debug/src/devices/emu/");
561
562
  // src/devices/emu (or build/debug/examples)
563
  locations.push_back ("../../../build/optimized/src/devices/emu/");
564
  locations.push_back ("../../../build/debug/src/devices/emu/");
565
566
  for (std::list<std::string>::const_iterator i = locations.begin (); i != locations.end (); ++i)
567
    {
568
      struct stat st;
569
570
      if (::stat ((*i + creatorName).c_str (), &st) == 0)
571
	{
572
          NS_LOG_INFO ("Found Creator " << *i + creatorName);                  
573
	  return *i + creatorName;
574
	}
575
    }
576
577
  NS_FATAL_ERROR ("EmuNetDevice::FindCreator(): Couldn't find creator");
578
  return ""; // quiet compiler
579
}
580
581
void
539
void
582
EmuNetDevice::StopDevice (void)
540
EmuNetDevice::StopDevice (void)
583
{
541
{
(-)a/src/devices/emu/emu-net-device.h (-5 lines)
 Lines 188-198    Link Here 
188
  void CreateSocket (void);
188
  void CreateSocket (void);
189
189
190
  /**
190
  /**
191
   * Figure out where the raw socket creation process lives on the system.
192
   */
193
  std::string FindCreator (std::string creatorName);
194
195
  /**
196
   * Get a copy of the attached Queue.
191
   * Get a copy of the attached Queue.
197
   *
192
   *
198
   * This method is provided for any derived class that may need to get
193
   * This method is provided for any derived class that may need to get
(-)a/src/devices/emu/wscript (+4 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 38-41    Link Here 
38
            'emu-encode-decode.cc',
40
            'emu-encode-decode.cc',
39
            ]
41
            ]
40
42
43
        emucreatordir = os.path.abspath(os.path.join(bld.bdir, env.variant(), "src/devices/emu"))
44
        env.append_value('PATH', emucreatordir)
41
45
(-)a/src/devices/tap-bridge/tap-bridge.cc (-42 / +4 lines)
 Lines 432-439    Link Here 
432
      //
432
      //
433
      // Execute the socket creation process image.
433
      // Execute the socket creation process image.
434
      //
434
      //
435
      status = ::execl (FindCreator ("tap-creator").c_str (), 
435
      status = ::execlp ("tap-creator", 
436
                        FindCreator ("tap-creator").c_str (), // argv[0] (filename)
436
                        "tap-creator",                        // argv[0] (filename)
437
                        ossDeviceName.str ().c_str (),        // argv[1] (-d<device name>)
437
                        ossDeviceName.str ().c_str (),        // argv[1] (-d<device name>)
438
                        ossGateway.str ().c_str (),           // argv[2] (-g<gateway>)
438
                        ossGateway.str ().c_str (),           // argv[2] (-g<gateway>)
439
                        ossIp.str ().c_str (),                // argv[3] (-i<IP address>)
439
                        ossIp.str ().c_str (),                // argv[3] (-i<IP address>)
 Lines 444-453    Link Here 
444
                        (char *)NULL);
444
                        (char *)NULL);
445
445
446
      //
446
      //
447
      // If the execl successfully completes, it never returns.  If it returns it failed or the OS is
447
      // If the execlp successfully completes, it never returns.  If it returns it failed or the OS is
448
      // broken.  In either case, we bail.
448
      // broken.  In either case, we bail.
449
      //
449
      //
450
      NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execl(), errno = " << ::strerror (errno));
450
      NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execlp(), errno = " << ::strerror (errno));
451
    }
451
    }
452
  else
452
  else
453
    {
453
    {
 Lines 569-612    Link Here 
569
    }
569
    }
570
}
570
}
571
571
572
std::string
573
TapBridge::FindCreator (std::string creatorName)
574
{
575
  NS_LOG_FUNCTION (creatorName);
576
577
  std::list<std::string> locations;
578
579
  // The path to the bits if we're sitting in the root of the repo
580
  locations.push_back ("./build/optimized/src/devices/tap-bridge/");
581
  locations.push_back ("./build/debug/src/devices/tap-bridge/");
582
583
  // if in src
584
  locations.push_back ("../build/optimized/src/devices/tap-bridge/");
585
  locations.push_back ("../build/debug/src/devices/tap-bridge/");
586
587
  // if in src/devices
588
  locations.push_back ("../../build/optimized/src/devices/tap-bridge/");
589
  locations.push_back ("../../build/debug/src/devices/tap-bridge/");
590
591
  // if in src/devices/tap-bridge
592
  locations.push_back ("../../../build/optimized/src/devices/tap-bridge/");
593
  locations.push_back ("../../../build/debug/src/devices/tap-bridge/");
594
595
  for (std::list<std::string>::const_iterator i = locations.begin (); i != locations.end (); ++i)
596
    {
597
      struct stat st;
598
599
      if (::stat ((*i + creatorName).c_str (), &st) == 0)
600
	{
601
          NS_LOG_INFO ("Found Creator " << *i + creatorName);                  
602
	  return *i + creatorName;
603
	}
604
    }
605
606
  NS_FATAL_ERROR ("TapBridge::FindCreator(): Couldn't find creator");
607
  return ""; // quiet compiler
608
}
609
610
void
572
void
611
TapBridge::ReadThread (void)
573
TapBridge::ReadThread (void)
612
{
574
{
(-)a/src/devices/tap-bridge/tap-bridge.h (-10 lines)
 Lines 233-248    Link Here 
233
  /**
233
  /**
234
   * \internal
234
   * \internal
235
   *
235
   *
236
   * Figure out where the tap creation program lives on the system.
237
   *
238
   * \param creatorName The name of the program used to create the Tap.
239
   * \returns A path name to use when you want to create a Tap.
240
   */
241
  std::string FindCreator (std::string creatorName);
242
243
  /**
244
   * \internal
245
   *
246
   * Spin up the device
236
   * Spin up the device
247
   */
237
   */
248
  void StartTapDevice (void);
238
  void StartTapDevice (void);
(-)a/src/devices/tap-bridge/wscript (+4 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 40-43    Link Here 
40
                'tap-encode-decode.cc',
42
                'tap-encode-decode.cc',
41
                ]
43
                ]
42
44
45
        tapcreatordir = os.path.abspath(os.path.join(bld.bdir, env.variant(), "src/devices/tap-bridge"))
46
        env.append_value('PATH', tapcreatordir)
43
47
(-)a/wutils.py (+2 lines)
 Lines 112-117    Link Here 
112
    else:
112
    else:
113
        proc_env['PYTHONPATH'] = pymoddir
113
        proc_env['PYTHONPATH'] = pymoddir
114
114
115
    proc_env['PATH'] = os.pathsep.join(list(env['PATH']) + [proc_env['PATH']])
116
115
    return proc_env
117
    return proc_env
116
118
117
def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False):
119
def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False):

Return to bug 720