|
|
| 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 |
{ |
|
|
| 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 |
{ |