Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed ping utility. #320

Merged
merged 1 commit into from
Feb 7, 2018
Merged
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
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@ if (ERT_WINDOWS)
endif()
endif()

find_program(PING_PATH NAMES ping)
if (PING_PATH)
set(ERT_HAVE_PING ON)
endif()

find_package(Git)
if(GIT_FOUND)
Expand Down
3 changes: 0 additions & 3 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@ target_compile_definitions(ecl PRIVATE

target_compile_options(ecl PUBLIC ${pthreadarg})

if (PING_PATH)
target_compile_definitions(ecl PRIVATE -DPING_CMD=${PING_PATH})
endif()

if (ERT_USE_OPENMP)
target_compile_options(ecl PUBLIC ${OpenMP_C_FLAGS})
Expand Down
3 changes: 0 additions & 3 deletions lib/include/ert/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,6 @@ void util_abort_set_executable( const char * argv0 );
#ifdef ERT_HAVE_SPAWN
pid_t util_spawn(const char *executable, int argc, const char **argv, const char *stdout_file, const char *stderr_file);
int util_spawn_blocking(const char *executable, int argc, const char **argv, const char *stdout_file, const char *stderr_file);
#ifdef ERT_HAVE_PING
bool util_ping( const char * hostname);
#endif
#endif


Expand Down
24 changes: 0 additions & 24 deletions lib/util/util_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,30 +124,6 @@ int util_spawn_blocking(const char *executable, int argc, const char **argv, con



/**
The ping program must(?) be setuid root, so implementing a simple
version based on sockets() proved to be nontrivial.

The PING_CMD is passed as -D from the build system.
*/

#ifdef ERT_HAVE_PING
#define xstr(s) #s
#define str(s) xstr(s)
bool util_ping(const char *hostname) {
int wait_status;
const char* args[ 4 ] = { "-c", "3", "-q", hostname };
wait_status = util_spawn_blocking(str(PING_CMD), 4, args, "/dev/null" , "/dev/null");

if (WIFEXITED( wait_status )) {
int ping_status = WEXITSTATUS( wait_status );
return ping_status == 0;
} else {
return false;
}
}
#endif