1
1

Update the Windows compatibility file.

This commit was SVN r13047.
Этот коммит содержится в:
George Bosilca 2007-01-08 22:05:01 +00:00
родитель 87ff2b5ce8
Коммит 7a9d5b38cd

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

@ -1,170 +1,174 @@
/* /*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* Copyright (c) 2004-2006 The University of Tennessee and The University * Copyright (c) 2004-2006 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
* *
* $HEADER$ * $HEADER$
*/ */
#ifndef OMPI_WIN_COMPAT_H #ifndef OMPI_WIN_COMPAT_H
#define OMPI_WIN_COMPAT_H #define OMPI_WIN_COMPAT_H
/** /**
* don't complain about all the deprecated functions. * don't complain about all the deprecated functions.
*/ */
#define _CRT_SECURE_NO_DEPRECATE #define _CRT_SECURE_NO_DEPRECATE
/** /**
* Allow usage of some recent functions (such as SwitchToThread) * Allow usage of some recent functions (such as SwitchToThread)
* 0x0400 - for SwitchToThread * 0x0400 - for SwitchToThread
* 0x0500 - for using Event Objects * 0x0500 - for using Event Objects
*/ */
#define _WIN32_WINNT 0x0500 #define _WIN32_WINNT 0x0500
/** /**
* Define it in order to get access to the "secure" version of rand. * Define it in order to get access to the "secure" version of rand.
*/ */
#define _CRT_RAND_S #define _CRT_RAND_S
/* It is always better to include windows.h with the lean and mean option. /* It is always better to include windows.h with the lean and mean option.
So, include it with that option and then include some which are required So, include it with that option and then include some which are required
for us in ompi. Note: this file is included only on windows */ for us in ompi. Note: this file is included only on windows */
#ifndef WIN32_LEAN_AND_MEAN #ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif /* WIN32_LEAN_AND_MEAN */ #endif /* WIN32_LEAN_AND_MEAN */
#ifndef VC_EXTRALEAN #ifndef VC_EXTRALEAN
#define VC_EXTRALEAN #define VC_EXTRALEAN
#endif /* VC_EXTRALEAN */ #endif /* VC_EXTRALEAN */
#include <windows.h> #include <windows.h>
/* FD_SETSIZE determines how many sockets windows can select() on. If not defined /* FD_SETSIZE determines how many sockets windows can select() on. If not defined
before including winsock2.h, it is defined to be 64. We are going to go ahead and before including winsock2.h, it is defined to be 64. We are going to go ahead and
make it 1024 for now. PLEASE CHECK IF THIS IS RIGHT */ make it 1024 for now. PLEASE CHECK IF THIS IS RIGHT */
#define FD_SETSIZE 1024 #define FD_SETSIZE 1024
/* other utility header files */ /* other utility header files */
#include <shellapi.h> #include <shellapi.h>
#include <winsock2.h> #include <winsock2.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#include <process.h> #include <process.h>
#include <signal.h> #include <signal.h>
/** /**
* For all file io operations * For all file io operations
*/ */
#include <direct.h> #include <direct.h>
#include <io.h> #include <io.h>
#include <stdlib.h> #include <stdlib.h>
/*#if defined(OMPI_BUILDING) && OMPI_BUILDING */ /*#if defined(OMPI_BUILDING) && OMPI_BUILDING */
#include "opal/win32/ompi_uio.h" #include "opal/win32/ompi_uio.h"
#include "opal/win32/ompi_time.h" #include "opal/win32/ompi_time.h"
#include "opal/win32/ompi_utsname.h" #include "opal/win32/ompi_utsname.h"
#include "opal/win32/ompi_util.h" #include "opal/win32/ompi_util.h"
#include "opal/win32/ompi_misc.h" #include "opal/win32/ompi_misc.h"
#include "opal/util/printf.h" #include "opal/util/printf.h"
/*#endif*/ /*#endif*/
#define MAXPATHLEN _MAX_PATH #define MAXPATHLEN _MAX_PATH
#define MAXHOSTNAMELEN _MAX_PATH #define MAXHOSTNAMELEN _MAX_PATH
#define PATH_MAX _MAX_PATH #define PATH_MAX _MAX_PATH
#define STDIN_FILENO 0 #define STDIN_FILENO 0
#define STDOUT_FILENO 1 #define STDOUT_FILENO 1
#define STDERR_FILENO 2 #define STDERR_FILENO 2
typedef unsigned short mode_t; typedef unsigned short mode_t;
typedef long ssize_t; typedef long ssize_t;
typedef DWORD in_port_t; typedef DWORD in_port_t;
typedef char* caddr_t; typedef char* caddr_t;
typedef unsigned int uint; typedef unsigned int uint;
/* Defines for the access functions */ /* Defines for the access functions */
#define F_OK 0x00 #define F_OK 0x00
#define R_OK 0x02 #define R_OK 0x02
#define W_OK 0x04 #define W_OK 0x04
#define X_OK 0x06 #define X_OK 0x06
#define WTERMSIG(EXIT_CODE) (1) #define WTERMSIG(EXIT_CODE) (1)
#define WIFEXITED(EXIT_CODE) (1) #define WIFEXITED(EXIT_CODE) (1)
#define WEXITSTATUS(EXIT_CODE) (EXIT_CODE) #define WEXITSTATUS(EXIT_CODE) (EXIT_CODE)
#define WIFSIGNALED(EXIT_CODE) (0) #define WIFSIGNALED(EXIT_CODE) (0)
#define WIFSTOPPED(EXIT_CODE) (0) #define WIFSTOPPED(EXIT_CODE) (0)
#define WSTOPSIG(EXIT_CODE) (11) #define WSTOPSIG(EXIT_CODE) (11)
/** /**
* Microsoft compiler complain about non conformance of the default UNIX function. * Microsoft compiler complain about non conformance of the default UNIX function.
* Non conformance to the POSIX standard, and they suggest to use the version * Non conformance to the POSIX standard, and they suggest to use the version
* starting with an _ instead. So, in order to keep cl.exe happy (and quiet) we can * starting with an _ instead. So, in order to keep cl.exe happy (and quiet) we can
* use the followings defines. * use the followings defines.
*/ */
#define getpid _getpid #define getpid _getpid
#define strdup _strdup #define strdup _strdup
#define putenv _putenv #define putenv _putenv
#define getcwd _getcwd #define getcwd _getcwd
#define mkdir(PATH, MODE) _mkdir((PATH)) #define mkdir(PATH, MODE) _mkdir((PATH))
#define rmdir _rmdir #define rmdir _rmdir
#define chdir _chdir #define chdir _chdir
#define chmod _chmod #define chmod _chmod
#define access _access #define access _access
#define open _open #define open _open
#define close _close #define close _close
#define unlink _unlink #define unlink _unlink
#define dup2 _dup2 #define dup2 _dup2
#define write _write #define write _write
#define read _read #define read _read
#define fileno _fileno #define fileno _fileno
#define isatty _isatty #define isatty _isatty
#define execvp _execvp #define execvp _execvp
#define pipe(array_fd) _pipe(array_fd, 1024, O_BINARY ) #define pipe(array_fd) _pipe(array_fd, 1024, O_BINARY )
#define S_ISDIR(STAT_MODE) ((STAT_MODE) & _S_IFDIR) #define S_ISDIR(STAT_MODE) ((STAT_MODE) & _S_IFDIR)
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define strcasecmp _stricmp #define strcasecmp _stricmp
#define UINT32_MAX _UI32_MAX #define UINT32_MAX _UI32_MAX
#define INT32_MAX _I32_MAX #define UINT32_MIN _UI32_MIN
#define UINT8_MAX _UI8_MAX #define INT32_MAX _I32_MAX
#define INT32_MIN _I32_MIN
/* If we now support __func__ set the HAVE_DECL___FUNC__ */ #define UINT8_MAX _UI8_MAX
#define __func__ __FUNCTION__ #define UINT8_MIN _UI8_MIN
#undef HAVE_DECL___FUNC__
#define HAVE_DECL___FUNC__ 1
/* If we now support __func__ set the HAVE_DECL___FUNC__ */
/* Microsoft claim that strdup is deprecated and that we should use _strdup. */ #define __func__ __FUNCTION__
/*#define strdup _strdup*/ #undef HAVE_DECL___FUNC__
/*#define strncpy strncpy_s*/ #define HAVE_DECL___FUNC__ 1
/*#define sprintf sprintf_s*/
/* Microsoft claim that strdup is deprecated and that we should use _strdup. */
/* Ugly signal mapping since windows doesn't support the full spectrum /*#define strdup _strdup*/
* just a very small subset... :/ /*#define strncpy strncpy_s*/
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_raise.asp /*#define sprintf sprintf_s*/
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnucmg/html/UCMGch09.asp
*/ /* Ugly signal mapping since windows doesn't support the full spectrum
#define SIGCHLD SIGILL * just a very small subset... :/
#define SIGKILL WM_QUIT * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_raise.asp
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnucmg/html/UCMGch09.asp
/* Note: */
* The two defines below are likely to break the orte_wait #define SIGCHLD SIGILL
* functionality. The proper method of replacing these bits #define SIGKILL WM_QUIT
* of functionality is left for further investigated.
*/ /* Note:
#define WUNTRACED 0 * The two defines below are likely to break the orte_wait
#define WNOHANG 0 * functionality. The proper method of replacing these bits
* of functionality is left for further investigated.
#define sigset_t int */
#define WUNTRACED 0
/* #define WNOHANG 0
* Mask these to Windows equivalents
*/ #define sigset_t int
#define bzero(p, l) memset(p, 0, l)
#define bcopy(s, t, l) memmove(t, s, l) /*
* Mask these to Windows equivalents
#endif /* compat */ */
#define bzero(p, l) memset(p, 0, l)
#define bcopy(s, t, l) memmove(t, s, l)
#endif /* compat */