1
1

Protect headers and use __WINDOWS__ for Windows code.

This commit was SVN r8468.
Этот коммит содержится в:
George Bosilca 2005-12-12 22:01:51 +00:00
родитель 8c71f578da
Коммит bd0ee62e62
18 изменённых файлов: 46 добавлений и 28 удалений

Просмотреть файл

@ -115,7 +115,9 @@
#define OPAL_OBJECT_H #define OPAL_OBJECT_H
#include <assert.h> #include <assert.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif /* HAVE_STDLIB_H */
#include "include/sys/atomic.h" #include "include/sys/atomic.h"

Просмотреть файл

@ -215,7 +215,7 @@ static void find_dyn_components(const char *path, const char *type_name,
dir = path_to_use; dir = path_to_use;
if (NULL != dir) { if (NULL != dir) {
do { do {
#ifdef WIN32 #ifdef __WINDOWS__
end = strchr(dir, ';'); end = strchr(dir, ';');
#else #else
end = strchr(dir, ':'); end = strchr(dir, ':');

Просмотреть файл

@ -69,7 +69,7 @@ int mca_base_open(void)
/* Register some params */ /* Register some params */
#ifdef WIN32 #ifdef __WINDOWS__
asprintf(&value, "%s;~/.openmpi/components", OMPI_PKGLIBDIR); asprintf(&value, "%s;~/.openmpi/components", OMPI_PKGLIBDIR);
#else #else
asprintf(&value, "%s:~/.openmpi/components", OMPI_PKGLIBDIR); asprintf(&value, "%s:~/.openmpi/components", OMPI_PKGLIBDIR);
@ -121,7 +121,7 @@ static void set_defaults(opal_output_stream_t *lds)
/* Load up defaults */ /* Load up defaults */
OBJ_CONSTRUCT(lds, opal_output_stream_t); OBJ_CONSTRUCT(lds, opal_output_stream_t);
#ifndef WIN32 #ifndef __WINDOWS__
lds->lds_syslog_priority = LOG_INFO; lds->lds_syslog_priority = LOG_INFO;
#endif #endif
lds->lds_syslog_ident = "ompi"; 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")) { if (0 == strcasecmp(ptr, "syslog")) {
#ifndef WIN32 /* there is no syslog */ #ifndef __WINDOWS__ /* there is no syslog */
lds->lds_want_syslog = true; lds->lds_want_syslog = true;
have_output = true; have_output = true;
} }

Просмотреть файл

@ -18,8 +18,12 @@
#include "ompi_config.h" #include "ompi_config.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#endif /* HAVE_SYS_MMAN_H */
#include "opal/include/constants.h" #include "opal/include/constants.h"
#include "opal/util/output.h" #include "opal/util/output.h"

Просмотреть файл

@ -295,7 +295,7 @@ opal_progress(void)
#endif #endif
} }
#if !defined(WIN32) && defined(HAVE_SCHED_YIELD) #if !defined(__WINDOWS__) && defined(HAVE_SCHED_YIELD)
if (call_yield && events <= 0) { if (call_yield && events <= 0) {
/* If there is nothing to do - yield the processor - otherwise /* If there is nothing to do - yield the processor - otherwise
* we could consume the processor for the entire time slice. If * we could consume the processor for the entire time slice. If

Просмотреть файл

@ -26,7 +26,7 @@
bool opal_uses_threads = (bool) OMPI_HAVE_THREAD_SUPPORT; bool opal_uses_threads = (bool) OMPI_HAVE_THREAD_SUPPORT;
#ifdef WIN32 #ifdef __WINDOWS__
#include <windows.h> #include <windows.h>

Просмотреть файл

@ -45,7 +45,7 @@ static void opal_thread_construct(opal_thread_t *t)
} }
#if defined(WIN32) #ifdef __WINDOWS__
/************************************************************************ /************************************************************************
* Windows threads * Windows threads

Просмотреть файл

@ -19,7 +19,7 @@
#ifndef OPAL_THREAD_H #ifndef OPAL_THREAD_H
#define OPAL_THREAD_H 1 #define OPAL_THREAD_H 1
#ifdef WIN32 #ifdef __WINDOWS__
#include <windows.h> #include <windows.h>
#elif OMPI_HAVE_POSIX_THREADS #elif OMPI_HAVE_POSIX_THREADS
#include <pthread.h> #include <pthread.h>
@ -39,7 +39,7 @@ struct opal_thread_t {
opal_object_t super; opal_object_t super;
opal_thread_fn_t t_run; opal_thread_fn_t t_run;
void* t_arg; void* t_arg;
#ifdef WIN32 #ifdef __WINDOWS__
HANDLE t_handle; HANDLE t_handle;
#elif OMPI_HAVE_POSIX_THREADS #elif OMPI_HAVE_POSIX_THREADS
pthread_t t_handle; pthread_t t_handle;

Просмотреть файл

@ -17,8 +17,12 @@
*/ */
#include "ompi_config.h" #include "ompi_config.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif /* HAVE_STDLIB_H */
#ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif /* HAVE_STRING_H */
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/strncpy.h" #include "opal/util/strncpy.h"

Просмотреть файл

@ -29,7 +29,7 @@ char *opal_basename(const char *filename)
{ {
size_t i; size_t i;
char *tmp, *ret = NULL; char *tmp, *ret = NULL;
#ifdef WIN32 #ifdef __WINDOWS__
const char sep = '\\'; const char sep = '\\';
#else #else
const char sep = '/'; const char sep = '/';
@ -43,7 +43,7 @@ char *opal_basename(const char *filename)
/* On Windows, automatically exclude a drive designator */ /* On Windows, automatically exclude a drive designator */
#ifdef WIN32 #ifdef __WINDOWS__
if (strlen(filename) == 2 && if (strlen(filename) == 2 &&
isalpha(filename[0]) && ':' == filename[1]) { isalpha(filename[0]) && ':' == filename[1]) {
return strdup(filename); return strdup(filename);

Просмотреть файл

@ -19,10 +19,18 @@
#include "ompi_config.h" #include "ompi_config.h"
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif /* HAVE_STDLIB_H */
#ifdef HAVE_STRINGS_H
#include <strings.h> #include <strings.h>
#endif /* HAVE_STRINGS_H */
#ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif /* HAVE_STRING_H */
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif /* HAVE_UNISTD_H */
#include "opal/util/crc.h" #include "opal/util/crc.h"

Просмотреть файл

@ -35,7 +35,7 @@
int opal_daemon_init(char *working_dir) int opal_daemon_init(char *working_dir)
{ {
#if defined(HAVE_FORK) #if defined(HAVE_FORK)
#ifndef WIN32 #ifndef __WINDOWS__
/* it seems that there is an entirely different way to write daemons in /* it seems that there is an entirely different way to write daemons in
WINDOWS land. Firstly, they are called services and the way to WINDOWS land. Firstly, they are called services and the way to
go about it is to get a service handle annd then call CreateService() go about it is to get a service handle annd then call CreateService()

Просмотреть файл

@ -34,7 +34,7 @@
int opal_few(char *argv[], int *status) int opal_few(char *argv[], int *status)
{ {
#ifndef WIN32 #ifndef __WINDOWS__
#if defined(HAVE_FORK) && defined(HAVE_EXECVE) && defined(HAVE_WAITPID) #if defined(HAVE_FORK) && defined(HAVE_EXECVE) && defined(HAVE_WAITPID)
pid_t pid, ret; pid_t pid, ret;

Просмотреть файл

@ -84,7 +84,7 @@ struct opal_if_t {
opal_list_item_t super; opal_list_item_t super;
char if_name[IF_NAMESIZE]; char if_name[IF_NAMESIZE];
int if_index; int if_index;
#ifndef WIN32 #ifndef __WINDOWS__
int if_flags; int if_flags;
#else #else
u_long if_flags; u_long if_flags;
@ -92,7 +92,7 @@ struct opal_if_t {
int if_speed; int if_speed;
struct sockaddr_in if_addr; struct sockaddr_in if_addr;
struct sockaddr_in if_mask; struct sockaddr_in if_mask;
#ifdef WIN32 #ifdef __WINDOWS__
struct sockaddr_in if_bcast; struct sockaddr_in if_bcast;
#endif #endif
uint32_t if_bandwidth; uint32_t if_bandwidth;
@ -111,7 +111,7 @@ static bool already_done = false;
static int opal_ifinit(void) static int opal_ifinit(void)
{ {
#ifndef WIN32 #ifndef __WINDOWS__
int sd; int sd;
int lastlen, num, rem; int lastlen, num, rem;
char *ptr; char *ptr;
@ -284,7 +284,7 @@ static int opal_ifinit(void)
free(ifconf.ifc_req); free(ifconf.ifc_req);
close(sd); close(sd);
#else /* WIN32 implementation begins */ #else /* __WINDOWS__ implementation begins */
/* /*
1. check if the interface info list is already populated. If so, return 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) int opal_iffinalize(void)
{ {
if (already_done) { if (already_done) {
#ifndef WIN32 #ifndef __WINDOWS__
opal_if_t *intf_ptr; opal_if_t *intf_ptr;
while (NULL != 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) int opal_ifaddrtoname(const char* if_addr, char* if_name, int length)
{ {
opal_if_t* intf; opal_if_t* intf;
#ifndef WIN32 #ifndef __WINDOWS__
in_addr_t inaddr; in_addr_t inaddr;
#else #else
unsigned long inaddr; unsigned long inaddr;

Просмотреть файл

@ -32,7 +32,7 @@
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "ompi/include/constants.h" #include "ompi/include/constants.h"
#ifdef WIN32 #ifdef __WINDOWS__
#define PATH_SEP "\\" #define PATH_SEP "\\"
#else #else
#define PATH_SEP "/" #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) { for (i = 0; i < len; ++i) {
if (i == 0) { if (i == 0) {
#ifdef WIN32 #ifdef __WINDOWS__
/* In the Windows case, check for "<drive>:" case (i.e., /* In the Windows case, check for "<drive>:" case (i.e.,
an absolute pathname). If this is the case, ensure an absolute pathname). If this is the case, ensure
that it ends in a path_sep. */ that it ends in a path_sep. */

Просмотреть файл

@ -34,7 +34,7 @@
#include "opal/util/os_path.h" #include "opal/util/os_path.h"
#include "ompi/include/constants.h" #include "ompi/include/constants.h"
#ifdef WIN32 #ifdef __WINDOWS__
#define PATH_SEP "\\" #define PATH_SEP "\\"
#else #else
#define PATH_SEP "/" #define PATH_SEP "/"
@ -70,7 +70,7 @@ char *opal_os_path(bool relative, ...)
strcat(path, path_sep); strcat(path, path_sep);
} }
else { else {
#ifndef WIN32 #ifndef __WINDOWS__
strcpy(path, path_sep); strcpy(path, path_sep);
#endif #endif
} }

Просмотреть файл

@ -29,7 +29,7 @@
/* /*
* PATH environment variable separator * PATH environment variable separator
*/ */
#ifdef WIN32 #ifdef __WINDOWS__
#define PATHENVSEP ';' #define PATHENVSEP ';'
#else #else
#define PATHENVSEP ':' #define PATHENVSEP ':'

Просмотреть файл

@ -59,7 +59,7 @@
* *
* FIXME: Should distinguish for systems, which don't have siginfo... * 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) static void opal_show_stackframe (int signo, siginfo_t * info, void * p)
{ {
#ifdef HAVE_BACKTRACE #ifdef HAVE_BACKTRACE
@ -290,7 +290,7 @@ static void opal_show_stackframe (int signo, siginfo_t * info, void * p)
fflush(stderr); 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) 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; struct sigaction act;
char * string_value; char * string_value;
char * tmp; char * tmp;
@ -350,7 +350,7 @@ int opal_util_register_stackhandlers (void)
return OMPI_ERR_IN_ERRNO; return OMPI_ERR_IN_ERRNO;
} }
} }
#endif /* OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(WIN32) */ #endif /* OMPI_WANT_PRETTY_PRINT_STACKTRACE && ! defined(__WINDOWS__) */
return OMPI_SUCCESS; return OMPI_SUCCESS;
} }