From 5e280cda19495a9862db21587b0d8213d97fce4a Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 23 Aug 2006 00:29:35 +0000 Subject: [PATCH] Latest and greatest. Now OPAL is ready for the Windows prime-time. The same treatement will happens on all sub-projects. The .h files have to be C++ compatibles and all symbols with an external visibility have to get the {PROJECT}_DECLSPEC in front of the prototype. This commit was SVN r11340. --- opal/class/opal_atomic_lifo.h | 12 +- opal/class/opal_free_list.c | 4 +- opal/class/opal_free_list.h | 6 +- opal/class/opal_list.h | 18 +- opal/class/opal_object.h | 6 +- opal/class/opal_value_array.h | 9 +- opal/event/buffer.c | 2 +- opal/event/evbuffer.c | 7 +- opal/event/event.c | 42 ++-- opal/event/event.h | 37 ++-- opal/event/log.h | 2 + opal/include/opal/sys/win32/atomic.h | 14 +- opal/mca/backtrace/base/base.h | 4 +- .../backtrace/none/backtrace_none_component.c | 10 +- opal/mca/base/base.h | 10 +- opal/mca/base/mca_base_param.h | 12 +- opal/mca/base/mca_base_param_internal.h | 25 +-- opal/mca/maffinity/base/Makefile.am | 3 +- opal/mca/maffinity/base/base.h | 36 +++- opal/mca/maffinity/base/internal.h | 76 ------- .../mca/maffinity/base/maffinity_base_close.c | 4 +- .../maffinity/base/maffinity_base_select.c | 4 +- .../maffinity/base/maffinity_base_wrappers.c | 4 +- .../maffinity/first_use/maffinity_first_use.h | 4 +- opal/mca/memcpy/base/base.h | 4 +- opal/mca/memory/base/base.h | 4 +- opal/mca/paffinity/base/Makefile.am | 3 +- opal/mca/paffinity/base/base.h | 38 +++- opal/mca/paffinity/base/internal.h | 75 ------- .../mca/paffinity/base/paffinity_base_close.c | 4 +- .../paffinity/base/paffinity_base_select.c | 4 +- .../paffinity/base/paffinity_base_wrappers.c | 4 +- .../mca/paffinity/windows/paffinity_windows.h | 4 +- .../windows/paffinity_windows_module.c | 4 +- opal/mca/timer/aix/timer_aix.h | 10 +- opal/mca/timer/base/base.h | 4 +- opal/memoryhooks/memory.c | 6 +- opal/memoryhooks/memory.h | 20 +- opal/memoryhooks/memory_internal.h | 6 +- opal/runtime/opal_progress.h | 21 +- opal/threads/mutex.h | 4 +- opal/threads/mutex_unix.h | 4 +- opal/threads/threads.h | 11 +- opal/tools/wrappers/Makefile.am | 4 +- opal/util/cmd_line.c | 23 +- opal/util/convert.c | 4 +- opal/util/convert.h | 12 +- opal/util/crc.c | 6 +- opal/util/crc.h | 22 +- opal/util/daemon_init.h | 10 +- opal/util/error.h | 11 +- opal/util/if.c | 8 +- opal/util/keyval/keyval_lex.l | 8 +- opal/util/opal_pty.h | 18 +- opal/util/output.c | 202 ++++++++++-------- opal/util/output.h | 75 +++---- opal/util/pow2.h | 10 +- opal/util/printf.c | 8 +- opal/util/show_help.c | 7 +- opal/util/show_help.h | 12 +- opal/util/show_help_lex.l | 19 +- opal/util/strncpy.h | 9 +- opal/util/trace.h | 6 +- opal/win32/ompi_time.c | 31 ++- 64 files changed, 544 insertions(+), 542 deletions(-) delete mode 100644 opal/mca/maffinity/base/internal.h delete mode 100644 opal/mca/paffinity/base/internal.h diff --git a/opal/class/opal_atomic_lifo.h b/opal/class/opal_atomic_lifo.h index bc153e8956..5646f8261f 100644 --- a/opal/class/opal_atomic_lifo.h +++ b/opal/class/opal_atomic_lifo.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -23,7 +23,11 @@ #include "opal/class/opal_list.h" #include "opal/sys/atomic.h" -/* Atomic Last In First Out lists. If we are in a multi-threaded environment then the +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + + /* Atomic Last In First Out lists. If we are in a multi-threaded environment then the * atomicity is insured via the compare-and-swap operation, if not we simply do a read * and/or a write. * @@ -99,5 +103,9 @@ static inline opal_list_item_t* opal_atomic_lifo_pop( opal_atomic_lifo_t* lifo ) return item; } +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + #endif /* OPAL_ATOMIC_LIFO_H_HAS_BEEN_INCLUDED */ diff --git a/opal/class/opal_free_list.c b/opal/class/opal_free_list.c index 96d5100617..0497aed204 100644 --- a/opal/class/opal_free_list.c +++ b/opal/class/opal_free_list.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -102,7 +102,7 @@ int opal_free_list_grow(opal_free_list_t* flist, size_t num_elements) opal_list_append(&(flist->fl_allocations), (opal_list_item_t*) alloc_ptr); ptr = alloc_ptr + sizeof(opal_list_item_t); - mod = (unsigned long)ptr % CACHE_LINE_SIZE; + mod = (intptr_t)ptr % CACHE_LINE_SIZE; if(mod != 0) { ptr += (CACHE_LINE_SIZE - mod); } diff --git a/opal/class/opal_free_list.h b/opal/class/opal_free_list.h index d960865207..12bd4c1c5f 100644 --- a/opal/class/opal_free_list.h +++ b/opal/class/opal_free_list.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -44,14 +44,14 @@ struct opal_free_list_t opal_list_t fl_allocations; }; typedef struct opal_free_list_t opal_free_list_t; -OBJ_CLASS_DECLARATION(opal_free_list_t); +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_free_list_t); struct opal_free_list_item_t { opal_list_item_t super; }; typedef struct opal_free_list_item_t opal_free_list_item_t; -OBJ_CLASS_DECLARATION(opal_free_list_item_t); +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_free_list_item_t); /** * Initialize a free list. diff --git a/opal/class/opal_list.h b/opal/class/opal_list.h index 65145ea2a3..eba053f29c 100644 --- a/opal/class/opal_list.h +++ b/opal/class/opal_list.h @@ -172,7 +172,7 @@ typedef struct opal_list_t opal_list_t; static inline bool opal_list_is_empty(opal_list_t* list) { return (list->opal_list_sentinel.opal_list_next == - &(list->opal_list_sentinel)); + &(list->opal_list_sentinel) ? true : false); } @@ -682,8 +682,8 @@ static inline void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos * If index is greater than the length of the list, no action is * performed and false is returned. */ - bool opal_list_insert(opal_list_t *list, opal_list_item_t *item, - long long idx); + OPAL_DECLSPEC bool opal_list_insert(opal_list_t *list, opal_list_item_t *item, + long long idx); /** @@ -703,8 +703,8 @@ static inline void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos * containers remain valid, including those that point to elements * in \c xlist. */ - void opal_list_join(opal_list_t *thislist, opal_list_item_t *pos, - opal_list_t *xlist); + OPAL_DECLSPEC void opal_list_join(opal_list_t *thislist, opal_list_item_t *pos, + opal_list_t *xlist); /** @@ -730,9 +730,9 @@ static inline void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos * This is an O(N) operation because the length of both lists must * be recomputed. */ - void opal_list_splice(opal_list_t *thislist, opal_list_item_t *pos, - opal_list_t *xlist, opal_list_item_t *first, - opal_list_item_t *last); + OPAL_DECLSPEC void opal_list_splice(opal_list_t *thislist, opal_list_item_t *pos, + opal_list_t *xlist, opal_list_item_t *first, + opal_list_item_t *last); /** * Comparison function for opal_list_sort(), below. @@ -793,7 +793,7 @@ static inline void opal_list_insert_pos(opal_list_t *list, opal_list_item_t *pos * whatever the underlying type is). See the documentation of * opal_list_item_compare_fn_t for an example). */ - int opal_list_sort(opal_list_t* list, opal_list_item_compare_fn_t compare); + OPAL_DECLSPEC int opal_list_sort(opal_list_t* list, opal_list_item_compare_fn_t compare); #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/class/opal_object.h b/opal/class/opal_object.h index 9d306bfdb7..6da69d1492 100644 --- a/opal/class/opal_object.h +++ b/opal/class/opal_object.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -119,7 +119,9 @@ #include #endif /* HAVE_STDLIB_H */ +#if OMPI_HAVE_THREAD_SUPPORT #include "opal/sys/atomic.h" +#endif /* OMPI_HAVE_THREAD_SUPPORT */ /* * BEGIN_C_DECLS should be used at the beginning of your declarations, @@ -333,8 +335,8 @@ do { \ } while (0) BEGIN_C_DECLS -OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_object_t); +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_object_t); /* declarations *******************************************************/ diff --git a/opal/class/opal_value_array.h b/opal/class/opal_value_array.h index 84eb29e37c..ae26645fd3 100644 --- a/opal/class/opal_value_array.h +++ b/opal/class/opal_value_array.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -39,9 +39,6 @@ extern "C" { #endif -OPAL_DECLSPEC extern opal_class_t opal_value_array_t_class; - - struct opal_value_array_t { opal_object_t super; @@ -52,7 +49,7 @@ struct opal_value_array_t }; typedef struct opal_value_array_t opal_value_array_t; - +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_value_array_t); /** * Initialize the array to hold items by value. This routine must @@ -129,7 +126,7 @@ static inline size_t opal_value_array_get_size(opal_value_array_t* array) * return the new size. */ -int opal_value_array_set_size(opal_value_array_t* array, size_t size); +OPAL_DECLSPEC int opal_value_array_set_size(opal_value_array_t* array, size_t size); /** diff --git a/opal/event/buffer.c b/opal/event/buffer.c index 1a96c09b1a..7e57f829cb 100644 --- a/opal/event/buffer.c +++ b/opal/event/buffer.c @@ -343,7 +343,7 @@ evbuffer_read(struct evbuffer *buf, int fd, int howmuch) int n = EVBUFFER_MAX_READ; #endif -#ifdef FIONREAD +#if !defined(__WINDOWS__) && defined(FIONREAD) #ifdef WIN32 if (ioctlsocket(fd, FIONREAD, &n) == -1 || n == 0) { #else diff --git a/opal/event/evbuffer.c b/opal/event/evbuffer.c index 097ead48a2..93aa8fcad0 100644 --- a/opal/event/evbuffer.c +++ b/opal/event/evbuffer.c @@ -155,7 +155,12 @@ bufferevent_writecb(int fd, short event, void *arg) if (res == -1) { if (errno == EAGAIN || errno == EINTR || - errno == EINPROGRESS) +#if !defined(__WINDOWS__) + errno == EINPROGRESS +#else + 0 +#endif /* !defined(__WINDOWS__) */ + ) goto reschedule; /* error case */ what |= OPAL_EVBUFFER_ERROR; diff --git a/opal/event/event.c b/opal/event/event.c index dade17016b..aea2be00a8 100644 --- a/opal/event/event.c +++ b/opal/event/event.c @@ -82,16 +82,6 @@ extern const struct opal_eventop opal_kqops; extern const struct opal_eventop devpollops; #endif -#if 0 -/* This is to prevent event library from picking up the win32_ops - since this will be picked up over select(). By using select, we can - pretty much use the OOB and PTL as is. Otherwise, there would have - to be a lot of magic to be done to get this to work */ -#if defined(WIN32) && WIN32 -extern const struct opal_eventop opal_win32ops; -#endif -#endif - /* In order of preference */ static const struct opal_eventop *eventops[] = { #if 0 /* no KQUEUE or EPOLL support for us -- neither seem to work @@ -119,16 +109,18 @@ static const struct opal_eventop *eventops[] = { #if defined(HAVE_SELECT) && HAVE_SELECT &opal_selectops, #endif -#if 0 - /* This is to prevent event library from picking up the - win32_ops since this will be picked up over select(). By - using select, we can pretty much use the OOB and PTL as - is. Otherwise, there would have to be a lot of magic to be - done to get this to work */ -#if defined(WIN32) && WIN32 + /** + * One of the most stupid comment in the libevent project. Why ? How ? + * + * This is to prevent event library from picking up the + * win32_ops since this will be picked up over select(). By + * using select, we can pretty much use the OOB and PTL as + * is. Otherwise, there would have to be a lot of magic to be + * done to get this to work + */ +#if defined(__WINDOWS__) &opal_win32ops, -#endif -#endif +#endif /* defined(__WINDOWS__) */ NULL }; @@ -149,8 +141,6 @@ static int opal_event_haveevents(struct event_base *); static void opal_event_process_active(struct event_base *); -extern int opal_evsignal_restart(void); - static int timeout_next(struct event_base *, struct timeval *); static void timeout_process(struct event_base *); static void timeout_correct(struct event_base *, struct timeval *); @@ -237,7 +227,7 @@ opal_event_init(void) #if OPAL_HAVE_WORKING_EVENTOPS - if ((current_base = calloc(1, sizeof(struct event_base))) == NULL) + if ((current_base = (event_base*)calloc(1, sizeof(struct event_base))) == NULL) event_err(1, "%s: calloc"); event_sigcb = NULL; @@ -362,7 +352,7 @@ int opal_event_disable(void) int opal_event_restart(void) { -#if OPAL_HAVE_WORKING_EVENTOPS +#if OPAL_HAVE_WORKING_EVENTOPS && !defined(__WINDOWS__) int rc; #if OMPI_ENABLE_PROGRESS_THREADS opal_mutex_lock(&opal_event_lock); @@ -379,8 +369,10 @@ int opal_event_restart(void) #endif opal_event_enable(); +#if !defined(__WINDOWS__) if((rc = opal_evsignal_restart()) != 0) return OPAL_ERROR; +#endif /* defined(__WINDOWS__) */ return (OPAL_SUCCESS); #else /* OPAL_HAVE_WORKING_EVENTOPS */ return OPAL_ERR_NOT_SUPPORTED; @@ -568,7 +560,7 @@ opal_event_base_loop(struct event_base *base, int flags) } } } - +#if !defined(__WINDOWS__) /* Check if time is running backwards */ gettimeofday(&tv, NULL); if (timercmp(&tv, &base->event_tv, <)) { @@ -579,7 +571,7 @@ opal_event_base_loop(struct event_base *base, int flags) timeout_correct(base, &off); } base->event_tv = tv; - +#endif /* !defined(__WINDOWS__) */ if (!base->event_count_active && !(flags & OPAL_EVLOOP_NONBLOCK)) timeout_next(base, &tv); else diff --git a/opal/event/event.h b/opal/event/event.h index eac4913f1f..d599fcddab 100644 --- a/opal/event/event.h +++ b/opal/event/event.h @@ -27,22 +27,15 @@ #ifndef _EVENT_H_ #define _EVENT_H_ -#if defined(c_plusplus) || defined(__cplusplus) -extern "C" { -#endif - #include "opal_config.h" #include "opal/threads/mutex.h" #include "opal/event/event_rename.h" - #ifdef HAVE_SYS_TIME_H #include #endif -#include - #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include @@ -50,6 +43,10 @@ extern "C" { typedef unsigned char u_char; #endif +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + #define OPAL_EVLIST_TIMEOUT 0x01 #define OPAL_EVLIST_INSERTED 0x02 #define OPAL_EVLIST_SIGNAL 0x04 @@ -126,11 +123,11 @@ struct opal_event { int ev_res; /* result passed to event callback */ int ev_flags; -#if defined(__WINDOWS__) - HANDLE base_handle; - HANDLE registered_handle; - struct opal_event* ev_similar; -#endif /* defined(__WINDOWS__) */ +#if defined(__WINDOWS__) + HANDLE base_handle; + HANDLE registered_handle; + struct opal_event* ev_similar; +#endif /* defined(__WINDOWS__) */ }; typedef struct opal_event opal_event_t; @@ -181,7 +178,9 @@ int opal_event_base_set(struct event_base *, struct opal_event *); #define OPAL_EVLOOP_ONCE 0x01 #define OPAL_EVLOOP_NONBLOCK 0x02 -#define OPAL_EVLOOP_ONELOOP 0x04 + /* run once through the loop, but do have the default timeout. + Need to be both something special *AND* EVLOOP_ONCE */ +#define OPAL_EVLOOP_ONELOOP 0x05 OPAL_DECLSPEC int opal_event_loop(int); int opal_event_base_loop(struct event_base *, int); @@ -218,7 +217,7 @@ extern struct event_base *current_base; /* public functions */ -void +OPAL_DECLSPEC void opal_event_set(struct opal_event *ev, int fd, short events, void (*callback)(int, short, void *), void *arg); @@ -388,6 +387,14 @@ int evbuffer_read(struct evbuffer *, int, int); u_char *evbuffer_find(struct evbuffer *, const u_char *, size_t); void evbuffer_setcb(struct evbuffer *, void (*)(struct evbuffer *, size_t, size_t, void *), void *); +/* This is to prevent event library from picking up the win32_ops + since this will be picked up over select(). By using select, we can + pretty much use the OOB and PTL as is. Otherwise, there would have + to be a lot of magic to be done to get this to work */ +#if defined(__WINDOWS__) +extern const struct opal_eventop opal_win32ops; +#endif /* defined(__WINDOWS__) */ + #if defined(c_plusplus) || defined(__cplusplus) } #endif @@ -404,6 +411,8 @@ void evbuffer_setcb(struct evbuffer *, void (*)(struct evbuffer *, size_t, size_ #define OPAL_HAVE_WORKING_EVENTOPS 1 #elif defined(HAVE_WORKING_KQUEUE) && HAVE_WORKING_KQUEUE #define OPAL_HAVE_WORKING_EVENTOPS 1 +#elif defined(__WINDOWS__) +#define OPAL_HAVE_WORKING_EVENTOPS 1 #else #define OPAL_HAVE_WORKING_EVENTOPS 0 #endif diff --git a/opal/event/log.h b/opal/event/log.h index e19d8a06ea..dad2465b7e 100644 --- a/opal/event/log.h +++ b/opal/event/log.h @@ -27,6 +27,8 @@ #ifndef _LOG_H_ #define _LOG_H_ +#include "opal/event/event_rename.h" + void event_err(int eval, const char *fmt, ...); void event_warn(const char *fmt, ...); void event_errx(int eval, const char *fmt, ...); diff --git a/opal/include/opal/sys/win32/atomic.h b/opal/include/opal/sys/win32/atomic.h index fa9cd49f17..7bf374c356 100644 --- a/opal/include/opal/sys/win32/atomic.h +++ b/opal/include/opal/sys/win32/atomic.h @@ -116,21 +116,29 @@ static inline int32_t opal_atomic_sub_32(volatile int32_t *addr, int32_t delta) static inline int opal_atomic_cmpset_acq_64( volatile int64_t *addr, int64_t oldval, int64_t newval) { -#if OMPI_ENABLE_DEBUG /* The address should be 64 bits aligned otherwise ... * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/interlockedcompareexchange64.asp */ -#endif /* OMPI_ENABLE_DEBUG */ - int64_t ret = InterlockedCompareExchangeAcquire64 ((int64_t volatile*) addr, +#if HAVE_INTERLOCKEDCOMPAREEXCHANGEACQUIRE64 + int64_t ret = InterlockedCompareExchangeAcquire64 ((int64_t volatile*) addr, (int64_t) newval, (int64_t) oldval); +#else + int64_t ret = InterlockedCompareExchange64 ((int64_t volatile*) addr, + (int64_t) newval, (int64_t) oldval); +#endif /* HAVE_INTERLOCKEDCOMPAREEXCHANGEACQUIRE64 */ return (oldval == ret) ? 1: 0; } static inline int opal_atomic_cmpset_rel_64( volatile int64_t *addr, int64_t oldval, int64_t newval) { +#if HAVE_INTERLOCKEDCOMPAREEXCHANGERELEASE64 int64_t ret = InterlockedCompareExchangeRelease64 ((int64_t volatile*) addr, (int64_t) newval, (int64_t) oldval); +#else + int64_t ret = InterlockedCompareExchange64 ((int64_t volatile*) addr, + (int64_t) newval, (int64_t) oldval); +#endif /* HAVE_INTERLOCKEDCOMPAREEXCHANGERELEASE64 */ return (oldval == ret) ? 1: 0; } diff --git a/opal/mca/backtrace/base/base.h b/opal/mca/backtrace/base/base.h index 86fbb1bfa1..d1b0ceb3d0 100644 --- a/opal/mca/backtrace/base/base.h +++ b/opal/mca/backtrace/base/base.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -69,7 +69,7 @@ extern "C" { */ OPAL_DECLSPEC int opal_backtrace_base_close(void); - extern opal_list_t opal_backtrace_base_components_opened; + OPAL_DECLSPEC extern opal_list_t opal_backtrace_base_components_opened; #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/mca/backtrace/none/backtrace_none_component.c b/opal/mca/backtrace/none/backtrace_none_component.c index d5cad610e6..bcd4d42d0d 100644 --- a/opal/mca/backtrace/none/backtrace_none_component.c +++ b/opal/mca/backtrace/none/backtrace_none_component.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -20,6 +20,14 @@ #include "opal/mca/backtrace/backtrace.h" +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { + OPAL_DECLSPEC extern const opal_backtrace_base_component_1_0_0_t mca_backtrace_none_component; +#endif +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + const opal_backtrace_base_component_1_0_0_t mca_backtrace_none_component = { /* First, the mca_component_t struct containing meta information about the component itself */ diff --git a/opal/mca/base/base.h b/opal/mca/base/base.h index 9d1b487d47..948d6b92b9 100644 --- a/opal/mca/base/base.h +++ b/opal/mca/base/base.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -42,8 +42,7 @@ struct mca_base_component_list_item_t { const mca_base_component_t *cli_component; }; typedef struct mca_base_component_list_item_t mca_base_component_list_item_t; -OBJ_CLASS_DECLARATION(mca_base_component_list_item_t); - +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_component_list_item_t); /* * Structure for making priority lists of components @@ -55,15 +54,14 @@ struct mca_base_component_priority_list_item_t { }; typedef struct mca_base_component_priority_list_item_t mca_base_component_priority_list_item_t; -OBJ_CLASS_DECLARATION(mca_base_component_priority_list_item_t); +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_component_priority_list_item_t); /* * Public variables */ OPAL_DECLSPEC extern int mca_base_param_component_path; - /* * Public functions */ @@ -112,7 +110,7 @@ OPAL_DECLSPEC int mca_base_component_compare_priority(mca_base_component_priori mca_base_component_priority_list_item_t *b); OPAL_DECLSPEC int mca_base_component_compare(const mca_base_component_t *a, const mca_base_component_t *b); - int mca_base_component_compatible(const mca_base_component_t *a, +OPAL_DECLSPEC int mca_base_component_compatible(const mca_base_component_t *a, const mca_base_component_t *b); /* mca_base_component_find.c */ diff --git a/opal/mca/base/mca_base_param.h b/opal/mca/base/mca_base_param.h index bbd6ba9ac2..f9abf49b41 100644 --- a/opal/mca/base/mca_base_param.h +++ b/opal/mca/base/mca_base_param.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -111,11 +111,6 @@ struct mca_base_param_info_t { * Convenience typedef */ typedef struct mca_base_param_info_t mca_base_param_info_t; -/** - * Make a real object for the info - */ -OBJ_CLASS_DECLARATION(mca_base_param_info_t); - /* * Global functions for MCA @@ -124,6 +119,11 @@ OBJ_CLASS_DECLARATION(mca_base_param_info_t); #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif + /** + * Make a real object for the info + */ + OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_param_info_t); + /** * Initialize the MCA parameter system. * diff --git a/opal/mca/base/mca_base_param_internal.h b/opal/mca/base/mca_base_param_internal.h index a7953261a4..4433a3e5fa 100644 --- a/opal/mca/base/mca_base_param_internal.h +++ b/opal/mca/base/mca_base_param_internal.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -39,6 +39,10 @@ #include "opal/class/opal_hash_table.h" #include "opal/mca/base/mca_base_param.h" +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + /** * \internal * @@ -114,7 +118,7 @@ typedef struct mca_base_param_t mca_base_param_t; * * Object delcataion for mca_base_param_t */ -OBJ_CLASS_DECLARATION(mca_base_param_t); +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_param_t); /** @@ -141,7 +145,7 @@ typedef struct mca_base_param_file_value_t mca_base_param_file_value_t; /** * Object declaration for mca_base_param_file_value_t */ -OBJ_CLASS_DECLARATION(mca_base_param_file_value_t); +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_param_file_value_t); /** @@ -151,16 +155,13 @@ OBJ_CLASS_DECLARATION(mca_base_param_file_value_t); */ OPAL_DECLSPEC extern opal_list_t mca_base_param_file_values; +/** + * \internal + * + * Parse a parameter file. + */ +OPAL_DECLSPEC int mca_base_parse_paramfile(const char *paramfile); -#if defined(c_plusplus) || defined(__cplusplus) -extern "C" { -#endif - /** - * \internal - * - * Parse a parameter file. - */ - int mca_base_parse_paramfile(const char *paramfile); #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/opal/mca/maffinity/base/Makefile.am b/opal/mca/maffinity/base/Makefile.am index 4905a1b5a3..9506ab056f 100644 --- a/opal/mca/maffinity/base/Makefile.am +++ b/opal/mca/maffinity/base/Makefile.am @@ -17,8 +17,7 @@ # headers += \ - base/base.h \ - base/internal.h + base/base.h libmca_maffinity_la_SOURCES += \ base/maffinity_base_close.c \ diff --git a/opal/mca/maffinity/base/base.h b/opal/mca/maffinity/base/base.h index cb34cf07a5..f5beda12b5 100644 --- a/opal/mca/maffinity/base/base.h +++ b/opal/mca/maffinity/base/base.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -119,6 +119,40 @@ extern "C" { * framework. */ OPAL_DECLSPEC int opal_maffinity_base_close(void); + + /** + * Indication of whether a component was successfully selected or + * not + */ + OPAL_DECLSPEC extern bool opal_maffinity_base_selected; + + /** + * Global component struct for the selected component + */ + OPAL_DECLSPEC extern const opal_maffinity_base_component_1_0_0_t + *opal_maffinity_base_component; + /** + * Global module struct for the selected module + */ + OPAL_DECLSPEC extern const opal_maffinity_base_module_1_0_0_t + *opal_maffinity_base_module; + + /** + * Indicator as to whether the list of opened maffinity components + * is valid or not. + */ + OPAL_DECLSPEC extern bool opal_maffinity_base_components_opened_valid; + /** + * List of all opened components; created when the maffinity + * framework is initialized and destroyed when we reduce the list + * to all available maffinity components. + */ + OPAL_DECLSPEC extern opal_list_t opal_maffinity_base_components_opened; + + /** + * Debugging output stream + */ + extern int opal_maffinity_base_output; #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/mca/maffinity/base/internal.h b/opal/mca/maffinity/base/internal.h deleted file mode 100644 index a7c35e9ebc..0000000000 --- a/opal/mca/maffinity/base/internal.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - */ - -#ifndef OPAL_MAFFINITY_BASE_INTERNAL_H -#define OPAL_MAFFINITY_BASE_INTERNAL_H - -#include "opal_config.h" - -#include "opal/class/opal_list.h" -#include "opal/mca/maffinity/maffinity.h" - - -/** - * @file - * - * Global functions for MCA overall maffinity open and close - */ - -#if defined(c_plusplus) || defined(__cplusplus) -extern "C" { -#endif - - /** - * Indication of whether a component was successfully selected or - * not - */ - OPAL_DECLSPEC extern bool opal_maffinity_base_selected; - - /** - * Global component struct for the selected component - */ - OPAL_DECLSPEC extern const opal_maffinity_base_component_1_0_0_t - *opal_maffinity_base_component; - /** - * Global module struct for the selected module - */ - OPAL_DECLSPEC extern const opal_maffinity_base_module_1_0_0_t - *opal_maffinity_base_module; - - /** - * Indicator as to whether the list of opened maffinity components - * is valid or not. - */ - OPAL_DECLSPEC extern bool opal_maffinity_base_components_opened_valid; - /** - * List of all opened components; created when the maffinity - * framework is initialized and destroyed when we reduce the list - * to all available maffinity components. - */ - OPAL_DECLSPEC extern opal_list_t opal_maffinity_base_components_opened; - - /** - * Debugging output stream - */ - OPAL_DECLSPEC extern int opal_maffinity_base_output; - -#if defined(c_plusplus) || defined(__cplusplus) -} -#endif -#endif /* OPAL_MAFFINITY_BASE_INTERNAL_H */ diff --git a/opal/mca/maffinity/base/maffinity_base_close.c b/opal/mca/maffinity/base/maffinity_base_close.c index 9e087cf5b8..c15800868a 100644 --- a/opal/mca/maffinity/base/maffinity_base_close.c +++ b/opal/mca/maffinity/base/maffinity_base_close.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -23,8 +23,6 @@ #include "opal/mca/base/base.h" #include "opal/mca/maffinity/maffinity.h" #include "opal/mca/maffinity/base/base.h" -#include "opal/mca/maffinity/base/internal.h" - int opal_maffinity_base_close(void) { diff --git a/opal/mca/maffinity/base/maffinity_base_select.c b/opal/mca/maffinity/base/maffinity_base_select.c index 24e13c7383..b465840b74 100644 --- a/opal/mca/maffinity/base/maffinity_base_select.c +++ b/opal/mca/maffinity/base/maffinity_base_select.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -26,8 +26,6 @@ #include "opal/mca/base/mca_base_param.h" #include "opal/mca/maffinity/maffinity.h" #include "opal/mca/maffinity/base/base.h" -#include "opal/mca/maffinity/base/internal.h" - /* * Globals diff --git a/opal/mca/maffinity/base/maffinity_base_wrappers.c b/opal/mca/maffinity/base/maffinity_base_wrappers.c index 4d4935384b..ec843eb82a 100644 --- a/opal/mca/maffinity/base/maffinity_base_wrappers.c +++ b/opal/mca/maffinity/base/maffinity_base_wrappers.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -22,8 +22,6 @@ #include "opal/constants.h" #include "opal/mca/maffinity/maffinity.h" #include "opal/mca/maffinity/base/base.h" -#include "opal/mca/maffinity/base/internal.h" - int opal_maffinity_base_set(opal_maffinity_base_segment_t *segments, size_t num_segments) diff --git a/opal/mca/maffinity/first_use/maffinity_first_use.h b/opal/mca/maffinity/first_use/maffinity_first_use.h index 33a6c1f0fb..a13d32c4fa 100644 --- a/opal/mca/maffinity/first_use/maffinity_first_use.h +++ b/opal/mca/maffinity/first_use/maffinity_first_use.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -39,7 +39,7 @@ extern "C" { /** * Globally exported variable */ - OPAL_DECLSPEC extern const opal_maffinity_base_component_1_0_0_t + OPAL_MODULE_DECLSPEC extern const opal_maffinity_base_component_1_0_0_t mca_maffinity_first_use_component; diff --git a/opal/mca/memcpy/base/base.h b/opal/mca/memcpy/base/base.h index 8aa416c9fe..15272dd5d6 100644 --- a/opal/mca/memcpy/base/base.h +++ b/opal/mca/memcpy/base/base.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * $COPYRIGHT$ @@ -62,7 +62,7 @@ extern "C" { */ OPAL_DECLSPEC int opal_memcpy_base_close(void); - extern opal_list_t opal_memcpy_base_components_opened; + OPAL_DECLSPEC extern opal_list_t opal_memcpy_base_components_opened; #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/mca/memory/base/base.h b/opal/mca/memory/base/base.h index 1284037bff..d5db7fe2eb 100644 --- a/opal/mca/memory/base/base.h +++ b/opal/mca/memory/base/base.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -69,7 +69,7 @@ extern "C" { */ OPAL_DECLSPEC int opal_memory_base_close(void); - extern opal_list_t opal_memory_base_components_opened; + OPAL_DECLSPEC extern opal_list_t opal_memory_base_components_opened; #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/mca/paffinity/base/Makefile.am b/opal/mca/paffinity/base/Makefile.am index e078461d90..4142c25c48 100644 --- a/opal/mca/paffinity/base/Makefile.am +++ b/opal/mca/paffinity/base/Makefile.am @@ -17,8 +17,7 @@ # headers += \ - base/base.h \ - base/internal.h + base/base.h libmca_paffinity_la_SOURCES += \ base/paffinity_base_close.c \ diff --git a/opal/mca/paffinity/base/base.h b/opal/mca/paffinity/base/base.h index 66e9ff6dfe..737bfbaa9c 100644 --- a/opal/mca/paffinity/base/base.h +++ b/opal/mca/paffinity/base/base.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -153,7 +153,41 @@ extern "C" { * framework. */ OPAL_DECLSPEC int opal_paffinity_base_close(void); - + + /** + * Indication of whether a component was successfully selected or + * not + */ + OPAL_DECLSPEC extern bool opal_paffinity_base_selected; + + /** + * Global component struct for the selected component + */ + OPAL_DECLSPEC extern const opal_paffinity_base_component_1_0_0_t + *opal_paffinity_base_component; + /** + * Global module struct for the selected module + */ + OPAL_DECLSPEC extern const opal_paffinity_base_module_1_0_0_t + *opal_paffinity_base_module; + + /** + * Indicator as to whether the list of opened paffinity components + * is valid or not. + */ + OPAL_DECLSPEC extern bool opal_paffinity_base_components_opened_valid; + /** + * List of all opened components; created when the paffinity + * framework is initialized and destroyed when we reduce the list + * to all available paffinity components. + */ + OPAL_DECLSPEC extern opal_list_t opal_paffinity_base_components_opened; + + /** + * Debugging output stream + */ + extern int opal_paffinity_base_output; + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/opal/mca/paffinity/base/internal.h b/opal/mca/paffinity/base/internal.h deleted file mode 100644 index 6e6f3aa445..0000000000 --- a/opal/mca/paffinity/base/internal.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - */ - -#ifndef OPAL_PAFFINITY_BASE_INTERNAL_H -#define OPAL_PAFFINITY_BASE_INTERNAL_H - -#include "opal_config.h" - -#include "opal/class/opal_list.h" -#include "opal/mca/paffinity/paffinity.h" - - -/* - * Global functions for MCA overall paffinity open and close - */ -/** @file */ - -#if defined(c_plusplus) || defined(__cplusplus) -extern "C" { -#endif - - /** - * Indication of whether a component was successfully selected or - * not - */ - OPAL_DECLSPEC extern bool opal_paffinity_base_selected; - - /** - * Global component struct for the selected component - */ - OPAL_DECLSPEC extern const opal_paffinity_base_component_1_0_0_t - *opal_paffinity_base_component; - /** - * Global module struct for the selected module - */ - OPAL_DECLSPEC extern const opal_paffinity_base_module_1_0_0_t - *opal_paffinity_base_module; - - /** - * Indicator as to whether the list of opened paffinity components - * is valid or not. - */ - OPAL_DECLSPEC extern bool opal_paffinity_base_components_opened_valid; - /** - * List of all opened components; created when the paffinity - * framework is initialized and destroyed when we reduce the list - * to all available paffinity components. - */ - OPAL_DECLSPEC extern opal_list_t opal_paffinity_base_components_opened; - - /** - * Debugging output stream - */ - OPAL_DECLSPEC extern int opal_paffinity_base_output; - -#if defined(c_plusplus) || defined(__cplusplus) -} -#endif -#endif /* OPAL_PAFFINITY_BASE_INTERNAL_H */ diff --git a/opal/mca/paffinity/base/paffinity_base_close.c b/opal/mca/paffinity/base/paffinity_base_close.c index a90ee3622e..391ab418cf 100644 --- a/opal/mca/paffinity/base/paffinity_base_close.c +++ b/opal/mca/paffinity/base/paffinity_base_close.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -23,8 +23,6 @@ #include "opal/mca/base/base.h" #include "opal/mca/paffinity/paffinity.h" #include "opal/mca/paffinity/base/base.h" -#include "opal/mca/paffinity/base/internal.h" - int opal_paffinity_base_close(void) { diff --git a/opal/mca/paffinity/base/paffinity_base_select.c b/opal/mca/paffinity/base/paffinity_base_select.c index 18547a1dbd..86d5260075 100644 --- a/opal/mca/paffinity/base/paffinity_base_select.c +++ b/opal/mca/paffinity/base/paffinity_base_select.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -26,8 +26,6 @@ #include "opal/mca/base/mca_base_param.h" #include "opal/mca/paffinity/paffinity.h" #include "opal/mca/paffinity/base/base.h" -#include "opal/mca/paffinity/base/internal.h" - /* * Globals diff --git a/opal/mca/paffinity/base/paffinity_base_wrappers.c b/opal/mca/paffinity/base/paffinity_base_wrappers.c index 42d25c2ed6..429ee5bfc3 100644 --- a/opal/mca/paffinity/base/paffinity_base_wrappers.c +++ b/opal/mca/paffinity/base/paffinity_base_wrappers.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -22,8 +22,6 @@ #include "opal/constants.h" #include "opal/mca/paffinity/paffinity.h" #include "opal/mca/paffinity/base/base.h" -#include "opal/mca/paffinity/base/internal.h" - int opal_paffinity_base_get_num_processors(int *num_procs) { diff --git a/opal/mca/paffinity/windows/paffinity_windows.h b/opal/mca/paffinity/windows/paffinity_windows.h index 47637be694..b6bdda3366 100644 --- a/opal/mca/paffinity/windows/paffinity_windows.h +++ b/opal/mca/paffinity/windows/paffinity_windows.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -52,7 +52,7 @@ extern "C" { /** * Globally exported variable */ - OPAL_DECLSPEC extern const opal_paffinity_base_component_1_0_0_t + OPAL_MODULE_DECLSPEC extern const opal_paffinity_base_component_1_0_0_t mca_paffinity_windows_component; diff --git a/opal/mca/paffinity/windows/paffinity_windows_module.c b/opal/mca/paffinity/windows/paffinity_windows_module.c index af702ea983..6d04458d90 100644 --- a/opal/mca/paffinity/windows/paffinity_windows_module.c +++ b/opal/mca/paffinity/windows/paffinity_windows_module.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -91,8 +91,6 @@ static int windows_module_set(int id) static int windows_module_get(int *id) { - unsigned int i; - return OPAL_SUCCESS; } diff --git a/opal/mca/timer/aix/timer_aix.h b/opal/mca/timer/aix/timer_aix.h index 2f6c56a421..abdb4c70ed 100644 --- a/opal/mca/timer/aix/timer_aix.h +++ b/opal/mca/timer/aix/timer_aix.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -21,6 +21,10 @@ #include +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + typedef uint64_t opal_timer_t; extern opal_timer_t opal_timer_aix_freq_mhz; @@ -66,4 +70,8 @@ opal_timer_base_get_freq() #define OPAL_TIMER_USEC_NATIVE 1 #define OPAL_TIMER_USEC_SUPPORTED 1 +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + #endif diff --git a/opal/mca/timer/base/base.h b/opal/mca/timer/base/base.h index 24866dd745..2c2e7c405d 100644 --- a/opal/mca/timer/base/base.h +++ b/opal/mca/timer/base/base.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -69,7 +69,7 @@ extern "C" { */ OPAL_DECLSPEC int opal_timer_base_close(void); - extern opal_list_t opal_timer_base_components_opened; + OPAL_DECLSPEC extern opal_list_t opal_timer_base_components_opened; #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/memoryhooks/memory.c b/opal/memoryhooks/memory.c index 446f063577..54eeaaadaf 100644 --- a/opal/memoryhooks/memory.c +++ b/opal/memoryhooks/memory.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -120,7 +120,7 @@ opal_mem_hooks_set_support(int support) /* called from the memory manager / memory-manager specific hooks */ void -opal_mem_hooks_alloc_hook(void *buf, size_t length, int from_alloc) +opal_mem_hooks_alloc_hook(void *buf, size_t length, bool from_alloc) { opal_list_item_t *item; @@ -153,7 +153,7 @@ opal_mem_hooks_alloc_hook(void *buf, size_t length, int from_alloc) /* called from the memory manager / memory-manager specific hooks */ void -opal_mem_hooks_release_hook(void *buf, size_t length, int from_alloc) +opal_mem_hooks_release_hook(void *buf, size_t length, bool from_alloc) { opal_list_item_t *item; diff --git a/opal/memoryhooks/memory.h b/opal/memoryhooks/memory.h index 0b7409b208..ddc3eef4be 100644 --- a/opal/memoryhooks/memory.h +++ b/opal/memoryhooks/memory.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -58,7 +58,7 @@ extern "C" { * * @retval OPAL_SUCCESS Initialization completed successfully */ -int opal_mem_hooks_init(void); +OPAL_DECLSPEC int opal_mem_hooks_init(void); /** @@ -76,7 +76,7 @@ int opal_mem_hooks_init(void); * * @retval OPAL_SUCCESS Shutdown completed successfully */ -int opal_mem_hooks_finalize(void); +OPAL_DECLSPEC int opal_mem_hooks_finalize(void); /** @@ -108,7 +108,7 @@ int opal_mem_hooks_finalize(void); * * \note This function must be called after opal_mem_hooks_init(). */ -int opal_mem_hooks_support_level(void); +OPAL_DECLSPEC int opal_mem_hooks_support_level(void); /** @@ -147,8 +147,8 @@ typedef void (opal_mem_hooks_callback_fn_t)(void *buf, size_t length, * @retval OPAL_ERR_NOT_SUPPORTED There are no hooks available for * receiving callbacks when memory is to be allocated */ -int opal_mem_hooks_register_alloc(opal_mem_hooks_callback_fn_t *func, - void *cbdata); +OPAL_DECLSPEC int opal_mem_hooks_register_alloc(opal_mem_hooks_callback_fn_t *func, + void *cbdata); /** @@ -167,8 +167,8 @@ int opal_mem_hooks_register_alloc(opal_mem_hooks_callback_fn_t *func, * @retval OPAL_ERR_NOT_SUPPORTED There are no hooks available for * receiving callbacks when memory is to be released */ -int opal_mem_hooks_register_release(opal_mem_hooks_callback_fn_t *func, - void *cbdata); +OPAL_DECLSPEC int opal_mem_hooks_register_release(opal_mem_hooks_callback_fn_t *func, + void *cbdata); /** @@ -181,7 +181,7 @@ int opal_mem_hooks_register_release(opal_mem_hooks_callback_fn_t *func, * @retval OPAL_SUCCESS The function was successfully deregistered * @retval OPAL_ERR_NOT_FOUND The function was not previously registered */ -int opal_mem_hooks_unregister_alloc(opal_mem_hooks_callback_fn_t *func); +OPAL_DECLSPEC int opal_mem_hooks_unregister_alloc(opal_mem_hooks_callback_fn_t *func); /** @@ -194,7 +194,7 @@ int opal_mem_hooks_unregister_alloc(opal_mem_hooks_callback_fn_t *func); * @retval OPAL_SUCCESS The function was successfully deregistered * @retval OPAL_ERR_NOT_FOUND The function was not previously registered */ -int opal_mem_hooks_unregister_release(opal_mem_hooks_callback_fn_t *func); +OPAL_DECLSPEC int opal_mem_hooks_unregister_release(opal_mem_hooks_callback_fn_t *func); #if defined(c_plusplus) || defined(__cplusplus) diff --git a/opal/memoryhooks/memory_internal.h b/opal/memoryhooks/memory_internal.h index 86d94cc0b0..d5961926a5 100644 --- a/opal/memoryhooks/memory_internal.h +++ b/opal/memoryhooks/memory_internal.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -30,8 +30,8 @@ extern "C" { void opal_mem_hooks_set_support(int support); -void opal_mem_hooks_release_hook(void *buf, size_t length, int from_alloc); -void opal_mem_hooks_alloc_hook(void *buf, size_t length, int from_alloc); +void opal_mem_hooks_release_hook(void *buf, size_t length, bool from_alloc); +void opal_mem_hooks_alloc_hook(void *buf, size_t length, bool from_alloc); #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/runtime/opal_progress.h b/opal/runtime/opal_progress.h index e16edabc62..3eca01c801 100644 --- a/opal/runtime/opal_progress.h +++ b/opal/runtime/opal_progress.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -37,7 +37,7 @@ extern "C" { * functions. At this point, any function in the progress engine * interface may be called. */ -OPAL_DECLSPEC extern int opal_progress_init(void); +OPAL_DECLSPEC int opal_progress_init(void); /** * Configure the progress engine for executing MPI applications @@ -48,7 +48,7 @@ OPAL_DECLSPEC extern int opal_progress_init(void); * \note opal_progress_init() must be called before calling * this function. Failure to do so is an error. */ -OPAL_DECLSPEC extern int opal_progress_mpi_init(void); +OPAL_DECLSPEC int opal_progress_mpi_init(void); /** * Turn on optimizations for MPI progress @@ -58,7 +58,7 @@ OPAL_DECLSPEC extern int opal_progress_mpi_init(void); * active use and possibly disabling the sched_yield call when the * progress engine is idle */ -OPAL_DECLSPEC extern int opal_progress_mpi_enable(void); +OPAL_DECLSPEC int opal_progress_mpi_enable(void); /** * Turn off all optimizations enabled by opal_progress_mpi_enable(). @@ -67,7 +67,7 @@ OPAL_DECLSPEC extern int opal_progress_mpi_enable(void); * opal_progress_mpi_enable(). The event library resumes constant * ticking and the progress engine yields the CPU when idle. */ -OPAL_DECLSPEC extern int opal_progress_mpi_disable(void); +OPAL_DECLSPEC int opal_progress_mpi_disable(void); /** * Shut down the progress engine @@ -76,17 +76,17 @@ OPAL_DECLSPEC extern int opal_progress_mpi_disable(void); * registered callbacks and freeing all resources. After finalize * returns, no calls into the progress interface are allowed. */ -OPAL_DECLSPEC extern int opal_progress_finalize(void); +OPAL_DECLSPEC int opal_progress_finalize(void); /** * Control how the event library is called */ -OPAL_DECLSPEC extern void opal_progress_events(int); +OPAL_DECLSPEC void opal_progress_events(int); /** * Progress all pending events */ -OPAL_DECLSPEC extern void opal_progress(void); +OPAL_DECLSPEC void opal_progress(void); typedef int (*opal_progress_callback_t)(void); @@ -117,9 +117,8 @@ OPAL_DECLSPEC int opal_progress_event_decrement(void); * Progress until flag is true or poll iterations completed */ -extern volatile int32_t opal_progress_thread_count; -extern int opal_progress_spin_count; - +OPAL_DECLSPEC extern volatile int32_t opal_progress_thread_count; +OPAL_DECLSPEC extern int opal_progress_spin_count; static inline bool opal_progress_threads(void) { diff --git a/opal/threads/mutex.h b/opal/threads/mutex.h index 8150a2c617..594bd6ecac 100644 --- a/opal/threads/mutex.h +++ b/opal/threads/mutex.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -20,7 +20,9 @@ #define OPAL_MUTEX_H 1 #include "opal_config.h" +#if OMPI_HAVE_THREAD_SUPPORT #include "opal/sys/atomic.h" +#endif /* OMPI_HAVE_THREAD_SUPPORT */ #if defined(c_plusplus) || defined(__cplusplus) extern "C" { diff --git a/opal/threads/mutex_unix.h b/opal/threads/mutex_unix.h index 1fcd9f1f46..4e29f89145 100644 --- a/opal/threads/mutex_unix.h +++ b/opal/threads/mutex_unix.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -197,7 +197,7 @@ static inline void opal_mutex_atomic_unlock(opal_mutex_t *m) #else /************************************************************************ - * Stanard locking + * Standard locking ************************************************************************/ static inline int opal_mutex_atomic_trylock(opal_mutex_t *m) diff --git a/opal/threads/threads.h b/opal/threads/threads.h index 71ca9d015e..e721f01745 100644 --- a/opal/threads/threads.h +++ b/opal/threads/threads.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -26,6 +26,7 @@ #endif #include "opal/class/opal_object.h" + #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif @@ -50,10 +51,10 @@ typedef struct opal_thread_t opal_thread_t; OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_thread_t); -int opal_thread_start(opal_thread_t *); -int opal_thread_join(opal_thread_t *, void **thread_return); -bool opal_thread_self_compare(opal_thread_t*); -opal_thread_t *opal_thread_get_self(void); +OPAL_DECLSPEC int opal_thread_start(opal_thread_t *); +OPAL_DECLSPEC int opal_thread_join(opal_thread_t *, void **thread_return); +OPAL_DECLSPEC bool opal_thread_self_compare(opal_thread_t*); +OPAL_DECLSPEC opal_thread_t *opal_thread_get_self(void); #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/opal/tools/wrappers/Makefile.am b/opal/tools/wrappers/Makefile.am index 800683404b..9504d31baa 100644 --- a/opal/tools/wrappers/Makefile.am +++ b/opal/tools/wrappers/Makefile.am @@ -2,7 +2,7 @@ # Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana # University Research and Technology # Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University +# Copyright (c) 2004-2006 The University of Tennessee and The University # of Tennessee Research Foundation. All rights # reserved. # Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -22,6 +22,8 @@ opal_wrapper_SOURCES = \ opal_wrapper_LDADD = $(top_builddir)/opal/libopal.la opal_wrapper_DEPENDENCIES = $(top_builddir)/opal/libopal.la +DEFS="-DEXEEXT=\"$(EXEEXT)\"" + if OMPI_INSTALL_BINARIES nodist_pkgdata_DATA = \ diff --git a/opal/util/cmd_line.c b/opal/util/cmd_line.c index 17a5d25d0e..f3b20a9a96 100644 --- a/opal/util/cmd_line.c +++ b/opal/util/cmd_line.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -68,9 +68,10 @@ struct cmd_line_option_t { typedef struct cmd_line_option_t cmd_line_option_t; static void option_constructor(cmd_line_option_t *cmd); static void option_destructor(cmd_line_option_t *cmd); -static OBJ_CLASS_INSTANCE(cmd_line_option_t, - opal_list_item_t, - option_constructor, option_destructor); + +OBJ_CLASS_INSTANCE(cmd_line_option_t, + opal_list_item_t, + option_constructor, option_destructor); /* * An option that was used in the argv that was parsed @@ -99,9 +100,9 @@ struct cmd_line_param_t { typedef struct cmd_line_param_t cmd_line_param_t; static void param_constructor(cmd_line_param_t *cmd); static void param_destructor(cmd_line_param_t *cmd); -static OBJ_CLASS_INSTANCE(cmd_line_param_t, - opal_list_item_t, - param_constructor, param_destructor); +OBJ_CLASS_INSTANCE(cmd_line_param_t, + opal_list_item_t, + param_constructor, param_destructor); /* * Instantiate the opal_cmd_line_t class @@ -481,7 +482,7 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown, */ char *opal_cmd_line_get_usage_msg(opal_cmd_line_t *cmd) { - int i, len = MAX_WIDTH * 2, prev_len; + size_t i, len = MAX_WIDTH * 2, prev_len; int argc; size_t j; char **argv; @@ -553,7 +554,7 @@ char *opal_cmd_line_get_usage_msg(opal_cmd_line_t *cmd) filled = true; } strcat(line, " "); - for (i = 0; i < option->clo_num_params; ++i) { + for (i = 0; (int)i < option->clo_num_params; ++i) { snprintf(temp, len, " ", i); strcat(line, temp); } @@ -1036,7 +1037,7 @@ static int split_shorts(opal_cmd_line_t *cmd, char *token, char **args, (argv[i] + 1), will be empty by the time it gets down here), just return that we didn't find a short option. */ - len = strlen(token); + len = (int)strlen(token); if (0 == len) { return OPAL_ERR_BAD_PARAM; } @@ -1117,7 +1118,7 @@ static void set_dest(cmd_line_option_t *option, char *sval) { int ival = atoi(sval); long lval = strtol(sval, NULL, 10); - char *str; + char *str = NULL; /* Set MCA param. We do this in the environment because the MCA parameter may not have been registered yet -- and if it isn't diff --git a/opal/util/convert.c b/opal/util/convert.c index 36165ab8f3..0154fbc35b 100644 --- a/opal/util/convert.c +++ b/opal/util/convert.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -30,7 +30,7 @@ */ int opal_size2int(size_t in, int *out, bool want_check) { - *out = in; + *out = (int)in; return OPAL_SUCCESS; } diff --git a/opal/util/convert.h b/opal/util/convert.h index bf58257f68..2153e71f3f 100644 --- a/opal/util/convert.h +++ b/opal/util/convert.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -52,6 +52,10 @@ #include "opal_config.h" +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + /** * Convert a size_t to an int. * @@ -70,6 +74,10 @@ * On platforms where sizeof(size_t) <= sizeof(int), this function * will aways return OPAL_SUCCESS. */ -int opal_size2int(size_t in, int *out, bool want_check); +OPAL_DECLSPEC int opal_size2int(size_t in, int *out, bool want_check); + +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif #endif diff --git a/opal/util/crc.c b/opal/util/crc.c index 8ee0059702..9457a4aff4 100644 --- a/opal/util/crc.c +++ b/opal/util/crc.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -46,11 +46,11 @@ #define WORDALIGNED(v) \ - (((unsigned long)v & _WORD_MASK_) ? false : true) + (((intptr_t)v & _WORD_MASK_) ? false : true) #define INTALIGNED(v) \ - (((unsigned long)v & 3) ? false : true) + (((intptr_t)v & 3) ? false : true) /* * this version of bcopy_csum() looks a little too long, but it diff --git a/opal/util/crc.h b/opal/util/crc.h index bb1d6f598e..a8a9818ee6 100644 --- a/opal/util/crc.h +++ b/opal/util/crc.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -19,6 +19,10 @@ #ifndef _OPAL_CRC_H_ #define _OPAL_CRC_H_ +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + #define CRC_POLYNOMIAL ((unsigned int)0x04c11db7) #define CRC_INITIAL_REGISTER ((unsigned int)0xffffffff) @@ -31,7 +35,7 @@ #define OPAL_CSUM_ZERO 0 -unsigned long +OPAL_DECLSPEC unsigned long opal_bcopy_csum_partial( const void * source, void * destination, @@ -54,7 +58,7 @@ opal_bcopy_csum ( return opal_bcopy_csum_partial(source, destination, copylen, csumlen, &plong, &plength); } -unsigned int +OPAL_DECLSPEC unsigned int opal_bcopy_uicsum_partial ( const void * source, void * destination, @@ -77,7 +81,7 @@ opal_bcopy_uicsum ( return opal_bcopy_uicsum_partial(source, destination, copylen, csumlen, &pint, &plength); } -unsigned long +OPAL_DECLSPEC unsigned long opal_csum_partial ( const void * source, unsigned long csumlen, @@ -94,7 +98,7 @@ opal_csum(const void * source, unsigned long csumlen) return opal_csum_partial(source, csumlen, &lastPartialLong, &lastPartialLength); } -unsigned int +OPAL_DECLSPEC unsigned int opal_uicsum_partial ( const void * source, unsigned long csumlen, @@ -116,7 +120,7 @@ opal_uicsum(const void * source, unsigned long csumlen) void opal_initialize_crc_table(void); -unsigned int +OPAL_DECLSPEC unsigned int opal_bcopy_uicrc_partial( const void * source, void * destination, @@ -134,7 +138,7 @@ opal_bcopy_uicrc( return opal_bcopy_uicrc_partial(source, destination, copylen, crclen, CRC_INITIAL_REGISTER); } -unsigned int +OPAL_DECLSPEC unsigned int opal_uicrc_partial( const void * source, unsigned long crclen, @@ -147,5 +151,9 @@ opal_uicrc(const void * source, unsigned long crclen) return opal_uicrc_partial(source, crclen, CRC_INITIAL_REGISTER); } +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + #endif diff --git a/opal/util/daemon_init.h b/opal/util/daemon_init.h index 7c44178c81..416fb4c850 100644 --- a/opal/util/daemon_init.h +++ b/opal/util/daemon_init.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -20,6 +20,10 @@ #ifndef OPAL_DAEMON_INIT_H #define OPAL_DAEMON_INIT_H +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + /* * Turn a process into a daemon. * @@ -35,4 +39,8 @@ */ OPAL_DECLSPEC int opal_daemon_init(char *working_dir); +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + #endif /* OPAL_DAEMON_INIT_H */ diff --git a/opal/util/error.h b/opal/util/error.h index c79a6b5d75..023cddaabd 100644 --- a/opal/util/error.h +++ b/opal/util/error.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -19,6 +19,10 @@ #ifndef OPAL_UTIL_ERROR_H #define OPAL_UTIL_ERROR_H +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + /** * Prints error message for errnum on stderr * @@ -78,11 +82,6 @@ OPAL_DECLSPEC int opal_error_register(const char *project, int err_base, int err_max, opal_err2str_fn_t converter); - -#if defined(c_plusplus) || defined(__cplusplus) -extern "C" { -#endif - #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/opal/util/if.c b/opal/util/if.c index 790bf84299..8b3a5d43a8 100644 --- a/opal/util/if.c +++ b/opal/util/if.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -297,13 +297,11 @@ static int opal_ifinit(void) */ #define MAX_INTERFACES 10 /* Anju: for now assume there are no more than this */ - int ret; SOCKET sd; INTERFACE_INFO if_list[MAX_INTERFACES]; int num_interfaces; unsigned long num_bytes_returned; int i; - SOCKADDR_IN *sock_address; unsigned int interface_counter = 0; opal_if_t intf; opal_if_t *intf_ptr; @@ -360,7 +358,7 @@ static int opal_ifinit(void) intf.if_flags = if_list[i].iiFlags; /* fill in the index in the table */ - intf.if_index = opal_list_get_size(&opal_if_list)+1; + intf.if_index = (int)opal_list_get_size(&opal_if_list)+1; /* generate the interface name on your own .... loopback: lo @@ -509,7 +507,7 @@ int opal_ifcount(void) { if(opal_ifinit() != OPAL_SUCCESS) return (-1); - return opal_list_get_size(&opal_if_list); + return (int)opal_list_get_size(&opal_if_list); } diff --git a/opal/util/keyval/keyval_lex.l b/opal/util/keyval/keyval_lex.l index 3fe7fb4808..105e900a3b 100644 --- a/opal/util/keyval/keyval_lex.l +++ b/opal/util/keyval/keyval_lex.l @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -29,8 +29,8 @@ /* * local functions */ -static int finish_parsing(void) ; -static int opal_util_keyval_yywrap(void); +static int finish_parsing(void); +extern "C" int opal_util_keyval_yywrap(void); /* * global variables @@ -94,14 +94,12 @@ static int finish_parsing(void) return YY_NULL; } - static int opal_util_keyval_yywrap(void) { opal_util_keyval_parse_done = true; return 1; } - /* * Ensure that we have a valid yybuffer to use. Specifically, if this * scanner is invoked a second time, finish_parsing() (above) will diff --git a/opal/util/opal_pty.h b/opal/util/opal_pty.h index 68de41cad4..d58f8d4214 100644 --- a/opal/util/opal_pty.h +++ b/opal/util/opal_pty.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -30,16 +30,24 @@ # endif #endif +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + #if OMPI_ENABLE_PTY_SUPPORT -int opal_openpty(int *amaster, int *aslave, char *name, - struct termios *termp, struct winsize *winp); +OPAL_DECLSPEC int opal_openpty(int *amaster, int *aslave, char *name, + struct termios *termp, struct winsize *winp); #else -int opal_openpty(int *amaster, int *aslave, char *name, - void *termp, void *winpp); +OPAL_DECLSPEC int opal_openpty(int *amaster, int *aslave, char *name, + void *termp, void *winpp); #endif +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + #endif /* OPAL_UTIL_PTY_H */ diff --git a/opal/util/output.c b/opal/util/output.c index 1e0bd4aad0..5e4f14139b 100644 --- a/opal/util/output.c +++ b/opal/util/output.c @@ -115,24 +115,30 @@ bool opal_output_init(void) char hostname[32]; if (initialized) { - return true; + return true; } OBJ_CONSTRUCT(&verbose, opal_output_stream_t); +#if defined(__WINDOWS__) + { + WSADATA wsaData; + WSAStartup( MAKEWORD(2,2), &wsaData ); + } +#endif /* defined(__WINDOWS__) */ gethostname(hostname, sizeof(hostname)); verbose.lds_want_stderr = true; asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid()); for (i = 0; i < OPAL_OUTPUT_MAX_STREAMS; ++i) { - info[i].ldi_used = false; - info[i].ldi_enabled = false; + info[i].ldi_used = false; + info[i].ldi_enabled = false; - info[i].ldi_syslog = false; - info[i].ldi_file = false; - info[i].ldi_file_suffix = NULL; - info[i].ldi_file_want_append = false; - info[i].ldi_fd = -1; - info[i].ldi_file_num_lines_lost = 0; + info[i].ldi_syslog = false; + info[i].ldi_file = false; + info[i].ldi_file_suffix = NULL; + info[i].ldi_file_want_append = false; + info[i].ldi_fd = -1; + info[i].ldi_file_num_lines_lost = 0; } /* Initialize the mutex that protects the output */ @@ -145,6 +151,10 @@ bool opal_output_init(void) asprintf(&output_prefix, "output-pid%d-", getpid()); if (NULL != (str = getenv("TMPDIR"))) { output_dir = strdup(str); + } else if (NULL != (str = getenv("TEMP"))) { + output_dir = strdup(str); + } else if (NULL != (str = getenv("TMP"))) { + output_dir = strdup(str); } else if (NULL != (str = getenv("HOME"))) { output_dir = strdup(str); } else { @@ -186,12 +196,12 @@ bool opal_output_switch(int output_id, bool enable) /* Setup */ if (!initialized) { - opal_output_init(); + opal_output_init(); } if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS) { - ret = info[output_id].ldi_enabled; - info[output_id].ldi_enabled = enable; + ret = info[output_id].ldi_enabled; + info[output_id].ldi_enabled = enable; } return ret; @@ -208,34 +218,34 @@ void opal_output_reopen_all(void) for (i = 0; i < OPAL_OUTPUT_MAX_STREAMS; ++i) { - /* scan till we find ldi_used == 0, which is the end-marker */ + /* scan till we find ldi_used == 0, which is the end-marker */ - if (!info[i].ldi_used) { - break; - } + if (!info[i].ldi_used) { + break; + } - /* - * set this to zero to ensure that opal_output_open will - * return this same index as the output stream id - */ - info[i].ldi_used = false; + /* + * set this to zero to ensure that opal_output_open will + * return this same index as the output stream id + */ + info[i].ldi_used = false; - lds.lds_want_syslog = info[i].ldi_syslog; - lds.lds_syslog_priority = info[i].ldi_syslog_priority; - lds.lds_syslog_ident = info[i].ldi_syslog_ident; - lds.lds_prefix = info[i].ldi_prefix; - lds.lds_want_stdout = info[i].ldi_stdout; - lds.lds_want_stderr = info[i].ldi_stderr; - lds.lds_want_file = (-1 == info[i].ldi_fd) ? false : true; - /* open all streams in append mode */ - lds.lds_want_file_append = true; - lds.lds_file_suffix = info[i].ldi_file_suffix; + lds.lds_want_syslog = info[i].ldi_syslog; + lds.lds_syslog_priority = info[i].ldi_syslog_priority; + lds.lds_syslog_ident = info[i].ldi_syslog_ident; + lds.lds_prefix = info[i].ldi_prefix; + lds.lds_want_stdout = info[i].ldi_stdout; + lds.lds_want_stderr = info[i].ldi_stderr; + lds.lds_want_file = (-1 == info[i].ldi_fd) ? false : true; + /* open all streams in append mode */ + lds.lds_want_file_append = true; + lds.lds_file_suffix = info[i].ldi_file_suffix; - /* - * call opal_output_open to open the stream. The return value - * is guaranteed to be i. So we can ignore it. - */ - opal_output_open(&lds); + /* + * call opal_output_open to open the stream. The return value + * is guaranteed to be i. So we can ignore it. + */ + opal_output_open(&lds); } } @@ -258,8 +268,8 @@ void opal_output_close(int output_id) OPAL_THREAD_LOCK(&mutex); if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS && - info[output_id].ldi_used && info[output_id].ldi_enabled) { - free_descriptor(output_id); + info[output_id].ldi_used && info[output_id].ldi_enabled) { + free_descriptor(output_id); /* If no one has the syslog open, we should close it */ @@ -281,9 +291,9 @@ void opal_output_close(int output_id) /* Somewhat of a hack to free up the temp_str */ if (NULL != temp_str) { - free(temp_str); - temp_str = NULL; - temp_str_len = 0; + free(temp_str); + temp_str = NULL; + temp_str_len = 0; } OPAL_THREAD_UNLOCK(&mutex); } @@ -310,10 +320,10 @@ void opal_output_verbose(int level, int output_id, const char *format, ...) { if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS && info[output_id].ldi_verbose_level >= level) { - va_list arglist; - va_start(arglist, format); - output(output_id, format, arglist); - va_end(arglist); + va_list arglist; + va_start(arglist, format); + output(output_id, format, arglist); + va_end(arglist); } } @@ -371,6 +381,9 @@ void opal_output_finalize(void) OBJ_DESTRUCT(&verbose); OBJ_DESTRUCT(&mutex); } +#if defined(__WINDOWS__) + WSACleanup(); +#endif /* defined(__WINDOWS__) */ } /************************************************************************/ @@ -382,13 +395,14 @@ static void construct(opal_object_t *obj) { opal_output_stream_t *stream = (opal_output_stream_t*) obj; - stream->lds_is_debugging = false; stream->lds_verbose_level = 0; - stream->lds_want_syslog = false; stream->lds_syslog_priority = 0; stream->lds_syslog_ident = NULL; stream->lds_prefix = NULL; + stream->lds_is_debugging = false; + stream->lds_want_syslog = false; stream->lds_want_stdout = false; + stream->lds_want_stderr = false; stream->lds_want_file = false; stream->lds_want_file_append = false; stream->lds_file_suffix = NULL; @@ -406,79 +420,79 @@ static int do_open(int output_id, opal_output_stream_t * lds) /* Setup */ if (!initialized) { - opal_output_init(); + opal_output_init(); } /* If output_id == -1, find an available stream, or return * OPAL_ERROR */ if (-1 == output_id) { - OPAL_THREAD_LOCK(&mutex); - for (i = 0; i < OPAL_OUTPUT_MAX_STREAMS; ++i) { - if (!info[i].ldi_used) { - break; - } - } - if (i >= OPAL_OUTPUT_MAX_STREAMS) { - OPAL_THREAD_UNLOCK(&mutex); - return OPAL_ERR_OUT_OF_RESOURCE; - } + OPAL_THREAD_LOCK(&mutex); + for (i = 0; i < OPAL_OUTPUT_MAX_STREAMS; ++i) { + if (!info[i].ldi_used) { + break; + } + } + if (i >= OPAL_OUTPUT_MAX_STREAMS) { + OPAL_THREAD_UNLOCK(&mutex); + return OPAL_ERR_OUT_OF_RESOURCE; + } } /* Otherwise, we're reopening, so we need to free all previous * resources, close files, etc. */ else { - free_descriptor(output_id); - i = output_id; + free_descriptor(output_id); + i = output_id; } /* Special case: if we got NULL for lds, then just use the default * verbose */ if (NULL == lds) { - lds = &verbose; + lds = &verbose; } /* Got a stream -- now initialize it and open relevant outputs */ info[i].ldi_used = true; if (-1 == output_id) { - OPAL_THREAD_UNLOCK(&mutex); + OPAL_THREAD_UNLOCK(&mutex); } info[i].ldi_enabled = lds->lds_is_debugging ? - (bool) OMPI_ENABLE_DEBUG : true; + (bool) OMPI_ENABLE_DEBUG : true; info[i].ldi_verbose_level = lds->lds_verbose_level; info[i].ldi_syslog = lds->lds_want_syslog; if (lds->lds_want_syslog) { #ifndef __WINDOWS__ - if (NULL != lds->lds_syslog_ident) { - info[i].ldi_syslog_ident = strdup(lds->lds_syslog_ident); - openlog(lds->lds_syslog_ident, LOG_PID, LOG_USER); - } else { - info[i].ldi_syslog_ident = NULL; - openlog("opal", LOG_PID, LOG_USER); - } + if (NULL != lds->lds_syslog_ident) { + info[i].ldi_syslog_ident = strdup(lds->lds_syslog_ident); + openlog(lds->lds_syslog_ident, LOG_PID, LOG_USER); + } else { + info[i].ldi_syslog_ident = NULL; + openlog("opal", LOG_PID, LOG_USER); + } #else - if (NULL == (info[i].ldi_syslog_ident = - RegisterEventSource(NULL, TEXT("opal: ")))) { - /* handle the error */ - return OPAL_ERROR; - } + if (NULL == (info[i].ldi_syslog_ident = + RegisterEventSource(NULL, TEXT("opal: ")))) { + /* handle the error */ + return OPAL_ERROR; + } #endif - syslog_opened = true; - info[i].ldi_syslog_priority = lds->lds_syslog_priority; + syslog_opened = true; + info[i].ldi_syslog_priority = lds->lds_syslog_priority; } if (NULL != lds->lds_prefix) { - info[i].ldi_prefix = strdup(lds->lds_prefix); - info[i].ldi_prefix_len = strlen(lds->lds_prefix); + info[i].ldi_prefix = strdup(lds->lds_prefix); + info[i].ldi_prefix_len = (int)strlen(lds->lds_prefix); } else { - info[i].ldi_prefix = NULL; - info[i].ldi_prefix_len = 0; + info[i].ldi_prefix = NULL; + info[i].ldi_prefix_len = 0; } info[i].ldi_stdout = lds->lds_want_stdout; @@ -487,7 +501,7 @@ static int do_open(int output_id, opal_output_stream_t * lds) info[i].ldi_fd = -1; info[i].ldi_file = lds->lds_want_file; info[i].ldi_file_suffix = (NULL == lds->lds_file_suffix) ? NULL : - strdup(lds->lds_file_suffix); + strdup(lds->lds_file_suffix); info[i].ldi_file_want_append = lds->lds_want_file_append; info[i].ldi_file_num_lines_lost = 0; @@ -679,20 +693,20 @@ static void output(int output_id, const char *format, va_list arglist) if (ldi->ldi_file) { if (ldi->ldi_fd == -1) { - if (OPAL_SUCCESS != open_file(output_id)) { - ++ldi->ldi_file_num_lines_lost; - } else if (ldi->ldi_file_num_lines_lost > 0) { - char buffer[BUFSIZ]; - memset(buffer, 0, BUFSIZ); - snprintf(buffer, BUFSIZ - 1, - "[WARNING: %d lines lost because the Open MPI process session directory did\n not exist when opal_output() was invoked]\n", - ldi->ldi_file_num_lines_lost); - write(ldi->ldi_fd, buffer, strlen(buffer)); - ldi->ldi_file_num_lines_lost = 0; - } + if (OPAL_SUCCESS != open_file(output_id)) { + ++ldi->ldi_file_num_lines_lost; + } else if (ldi->ldi_file_num_lines_lost > 0) { + char buffer[BUFSIZ]; + memset(buffer, 0, BUFSIZ); + snprintf(buffer, BUFSIZ - 1, + "[WARNING: %d lines lost because the Open MPI process session directory did\n not exist when opal_output() was invoked]\n", + ldi->ldi_file_num_lines_lost); + write(ldi->ldi_fd, buffer, strlen(buffer)); + ldi->ldi_file_num_lines_lost = 0; + } } if (ldi->ldi_fd != -1) { - write(ldi->ldi_fd, temp_str, total_len); + write(ldi->ldi_fd, temp_str, total_len); } } OPAL_THREAD_UNLOCK(&mutex); diff --git a/opal/util/output.h b/opal/util/output.h index c9d928f320..224b79ceb4 100644 --- a/opal/util/output.h +++ b/opal/util/output.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -89,16 +89,6 @@ struct opal_output_stream_t { /** Class parent */ opal_object_t super; - /** - * Indicates whether the output of the stream is - * debugging/developer-only output or not. - * - * This field should be "true" if the output is for debugging - * purposes only. In that case, the output will never be sent to - * the stream unless OPAL was configured with --enable-debug. - */ - bool lds_is_debugging; - /** * Indicate the starting verbosity level of the stream. * @@ -113,20 +103,6 @@ struct opal_output_stream_t { */ int lds_verbose_level; - /** - * Indicates whether output of the stream should be sent to the - * syslog or not. - * - * If this field is true, output from this stream is sent to the - * syslog, and the following fields are also examined: - * - * - lds_syslog_priority - * - lds_syslog_ident - * - lds_prefix - * - * If this field is false, the above three fields are ignored. - */ - bool lds_want_syslog; /** * When opal_output_stream_t::lds_want_syslog is true, this field is * examined to see what priority output from the stream should be @@ -143,11 +119,11 @@ struct opal_output_stream_t { * * If a NULL value is given, the string "opal" is used. */ -#ifndef __WINDOWS__ +#if !defined(__WINDOWS__) char *lds_syslog_ident; #else HANDLE lds_syslog_ident; -#endif +#endif /* !defined(__WINDOWS__) */ /** * String prefix added to all output on the stream. @@ -158,6 +134,31 @@ struct opal_output_stream_t { */ char *lds_prefix; + /** + * Indicates whether the output of the stream is + * debugging/developer-only output or not. + * + * This field should be "true" if the output is for debugging + * purposes only. In that case, the output will never be sent to + * the stream unless OPAL was configured with --enable-debug. + */ + bool lds_is_debugging; + + /** + * Indicates whether output of the stream should be sent to the + * syslog or not. + * + * If this field is true, output from this stream is sent to the + * syslog, and the following fields are also examined: + * + * - lds_syslog_priority + * - lds_syslog_ident + * - lds_prefix + * + * If this field is false, the above three fields are ignored. + */ + bool lds_want_syslog; + /** * Whether to send stream output to stdout or not. * @@ -209,15 +210,6 @@ struct opal_output_stream_t { * Convenience typedef */ typedef struct opal_output_stream_t opal_output_stream_t; - /** - * Declare the class of this type. Note that the constructor for - * this class is for convenience only -- it is \em not necessary - * to be invoked. If the constructor it used, it sets all values - * in the struct to be false / 0 (i.e., turning off all output). - * The intended usage is to invoke the constructor and then enable - * the output fields that you want. - */ - OBJ_CLASS_DECLARATION(opal_output_stream_t); /** * Initializes the output stream system and opens a default @@ -475,6 +467,17 @@ struct opal_output_stream_t { */ #define OPAL_OUTPUT_VERBOSE(a) #endif + +/** + * Declare the class of this type. Note that the constructor for + * this class is for convenience only -- it is \em not necessary + * to be invoked. If the constructor it used, it sets all values + * in the struct to be false / 0 (i.e., turning off all output). + * The intended usage is to invoke the constructor and then enable + * the output fields that you want. + */ +OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_output_stream_t); + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/opal/util/pow2.h b/opal/util/pow2.h index 8042aea8e8..43c8fe32b9 100644 --- a/opal/util/pow2.h +++ b/opal/util/pow2.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -19,6 +19,10 @@ #ifndef OPAL_POW2_H #define OPAL_POW2_H +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + /** * This routine takes in an interger, and returns the nearest * power of 2 integer, same or greater than the input. @@ -30,4 +34,8 @@ */ OPAL_DECLSPEC int opal_round_up_to_nearest_pow2(int input_integer); +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + #endif /* OPAL_POW2_H */ diff --git a/opal/util/printf.c b/opal/util/printf.c index 484e608cd6..533d0ea292 100644 --- a/opal/util/printf.c +++ b/opal/util/printf.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -49,7 +49,7 @@ static int guess_strlen(const char *fmt, va_list ap) /* Start off with a fudge factor of 128 to handle the % escapes that we aren't calculating here */ - len = strlen(fmt) + 128; + len = (int)strlen(fmt) + 128; for (i = 0; i < strlen(fmt); ++i) { if ('%' == fmt[i] && i + 1 < strlen(fmt) && '%' != fmt[i + 1]) { @@ -62,7 +62,7 @@ static int guess_strlen(const char *fmt, va_list ap) * use (null) */ if (NULL != sarg) - len += strlen(sarg); + len += (int)strlen(sarg); else len += 5; break; @@ -91,7 +91,7 @@ static int guess_strlen(const char *fmt, va_list ap) break; case 'f': - farg = va_arg(ap, int); + farg = va_arg(ap, float); /* Alloc for minus sign */ if (farg < 0) { ++len; diff --git a/opal/util/show_help.c b/opal/util/show_help.c index beb9728335..ff5d985962 100644 --- a/opal/util/show_help.c +++ b/opal/util/show_help.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -27,6 +27,7 @@ #include "opal/util/show_help_lex.h" #include "opal/util/printf.h" #include "opal/util/argv.h" +#include "opal/util/os_path.h" #include "opal/constants.h" static int open_file(const char *base, const char *topic); @@ -103,7 +104,7 @@ static int open_file(const char *base, const char *topic) /* Try to open the file. If we can't find it, try it with a .txt extension. */ - asprintf(&filename, "%s/%s", OPAL_PKGDATADIR, base); + filename = opal_os_path( false, OPAL_PKGDATADIR, base, NULL ); opal_show_help_yyin = fopen(filename, "r"); free(filename); if (NULL == opal_show_help_yyin) { @@ -135,7 +136,7 @@ static int open_file(const char *base, const char *topic) /* If we still couldn't find it, try with no extension */ if (NULL == opal_show_help_yyin) { - asprintf(&filename, "%s/%s", OPAL_PKGDATADIR, base); + filename = opal_os_path( false, OPAL_PKGDATADIR, base, NULL ); opal_show_help_yyin = fopen(filename, "r"); free(filename); } diff --git a/opal/util/show_help.h b/opal/util/show_help.h index b9f037684f..085f3c1afe 100644 --- a/opal/util/show_help.h +++ b/opal/util/show_help.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -92,10 +92,10 @@ #include - #if defined(c_plusplus) || defined(__cplusplus) extern "C" { #endif + /** * Look up a text message in a text file and display it to the * stderr using printf()-like substitutions (%d, %s, etc.). @@ -113,8 +113,8 @@ extern "C" { * based on the topic, and displays it. If want_error_header is * true, a header and footer of asterisks are also displayed. */ -OPAL_DECLSPEC int opal_show_help(const char *filename, const char *topic, - bool want_error_header, ...); + OPAL_DECLSPEC int opal_show_help(const char *filename, const char *topic, + bool want_error_header, ...); /** * \internal @@ -125,10 +125,10 @@ OPAL_DECLSPEC int opal_show_help(const char *filename, const char *topic, * flex parser since we may not hit the <> rule and call this * function automatically. */ -OPAL_DECLSPEC int opal_show_help_finish_parsing(void); + OPAL_DECLSPEC int opal_show_help_finish_parsing(void); + #if defined(c_plusplus) || defined(__cplusplus) } #endif - #endif diff --git a/opal/util/show_help_lex.l b/opal/util/show_help_lex.l index 074ee126cb..49a7d69f48 100644 --- a/opal/util/show_help_lex.l +++ b/opal/util/show_help_lex.l @@ -3,7 +3,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -26,21 +26,22 @@ #include "opal/util/show_help_lex.h" +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + /* * public functions */ -int opal_show_help_finish_parsing(void); - +extern int opal_show_help_finish_parsing(void); /* * local functions */ -#ifdef __cplusplus - extern "C" { -#endif - static int opal_show_help_yywrap(void); -#ifdef __cplusplus - } +static int opal_show_help_yywrap(void); + +#if defined(c_plusplus) || defined(__cplusplus) +} #endif /* diff --git a/opal/util/strncpy.h b/opal/util/strncpy.h index bf9b98bdd4..cd2d00ab84 100644 --- a/opal/util/strncpy.h +++ b/opal/util/strncpy.h @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -32,7 +32,14 @@ #endif #define strncpy opal_strncpy +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif OPAL_DECLSPEC char *opal_strncpy(char *dest, const char *src, size_t len); +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + #endif /* OPAL_STRNCPY_H */ diff --git a/opal/util/trace.h b/opal/util/trace.h index b50c9e00a1..fef5e34c9a 100644 --- a/opal/util/trace.h +++ b/opal/util/trace.h @@ -1,9 +1,8 @@ -/* @file */ /* * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2005 The University of Tennessee and The University + * Copyright (c) 2004-2006 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -60,8 +59,7 @@ extern "C" { #endif -extern int opal_trace_handle; - +OPAL_DECLSPEC extern int opal_trace_handle; OPAL_DECLSPEC void opal_trace_init(void); OPAL_DECLSPEC void opal_trace_finalize(void); diff --git a/opal/win32/ompi_time.c b/opal/win32/ompi_time.c index b1bbb68c3c..2b85f6ba2e 100644 --- a/opal/win32/ompi_time.c +++ b/opal/win32/ompi_time.c @@ -1,19 +1,19 @@ /* - Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - University Research and Technology - Corporation. All rights reserved. - Copyright (c) 2004-2005 The University of Tennessee and The University - of Tennessee Research Foundation. All rights - reserved. - Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - University of Stuttgart. All rights reserved. - Copyright (c) 2004-2005 The Regents of the University of California. - All rights reserved. - $COPYRIGHT$ - - Additional copyrights may follow - - $HEADER$ + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2006 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ */ #include "opal_config.h" @@ -25,7 +25,6 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) { - FILETIME file_time; LARGE_INTEGER place_holder; __int64 time;