From 1d02b9e7b5b8a6fe654d51f6d4b9164888a24d13 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Tue, 10 Jul 2007 03:46:57 +0000 Subject: [PATCH] Fix a bunch of issues exposed by Ken Cain in getting Open MPI to work with VxWorks. Still some issues remaining, I'm sure. Refs trac:1010 This commit was SVN r15320. The following Trac tickets were found above: Ticket 1010 --> https://svn.open-mpi.org/trac/ompi/ticket/1010 --- config/ompi_config_asm.m4 | 2 +- config/ompi_try_assemble.m4 | 2 +- configure.ac | 7 ++++--- ompi/communicator/comm_dyn.c | 3 +++ ompi/datatype/convertor.h | 3 +++ ompi/mca/btl/tcp/btl_tcp_frag.c | 3 +++ ompi/mca/btl/tcp/btl_tcp_frag.h | 3 +++ opal/event/signal.c | 13 ++++++++++++- opal/include/opal_config_bottom.h | 23 +++++++++++++++++++++++ opal/util/basename.c | 8 ++++++++ opal/util/os_path.c | 2 +- opal/util/output.c | 2 +- opal/util/stacktrace.c | 2 ++ orte/dss/dss_compare.c | 2 +- orte/dss/dss_internal.h | 2 +- orte/mca/iof/base/base.h | 3 +++ orte/mca/iof/svc/iof_svc.h | 3 +++ orte/mca/oob/base/base.h | 3 +++ orte/mca/oob/tcp/oob_tcp.c | 2 +- orte/mca/oob/tcp/oob_tcp_peer.c | 3 +++ orte/mca/oob/tcp/oob_tcp_ping.c | 3 +++ orte/mca/rml/rml_types.h | 3 +++ 22 files changed, 86 insertions(+), 11 deletions(-) diff --git a/config/ompi_config_asm.m4 b/config/ompi_config_asm.m4 index ba0a446d18..a8a7781c4e 100644 --- a/config/ompi_config_asm.m4 +++ b/config/ompi_config_asm.m4 @@ -230,7 +230,7 @@ $ompi_cv_asm_endproc ${sym}gsym_test_func if AC_TRY_EVAL(ompi_compile) ; then # save the warnings cat conftest.cmpl >&AC_FD_CC - ompi_link="$CC $CFLAGS conftest_c.$OBJEXT conftest.$OBJEXT -o conftest > conftest.link 2>&1" + ompi_link="$CC $CFLAGS conftest_c.$OBJEXT conftest.$OBJEXT -o conftest $LDFLAGS > conftest.link 2>&1" if AC_TRY_EVAL(ompi_link) ; then # save the warnings cat conftest.link >&AC_FD_CC diff --git a/config/ompi_try_assemble.m4 b/config/ompi_try_assemble.m4 index 45b62a65cb..35bb8ce92c 100644 --- a/config/ompi_try_assemble.m4 +++ b/config/ompi_try_assemble.m4 @@ -33,7 +33,7 @@ EOF if test "$CC" = "$CCAS" ; then ompi_assemble="$CCAS $CCASFLAGS -c conftest.s >conftest.out 2>&1" else - ompi_assemble="$CCAS $CCASFLAGS conftest.s >conftest.out 2>&1" + ompi_assemble="$CCAS $CCASFLAGS -o conftest.o conftest.s >conftest.out 2>&1" fi if AC_TRY_EVAL(ompi_assemble); then # save the warnings diff --git a/configure.ac b/configure.ac index c1e4255e4c..e6a23964e8 100644 --- a/configure.ac +++ b/configure.ac @@ -593,9 +593,10 @@ AC_CHECK_HEADERS([alloca.h aio.h arpa/inet.h dirent.h \ sys/ioctl.h sys/mman.h sys/param.h sys/queue.h \ sys/resource.h sys/select.h sys/socket.h sys/sockio.h \ stdarg.h sys/stat.h sys/statvfs.h sys/time.h sys/tree.h \ - sys/types.h sys/uio.h sys/utsname.h sys/wait.h syslog.h \ + sys/types.h sys/uio.h net/uio.h sys/utsname.h sys/wait.h syslog.h \ time.h termios.h ulimit.h unistd.h util.h utmp.h malloc.h \ - ifaddrs.h sys/sysctl.h crt_externs.h regex.h]) + ifaddrs.h sys/sysctl.h crt_externs.h regex.h \ + ioLib.h sockLib.h hostLib.h]) # Needed to work around Darwin requiring sys/socket.h for # net/if.h @@ -733,7 +734,7 @@ OMPI_CHECK_FUNC_LIB([dirname], [gen]) # Darwin doesn't need -lm, as it's a symlink to libSystem.dylib OMPI_CHECK_FUNC_LIB([ceil], [m]) -AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty htonl ntohl htons ntohs getpwuid fork waitpid execve pipe ptsname setsid mmap mallopt tcgetpgrp posix_memalign strsignal sysconf syslog regcmp regexec regfree _NSGetEnviron]) +AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty htonl ntohl htons ntohs getpwuid fork waitpid execve pipe ptsname setsid mmap mallopt tcgetpgrp posix_memalign strsignal sysconf syslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s _strdup usleep]) # # Make sure we can copy va_lists (need check declared, not linkable) diff --git a/ompi/communicator/comm_dyn.c b/ompi/communicator/comm_dyn.c index 7df878f7a9..3b8422ebb1 100644 --- a/ompi/communicator/comm_dyn.c +++ b/ompi/communicator/comm_dyn.c @@ -26,6 +26,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif #ifdef HAVE_UNISTD_H #include #endif diff --git a/ompi/datatype/convertor.h b/ompi/datatype/convertor.h index b0fdd5fa00..90682009c4 100644 --- a/ompi/datatype/convertor.h +++ b/ompi/datatype/convertor.h @@ -30,6 +30,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif BEGIN_C_DECLS /* diff --git a/ompi/mca/btl/tcp/btl_tcp_frag.c b/ompi/mca/btl/tcp/btl_tcp_frag.c index 3ea4d830da..d195ee989e 100644 --- a/ompi/mca/btl/tcp/btl_tcp_frag.c +++ b/ompi/mca/btl/tcp/btl_tcp_frag.c @@ -29,6 +29,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ diff --git a/ompi/mca/btl/tcp/btl_tcp_frag.h b/ompi/mca/btl/tcp/btl_tcp_frag.h index 28647b869c..f16a835b60 100644 --- a/ompi/mca/btl/tcp/btl_tcp_frag.h +++ b/ompi/mca/btl/tcp/btl_tcp_frag.h @@ -29,6 +29,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif #include "btl_tcp.h" #include "btl_tcp_hdr.h" diff --git a/opal/event/signal.c b/opal/event/signal.c index 6d0e607f13..0f13566686 100644 --- a/opal/event/signal.c +++ b/opal/event/signal.c @@ -61,7 +61,13 @@ extern struct opal_event_list opal_signalqueue; -static sig_atomic_t opal_evsigcaught[NSIG]; +#if defined(VXWORKS) +#define OPAL_NSIG (_NSIGS + 1) +#else +#define OPAL_NSIG NSIG +#endif + +static sig_atomic_t opal_evsigcaught[OPAL_NSIG]; static int opal_needrecalc; volatile sig_atomic_t opal_evsignal_caught = 0; @@ -106,8 +112,13 @@ opal_evsignal_init(sigset_t *evsigmask) * pair to wake up our event loop. The event loop then scans for * signals that got delivered. */ +#ifdef HAVE_SOCKETPAIR if (socketpair(AF_UNIX, SOCK_STREAM, 0, ev_signal_pair) == -1) event_err(1, "%s: socketpair", __func__); +#else + if (socketpair(AF_UNIX, SOCK_STREAM, 0, ev_signal_pair) == -1) + event_err(1, "%s: pipe", __func__); +#endif FD_CLOSEONEXEC(ev_signal_pair[0]); FD_CLOSEONEXEC(ev_signal_pair[1]); diff --git a/opal/include/opal_config_bottom.h b/opal/include/opal_config_bottom.h index a2451d33b2..7a67d62fc0 100644 --- a/opal/include/opal_config_bottom.h +++ b/opal/include/opal_config_bottom.h @@ -511,4 +511,27 @@ static inline uint16_t ntohs(uint16_t netvar) { return netvar; } #endif #endif +#ifdef MCS_VXWORKS +/* VXWorks puts some common functions in oddly named headers. Rather + than update all the places the functions are used, which would be a + maintenance disatster, just update here... */ +#ifdef HAVE_IOLIB_H +/* pipe(), ioctl() */ +#include +#endif +#ifdef HAVE_SOCKLIB_H +/* socket() */ +#include +#endif +#ifdef HAVE_HOSTLIB_H +/* gethostname() */ +#include + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 64 +#endif +#endif + +#endif + #endif /* OMPI_BUILDING */ diff --git a/opal/util/basename.c b/opal/util/basename.c index 9b396f94dd..93283b14e5 100644 --- a/opal/util/basename.c +++ b/opal/util/basename.c @@ -143,13 +143,21 @@ char* opal_dirname(const char* filename) } if( p != filename ) { char* ret = (char*)malloc( p - filename + 1 ); +#ifdef HAVE_STRNCPY_S strncpy_s( ret, (p - filename + 1), filename, p - filename ); +#else + strncpy(ret, filename, p - filename); +#endif ret[p - filename] = '\0'; return opal_make_filename_os_friendly(ret); } break; /* return the duplicate of "." */ } } +#ifdef HAVE__STRDUP return _strdup("."); +#else + return strdup("."); +#endif #endif /* defined(HAVE_DIRNAME) */ } diff --git a/opal/util/os_path.c b/opal/util/os_path.c index 6db82b8835..acc890f316 100644 --- a/opal/util/os_path.c +++ b/opal/util/os_path.c @@ -74,7 +74,7 @@ char *opal_os_path(bool relative, ...) total_length++; } - if (total_length > MAXPATHLEN) { /* path length is too long - reject it */ + if (total_length > OMPI_PATH_MAX) { /* path length is too long - reject it */ return(NULL); } diff --git a/opal/util/output.c b/opal/util/output.c index cdc603e700..3938764b2d 100644 --- a/opal/util/output.c +++ b/opal/util/output.c @@ -535,7 +535,7 @@ static int open_file(int i) /* Setup the filename and open flags */ if (NULL != output_dir) { - filename = (char *) malloc(MAXPATHLEN); + filename = (char *) malloc(OMPI_PATH_MAX); if (NULL == filename) { return OPAL_ERR_OUT_OF_RESOURCE; } diff --git a/opal/util/stacktrace.c b/opal/util/stacktrace.c index 514bb977d7..611b9b1fa8 100644 --- a/opal/util/stacktrace.c +++ b/opal/util/stacktrace.c @@ -146,7 +146,9 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p) case FPE_FLTOVF: si_code_str = "Floating point overflow"; break; case FPE_FLTUND: si_code_str = "Floating point underflow"; break; case FPE_FLTRES: si_code_str = "Floating point inexact result"; break; +#ifdef FBE_FLTINV case FPE_FLTINV: si_code_str = "Invalid floating point operation"; break; +#endif #ifdef FPE_FLTSUB case FPE_FLTSUB: si_code_str = "Subscript out of range"; break; #endif diff --git a/orte/dss/dss_compare.c b/orte/dss/dss_compare.c index 10eca9d41e..005a2c88c2 100644 --- a/orte/dss/dss_compare.c +++ b/orte/dss/dss_compare.c @@ -62,7 +62,7 @@ int orte_dss_compare_int(int *value1, int *value2, orte_data_type_t type) return ORTE_EQUAL; } -int orte_dss_compare_uint(uint *value1, uint *value2, orte_data_type_t type) +int orte_dss_compare_uint(unsigned int *value1, unsigned int *value2, orte_data_type_t type) { if (*value1 > *value2) return ORTE_VALUE1_GREATER; diff --git a/orte/dss/dss_internal.h b/orte/dss/dss_internal.h index e77ea22dcd..f218411d41 100644 --- a/orte/dss/dss_internal.h +++ b/orte/dss/dss_internal.h @@ -396,7 +396,7 @@ extern orte_data_type_t orte_dss_num_reg_types; int orte_dss_compare_bool(bool *value1, bool *value2, orte_data_type_t type); int orte_dss_compare_int(int *value1, int *value2, orte_data_type_t type); - int orte_dss_compare_uint(uint *value1, uint *value2, orte_data_type_t type); + int orte_dss_compare_uint(unsigned int *value1, unsigned int *value2, orte_data_type_t type); int orte_dss_compare_size(size_t *value1, size_t *value2, orte_data_type_t type); diff --git a/orte/mca/iof/base/base.h b/orte/mca/iof/base/base.h index 97054fb95a..c126918305 100644 --- a/orte/mca/iof/base/base.h +++ b/orte/mca/iof/base/base.h @@ -31,6 +31,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif #ifdef HAVE_UNISTD_H #include #endif diff --git a/orte/mca/iof/svc/iof_svc.h b/orte/mca/iof/svc/iof_svc.h index d23abf2c16..f65a3c0929 100644 --- a/orte/mca/iof/svc/iof_svc.h +++ b/orte/mca/iof/svc/iof_svc.h @@ -53,6 +53,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif /* HAVE_SYS_UIO_H */ +#ifdef HAVE_NET_UIO_H +#include +#endif /* HAVE_NET_UIO_H */ #if defined(c_plusplus) || defined(__cplusplus) extern "C" { diff --git a/orte/mca/oob/base/base.h b/orte/mca/oob/base/base.h index 843b072a69..d48ad059d3 100644 --- a/orte/mca/oob/base/base.h +++ b/orte/mca/oob/base/base.h @@ -31,6 +31,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif #include "opal/mca/mca.h" #include "opal/threads/condition.h" diff --git a/orte/mca/oob/tcp/oob_tcp.c b/orte/mca/oob/tcp/oob_tcp.c index 7ca74fe314..70845b579f 100644 --- a/orte/mca/oob/tcp/oob_tcp.c +++ b/orte/mca/oob/tcp/oob_tcp.c @@ -1193,7 +1193,7 @@ int mca_oob_tcp_init(void) if(1 == mca_oob_tcp_component.connect_sleep) { Sleep((orte_process_info.my_name->vpid % randval % 1000) * 100); } -#else +#elif defined(HAVE_USLEEP) if(1 == mca_oob_tcp_component.connect_sleep) { usleep((orte_process_info.my_name->vpid % randval % 1000) * 1000); } diff --git a/orte/mca/oob/tcp/oob_tcp_peer.c b/orte/mca/oob/tcp/oob_tcp_peer.c index 91755537af..fd3692f2f5 100644 --- a/orte/mca/oob/tcp/oob_tcp_peer.c +++ b/orte/mca/oob/tcp/oob_tcp_peer.c @@ -31,6 +31,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif #ifdef HAVE_SYS_TYPES_H #include #endif diff --git a/orte/mca/oob/tcp/oob_tcp_ping.c b/orte/mca/oob/tcp/oob_tcp_ping.c index 51dd98d885..9dd4403d51 100644 --- a/orte/mca/oob/tcp/oob_tcp_ping.c +++ b/orte/mca/oob/tcp/oob_tcp_ping.c @@ -30,6 +30,9 @@ #ifdef HAVE_SYS_UIO_H #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif #ifdef HAVE_SYS_TYPES_H #include #endif diff --git a/orte/mca/rml/rml_types.h b/orte/mca/rml/rml_types.h index 3541eb2644..34afcd7a2e 100644 --- a/orte/mca/rml/rml_types.h +++ b/orte/mca/rml/rml_types.h @@ -32,6 +32,9 @@ /* for struct iovec */ #include #endif +#ifdef HAVE_NET_UIO_H +#include +#endif #include "orte/orte_constants.h" #include "orte/util/proc_info.h"