/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <windows.h>
#include <errno.h>
#include "shmem_md.h"
#include "sysShmem.h"
#include "shmemBase.h" /* for exitTransportWithError */
/*
* These functions are not completely universal. For now, they are used
* exclusively for Jbug's shared memory transport mechanism. They have
* been implemented on Win32 only so far, so the abstractions may not be correct
* yet.
*/
#ifdef DEBUG
if (!(expression)) { \
("\"%s\", line %d: assertion failure\n", \
} \
}
#else
#endif
int
{
void *mappedMemory;
NULL, /* no inheritance */
0, length, /* hi, lo order of length */
name);
return SYS_ERR;
} else if (GetLastError() == ERROR_ALREADY_EXISTS) {
/* If the call above didn't create it, consider it an error */
return SYS_INUSE;
}
FILE_MAP_WRITE, /* read/write */
0, 0, 0); /* map entire "file" */
if (mappedMemory == NULL) {
return SYS_ERR;
}
*buffer = mappedMemory;
return SYS_OK;
}
int
{
void *mappedMemory;
FALSE, /* no inheritance */
name);
return SYS_ERR;
}
FILE_MAP_WRITE, /* read/write */
0, 0, 0); /* map entire "file" */
if (mappedMemory == NULL) {
return SYS_ERR;
}
*buffer = mappedMemory;
return SYS_OK;
}
int
{
if (!UnmapViewOfFile(buffer)) {
return SYS_ERR;
}
}
if (!CloseHandle(mem)) {
return SYS_ERR;
}
return SYS_OK;
}
int
{
FALSE, /* no initial owner */
name);
return SYS_ERR;
} else if (GetLastError() == ERROR_ALREADY_EXISTS) {
/* If the call above didn't create it, consider it an error */
return SYS_INUSE;
}
return SYS_OK;
}
int
{
FALSE, /* no inheritance */
name);
return SYS_ERR;
}
return SYS_OK;
}
int
{
FALSE, /* wait for either, not both */
INFINITE); /* infinite timeout */
}
int
{
}
int
{
}
int
{
reset, /* manual reset */
FALSE, /* initially, not signalled */
name);
return SYS_ERR;
} else if (GetLastError() == ERROR_ALREADY_EXISTS) {
/* If the call above didn't create it, consider it an error */
return SYS_INUSE;
}
return SYS_OK;
}
int
{
FALSE, /* no inheritance */
name);
return SYS_ERR;
}
return SYS_OK;
}
int
{
int count;
/*
* If the signalling process is specified, and it dies while we wait,
* detect it and return an error.
*/
FALSE, /* wait for either, not both */
if (rc == WAIT_OBJECT_0) {
/* Signalled, return success */
return SYS_OK;
/* Other process died, return error */
return SYS_DIED;
} else if (rc == WAIT_TIMEOUT) {
/* timeout */
return SYS_TIMEOUT;
}
return SYS_ERR;
}
int
{
}
int
{
}
{
return GetCurrentProcessId();
}
int
{
FALSE, /* no inheritance */
return SYS_ERR;
}
*processPtr = process;
return SYS_OK;
}
int
{
}
int
{
if (errval != 0) {
if (n > 3) {
/* Drop final '.', CR, LF */
buf[n] = '\0';
}
return SYS_OK;
}
buf[0] = '\0';
return 0;
}
int
sysTlsAlloc() {
return TlsAlloc();
}
void
}
void
}
void *
return TlsGetValue(index);
}
void
}