# HG changeset patch # User Andrey Mazo # Date 1258469950 -10800 # Node ID d6e986a7b281facf378f66d283a6fc9f09d560cd # Parent f7d0054c0e2ab5a7c7ecba60208e1c6a187956a0 Look for {tap,emu-sock}-creator in $PATH. Prepend $PATH with "build/src/devices/{tap-bridge,emu}". diff -r f7d0054c0e2a -r d6e986a7b281 src/devices/emu/emu-net-device.cc --- a/src/devices/emu/emu-net-device.cc Tue Nov 17 16:57:13 2009 +0300 +++ b/src/devices/emu/emu-net-device.cc Tue Nov 17 17:59:10 2009 +0300 @@ -399,16 +399,16 @@ // // Execute the socket creation process image. // - status = ::execl (FindCreator ("emu-sock-creator").c_str (), + status = ::execlp ("emu-sock-creator", "emu-sock-creator", // argv[0] (filename) oss.str ().c_str (), // argv[1] (-p::const_iterator i = locations.begin (); i != locations.end (); ++i) - { - struct stat st; - - if (::stat ((*i + creatorName).c_str (), &st) == 0) - { - NS_LOG_INFO ("Found Creator " << *i + creatorName); - return *i + creatorName; - } - } - - NS_FATAL_ERROR ("EmuNetDevice::FindCreator(): Couldn't find creator"); - return ""; // quiet compiler -} - void EmuNetDevice::StopDevice (void) { diff -r f7d0054c0e2a -r d6e986a7b281 src/devices/emu/emu-net-device.h --- a/src/devices/emu/emu-net-device.h Tue Nov 17 16:57:13 2009 +0300 +++ b/src/devices/emu/emu-net-device.h Tue Nov 17 17:59:10 2009 +0300 @@ -188,11 +188,6 @@ void CreateSocket (void); /** - * Figure out where the raw socket creation process lives on the system. - */ - std::string FindCreator (std::string creatorName); - - /** * Get a copy of the attached Queue. * * This method is provided for any derived class that may need to get diff -r f7d0054c0e2a -r d6e986a7b281 src/devices/emu/wscript --- a/src/devices/emu/wscript Tue Nov 17 16:57:13 2009 +0300 +++ b/src/devices/emu/wscript Tue Nov 17 17:59:10 2009 +0300 @@ -1,5 +1,7 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- +import os.path + def configure(conf): if conf.env['ENABLE_THREADING']: conf.env['ENABLE_EMU'] = conf.check(header_name='netpacket/packet.h', @@ -38,4 +40,6 @@ 'emu-encode-decode.cc', ] + emucreatordir = os.path.abspath(os.path.join(bld.bdir, env.variant(), "src/devices/emu")) + env.append_value('PATH', emucreatordir) diff -r f7d0054c0e2a -r d6e986a7b281 src/devices/tap-bridge/tap-bridge.cc --- a/src/devices/tap-bridge/tap-bridge.cc Tue Nov 17 16:57:13 2009 +0300 +++ b/src/devices/tap-bridge/tap-bridge.cc Tue Nov 17 17:59:10 2009 +0300 @@ -432,8 +432,8 @@ // // Execute the socket creation process image. // - status = ::execl (FindCreator ("tap-creator").c_str (), - FindCreator ("tap-creator").c_str (), // argv[0] (filename) + status = ::execlp ("tap-creator", + "tap-creator", // argv[0] (filename) ossDeviceName.str ().c_str (), // argv[1] (-d) ossGateway.str ().c_str (), // argv[2] (-g) ossIp.str ().c_str (), // argv[3] (-i) @@ -444,10 +444,10 @@ (char *)NULL); // - // If the execl successfully completes, it never returns. If it returns it failed or the OS is + // If the execlp successfully completes, it never returns. If it returns it failed or the OS is // broken. In either case, we bail. // - NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execl(), errno = " << ::strerror (errno)); + NS_FATAL_ERROR ("TapBridge::CreateTap(): Back from execlp(), errno = " << ::strerror (errno)); } else { @@ -569,44 +569,6 @@ } } -std::string -TapBridge::FindCreator (std::string creatorName) -{ - NS_LOG_FUNCTION (creatorName); - - std::list locations; - - // The path to the bits if we're sitting in the root of the repo - locations.push_back ("./build/optimized/src/devices/tap-bridge/"); - locations.push_back ("./build/debug/src/devices/tap-bridge/"); - - // if in src - locations.push_back ("../build/optimized/src/devices/tap-bridge/"); - locations.push_back ("../build/debug/src/devices/tap-bridge/"); - - // if in src/devices - locations.push_back ("../../build/optimized/src/devices/tap-bridge/"); - locations.push_back ("../../build/debug/src/devices/tap-bridge/"); - - // if in src/devices/tap-bridge - locations.push_back ("../../../build/optimized/src/devices/tap-bridge/"); - locations.push_back ("../../../build/debug/src/devices/tap-bridge/"); - - for (std::list::const_iterator i = locations.begin (); i != locations.end (); ++i) - { - struct stat st; - - if (::stat ((*i + creatorName).c_str (), &st) == 0) - { - NS_LOG_INFO ("Found Creator " << *i + creatorName); - return *i + creatorName; - } - } - - NS_FATAL_ERROR ("TapBridge::FindCreator(): Couldn't find creator"); - return ""; // quiet compiler -} - void TapBridge::ReadThread (void) { diff -r f7d0054c0e2a -r d6e986a7b281 src/devices/tap-bridge/tap-bridge.h --- a/src/devices/tap-bridge/tap-bridge.h Tue Nov 17 16:57:13 2009 +0300 +++ b/src/devices/tap-bridge/tap-bridge.h Tue Nov 17 17:59:10 2009 +0300 @@ -233,16 +233,6 @@ /** * \internal * - * Figure out where the tap creation program lives on the system. - * - * \param creatorName The name of the program used to create the Tap. - * \returns A path name to use when you want to create a Tap. - */ - std::string FindCreator (std::string creatorName); - - /** - * \internal - * * Spin up the device */ void StartTapDevice (void); diff -r f7d0054c0e2a -r d6e986a7b281 src/devices/tap-bridge/wscript --- a/src/devices/tap-bridge/wscript Tue Nov 17 16:57:13 2009 +0300 +++ b/src/devices/tap-bridge/wscript Tue Nov 17 17:59:10 2009 +0300 @@ -1,5 +1,7 @@ ## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- +import os.path + def configure(conf): if conf.env['ENABLE_THREADING']: conf.env['ENABLE_TAP'] = conf.check(header_name='linux/if_tun.h', @@ -40,4 +42,6 @@ 'tap-encode-decode.cc', ] + tapcreatordir = os.path.abspath(os.path.join(bld.bdir, env.variant(), "src/devices/tap-bridge")) + env.append_value('PATH', tapcreatordir) diff -r f7d0054c0e2a -r d6e986a7b281 wutils.py --- a/wutils.py Tue Nov 17 16:57:13 2009 +0300 +++ b/wutils.py Tue Nov 17 17:59:10 2009 +0300 @@ -112,6 +112,8 @@ else: proc_env['PYTHONPATH'] = pymoddir + proc_env['PATH'] = os.pathsep.join(list(env['PATH']) + [proc_env['PATH']]) + return proc_env def run_argv(argv, env, os_env=None, cwd=None, force_no_valgrind=False):