diff --git a/opal/class/opal_object.h b/opal/class/opal_object.h index 00132141d2..766bec3ae4 100644 --- a/opal/class/opal_object.h +++ b/opal/class/opal_object.h @@ -115,7 +115,9 @@ #define OPAL_OBJECT_H #include +#ifdef HAVE_STDLIB_H #include +#endif /* HAVE_STDLIB_H */ #include "include/sys/atomic.h" diff --git a/opal/mca/base/mca_base_component_find.c b/opal/mca/base/mca_base_component_find.c index cafdf58a35..f6b17a898a 100644 --- a/opal/mca/base/mca_base_component_find.c +++ b/opal/mca/base/mca_base_component_find.c @@ -215,7 +215,7 @@ static void find_dyn_components(const char *path, const char *type_name, dir = path_to_use; if (NULL != dir) { do { -#ifdef WIN32 +#ifdef __WINDOWS__ end = strchr(dir, ';'); #else end = strchr(dir, ':'); diff --git a/opal/mca/base/mca_base_open.c b/opal/mca/base/mca_base_open.c index 99a58113b2..b8a55786a1 100644 --- a/opal/mca/base/mca_base_open.c +++ b/opal/mca/base/mca_base_open.c @@ -69,7 +69,7 @@ int mca_base_open(void) /* Register some params */ -#ifdef WIN32 +#ifdef __WINDOWS__ asprintf(&value, "%s;~/.openmpi/components", OMPI_PKGLIBDIR); #else asprintf(&value, "%s:~/.openmpi/components", OMPI_PKGLIBDIR); @@ -121,7 +121,7 @@ static void set_defaults(opal_output_stream_t *lds) /* Load up defaults */ OBJ_CONSTRUCT(lds, opal_output_stream_t); -#ifndef WIN32 +#ifndef __WINDOWS__ lds->lds_syslog_priority = LOG_INFO; #endif lds->lds_syslog_ident = "ompi"; @@ -154,7 +154,7 @@ static void parse_verbose(char *e, opal_output_stream_t *lds) } if (0 == strcasecmp(ptr, "syslog")) { -#ifndef WIN32 /* there is no syslog */ +#ifndef __WINDOWS__ /* there is no syslog */ lds->lds_want_syslog = true; have_output = true; } diff --git a/opal/memoryhooks/memory.c b/opal/memoryhooks/memory.c index 9b8b12ac07..84e9abc2eb 100644 --- a/opal/memoryhooks/memory.c +++ b/opal/memoryhooks/memory.c @@ -18,8 +18,12 @@ #include "ompi_config.h" +#ifdef HAVE_SYS_TYPES_H #include +#endif /* HAVE_SYS_TYPES_H */ +#ifdef HAVE_SYS_MMAN_H #include +#endif /* HAVE_SYS_MMAN_H */ #include "opal/include/constants.h" #include "opal/util/output.h" diff --git a/opal/runtime/opal_progress.c b/opal/runtime/opal_progress.c index 627b187be7..c31fe90e76 100644 --- a/opal/runtime/opal_progress.c +++ b/opal/runtime/opal_progress.c @@ -295,7 +295,7 @@ opal_progress(void) #endif } -#if !defined(WIN32) && defined(HAVE_SCHED_YIELD) +#if !defined(__WINDOWS__) && defined(HAVE_SCHED_YIELD) if (call_yield && events <= 0) { /* If there is nothing to do - yield the processor - otherwise * we could consume the processor for the entire time slice. If diff --git a/opal/threads/mutex.c b/opal/threads/mutex.c index d6068149d9..d11e010470 100644 --- a/opal/threads/mutex.c +++ b/opal/threads/mutex.c @@ -26,7 +26,7 @@ bool opal_uses_threads = (bool) OMPI_HAVE_THREAD_SUPPORT; -#ifdef WIN32 +#ifdef __WINDOWS__ #include diff --git a/opal/threads/thread.c b/opal/threads/thread.c index 85610da8ef..68c69915d0 100644 --- a/opal/threads/thread.c +++ b/opal/threads/thread.c @@ -45,7 +45,7 @@ static void opal_thread_construct(opal_thread_t *t) } -#if defined(WIN32) +#ifdef __WINDOWS__ /************************************************************************ * Windows threads diff --git a/opal/threads/threads.h b/opal/threads/threads.h index 2ea5ddb0d7..0d705b9e99 100644 --- a/opal/threads/threads.h +++ b/opal/threads/threads.h @@ -19,7 +19,7 @@ #ifndef OPAL_THREAD_H #define OPAL_THREAD_H 1 -#ifdef WIN32 +#ifdef __WINDOWS__ #include #elif OMPI_HAVE_POSIX_THREADS #include @@ -39,7 +39,7 @@ struct opal_thread_t { opal_object_t super; opal_thread_fn_t t_run; void* t_arg; -#ifdef WIN32 +#ifdef __WINDOWS__ HANDLE t_handle; #elif OMPI_HAVE_POSIX_THREADS pthread_t t_handle; diff --git a/opal/util/argv.c b/opal/util/argv.c index aab9d1d946..b8d4935a73 100644 --- a/opal/util/argv.c +++ b/opal/util/argv.c @@ -17,8 +17,12 @@ */ #include "ompi_config.h" +#ifdef HAVE_STDLIB_H #include +#endif /* HAVE_STDLIB_H */ +#ifdef HAVE_STRING_H #include +#endif /* HAVE_STRING_H */ #include "opal/util/argv.h" #include "opal/util/strncpy.h" diff --git a/opal/util/basename.c b/opal/util/basename.c index d335d28c9f..52e55b6f0d 100644 --- a/opal/util/basename.c +++ b/opal/util/basename.c @@ -29,7 +29,7 @@ char *opal_basename(const char *filename) { size_t i; char *tmp, *ret = NULL; -#ifdef WIN32 +#ifdef __WINDOWS__ const char sep = '\\'; #else const char sep = '/'; @@ -43,7 +43,7 @@ char *opal_basename(const char *filename) /* On Windows, automatically exclude a drive designator */ -#ifdef WIN32 +#ifdef __WINDOWS__ if (strlen(filename) == 2 && isalpha(filename[0]) && ':' == filename[1]) { return strdup(filename); diff --git a/opal/util/crc.c b/opal/util/crc.c index c6909caf2e..9d15ad84f5 100644 --- a/opal/util/crc.c +++ b/opal/util/crc.c @@ -19,10 +19,18 @@ #include "ompi_config.h" #include +#ifdef HAVE_STDLIB_H #include +#endif /* HAVE_STDLIB_H */ +#ifdef HAVE_STRINGS_H #include +#endif /* HAVE_STRINGS_H */ +#ifdef HAVE_STRING_H #include +#endif /* HAVE_STRING_H */ +#ifdef HAVE_UNISTD_H #include +#endif /* HAVE_UNISTD_H */ #include "opal/util/crc.h" diff --git a/opal/util/daemon_init.c b/opal/util/daemon_init.c index cee7e9e4d7..26be7a7ff9 100644 --- a/opal/util/daemon_init.c +++ b/opal/util/daemon_init.c @@ -35,7 +35,7 @@ int opal_daemon_init(char *working_dir) { #if defined(HAVE_FORK) -#ifndef WIN32 +#ifndef __WINDOWS__ /* it seems that there is an entirely different way to write daemons in WINDOWS land. Firstly, they are called services and the way to go about it is to get a service handle annd then call CreateService() diff --git a/opal/util/few.c b/opal/util/few.c index 4ff3b57b09..45b7d3d7b5 100644 --- a/opal/util/few.c +++ b/opal/util/few.c @@ -34,7 +34,7 @@ int opal_few(char *argv[], int *status) { -#ifndef WIN32 +#ifndef __WINDOWS__ #if defined(HAVE_FORK) && defined(HAVE_EXECVE) && defined(HAVE_WAITPID) pid_t pid, ret; diff --git a/opal/util/if.c b/opal/util/if.c index 2a05fe2941..3a585c6e8f 100644 --- a/opal/util/if.c +++ b/opal/util/if.c @@ -84,7 +84,7 @@ struct opal_if_t { opal_list_item_t super; char if_name[IF_NAMESIZE]; int if_index; -#ifndef WIN32 +#ifndef __WINDOWS__ int if_flags; #else u_long if_flags; @@ -92,7 +92,7 @@ struct opal_if_t { int if_speed; struct sockaddr_in if_addr; struct sockaddr_in if_mask; -#ifdef WIN32 +#ifdef __WINDOWS__ struct sockaddr_in if_bcast; #endif uint32_t if_bandwidth; @@ -111,7 +111,7 @@ static bool already_done = false; static int opal_ifinit(void) { -#ifndef WIN32 +#ifndef __WINDOWS__ int sd; int lastlen, num, rem; char *ptr; @@ -284,7 +284,7 @@ static int opal_ifinit(void) free(ifconf.ifc_req); close(sd); -#else /* WIN32 implementation begins */ +#else /* __WINDOWS__ implementation begins */ /* 1. check if the interface info list is already populated. If so, return @@ -395,7 +395,7 @@ static int opal_ifinit(void) int opal_iffinalize(void) { if (already_done) { -#ifndef WIN32 +#ifndef __WINDOWS__ opal_if_t *intf_ptr; while (NULL != @@ -465,7 +465,7 @@ int opal_ifnametoindex(const char* if_name) int opal_ifaddrtoname(const char* if_addr, char* if_name, int length) { opal_if_t* intf; -#ifndef WIN32 +#ifndef __WINDOWS__ in_addr_t inaddr; #else unsigned long inaddr; diff --git a/opal/util/os_create_dirpath.c b/opal/util/os_create_dirpath.c index 60ea477aef..3a50540aed 100644 --- a/opal/util/os_create_dirpath.c +++ b/opal/util/os_create_dirpath.c @@ -32,7 +32,7 @@ #include "opal/util/argv.h" #include "ompi/include/constants.h" -#ifdef WIN32 +#ifdef __WINDOWS__ #define PATH_SEP "\\" #else #define PATH_SEP "/" @@ -100,7 +100,7 @@ int opal_os_create_dirpath(const char *path, const mode_t mode) for (i = 0; i < len; ++i) { if (i == 0) { -#ifdef WIN32 +#ifdef __WINDOWS__ /* In the Windows case, check for ":" case (i.e., an absolute pathname). If this is the case, ensure that it ends in a path_sep. */ diff --git a/opal/util/os_path.c b/opal/util/os_path.c index 4b22a77c4f..d23992e837 100644 --- a/opal/util/os_path.c +++ b/opal/util/os_path.c @@ -34,7 +34,7 @@ #include "opal/util/os_path.h" #include "ompi/include/constants.h" -#ifdef WIN32 +#ifdef __WINDOWS__ #define PATH_SEP "\\" #else #define PATH_SEP "/" @@ -70,7 +70,7 @@ char *opal_os_path(bool relative, ...) strcat(path, path_sep); } else { -#ifndef WIN32 +#ifndef __WINDOWS__ strcpy(path, path_sep); #endif } diff --git a/opal/util/path.c b/opal/util/path.c index c09ee915fc..6c5b467ce0 100644 --- a/opal/util/path.c +++ b/opal/util/path.c @@ -29,7 +29,7 @@ /* * PATH environment variable separator */ -#ifdef WIN32 +#ifdef __WINDOWS__ #define PATHENVSEP ';' #else #define PATHENVSEP ':' diff --git a/opal/util/stacktrace.c b/opal/util/stacktrace.c index 88275266af..61cac8e0e2 100644 --- a/opal/util/stacktrace.c +++ b/opal/util/stacktrace.c @@ -59,7 +59,7 @@ * * FIXME: Should distinguish for systems, which don't have siginfo... */ -#if OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(WIN32) +#if OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(__WINDOWS__) static void opal_show_stackframe (int signo, siginfo_t * info, void * p) { #ifdef HAVE_BACKTRACE @@ -290,7 +290,7 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p) fflush(stderr); } -#endif /* OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(WIN32) */ +#endif /* OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(__WINDOWS__) */ /** @@ -305,7 +305,7 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p) */ int opal_util_register_stackhandlers (void) { -#if OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(WIN32) +#if OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(__WINDOWS__) struct sigaction act; char * string_value; char * tmp; @@ -350,7 +350,7 @@ int opal_util_register_stackhandlers (void) return OMPI_ERR_IN_ERRNO; } } -#endif /* OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(WIN32) */ +#endif /* OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(__WINDOWS__) */ return OMPI_SUCCESS; }