Cleanup the win32 stuff. Add some more definition for UNIX compatibility. There
is still an issue with the OMPI_DECLSPEC but I will investigate it a little bit later. This commit was SVN r8614.
Этот коммит содержится в:
родитель
3c95dd0801
Коммит
163391d71a
@ -26,7 +26,6 @@ OMPI_WIN32_SRC = \
|
||||
win32/ompi_uio.c
|
||||
|
||||
OMPI_WIN32_HDR = \
|
||||
win32/ompi_declspec.h \
|
||||
win32/ompi_misc.h \
|
||||
win32/ompi_process.h \
|
||||
win32/ompi_time.h \
|
||||
|
@ -1,28 +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 OMPI_DECLSPEC_H
|
||||
#define OMPI_DECLSPEC_H
|
||||
|
||||
#ifdef OMPI_BUILDING
|
||||
#define OMPI_DECLSPEC __declspec(dllexport)
|
||||
#else
|
||||
#define OMPI_DECLSPEC __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif
|
@ -19,13 +19,21 @@
|
||||
#ifndef OMPI_MISC_H
|
||||
#define OMPI_MISC_H
|
||||
|
||||
#define _SC_PAGESIZE 0
|
||||
#include <stdlib.h>
|
||||
|
||||
static __inline char* getenv (const char *name) {
|
||||
/* currently, this is a memory leak */
|
||||
#define _SC_PAGESIZE 0
|
||||
#define _SC_OPEN_MAX 1
|
||||
|
||||
/* currently, this is a memory leak */
|
||||
static __inline char* getenv (const char *name)
|
||||
{
|
||||
int ret;
|
||||
char *buffer = (char *)malloc(sizeof(char) * 100);
|
||||
ret = GetEnvironmentVariable(name, buffer, 100);
|
||||
char *buffer;
|
||||
DWORD length = GetEnvironmentVariable( name, NULL, 0 );
|
||||
|
||||
if( 0 == length ) return NULL;
|
||||
buffer = (char *)malloc(sizeof(char) * length);
|
||||
ret = GetEnvironmentVariable(name, buffer, length);
|
||||
return (ret > 0) ? buffer: NULL;
|
||||
}
|
||||
|
||||
@ -51,6 +59,12 @@ static __inline size_t sysconf(int option) {
|
||||
|
||||
SYSTEM_INFO sys_info;
|
||||
|
||||
/* hardcoded on windows ... The maximum limit seems to be 2048 but
|
||||
* it requires a call to _setmaxstdio.
|
||||
*/
|
||||
if( _SC_OPEN_MAX == option )
|
||||
return 512;
|
||||
|
||||
GetSystemInfo(&sys_info);
|
||||
if (_SC_PAGESIZE == option){
|
||||
return (size_t)sys_info.dwPageSize;
|
||||
|
@ -18,12 +18,10 @@
|
||||
|
||||
#ifndef OMPI_PROCESS_H
|
||||
#define OMPI_PROCESS_H
|
||||
#include "win32/ompi_declspec.h"
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include<windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#ifndef OMPI_WIN_COMPAT_H
|
||||
#error This file is supposed to be included only from win_compat.h
|
||||
#endif /* OMPI_WIN_COMPAT_H */
|
||||
|
||||
#if defined(c_plusplus) || defined (__cplusplus)
|
||||
extern "C"
|
||||
|
@ -18,12 +18,10 @@
|
||||
|
||||
#ifndef OMPI_TIME_H
|
||||
#define OMPI_TIME_H
|
||||
#include "win32/ompi_declspec.h"
|
||||
#ifdef WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include<windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#ifndef OMPI_WIN_COMPAT_H
|
||||
#error This file is supposed to be included only from win_compat.h
|
||||
#endif /* OMPI_WIN_COMPAT_H */
|
||||
|
||||
#define DST_NONE 0 /* not on dst */
|
||||
#define DST_USA 1 /* USA style dst */
|
||||
|
@ -19,9 +19,9 @@
|
||||
#ifndef OMPI_UIO_H
|
||||
#define OMPI_UIO_H
|
||||
|
||||
#include "ompi_declspec.h"
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#ifndef OMPI_WIN_COMPAT_H
|
||||
#error This file is supposed to be included only from win_compat.h
|
||||
#endif /* OMPI_WIN_COMPAT_H */
|
||||
|
||||
/* define the iovec structure */
|
||||
struct iovec {
|
||||
@ -50,7 +50,7 @@ OMPI_DECLSPEC int writev (int fd, struct iovec *iov, int cnt);
|
||||
buffer.
|
||||
*/
|
||||
OMPI_DECLSPEC int readv (int fd, struct iovec *iov, int cnt);
|
||||
|
||||
|
||||
#if defined(c_plusplus) || defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
@ -37,6 +37,7 @@
|
||||
/* other utility header files */
|
||||
#include <shellapi.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <process.h>
|
||||
#include <signal.h>
|
||||
/*#if defined(OMPI_BUILDING) && OMPI_BUILDING */
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user