Author: mturk Date: Mon Apr 18 18:04:40 2011 New Revision: 1094676 URL: http://svn.apache.org/viewvc?rev=1094676&view=rev Log: Add win32 exec and shared memory stubs
Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c (with props) commons/sandbox/runtime/trunk/src/main/native/os/win32/shmem.c (with props) Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=1094676&r1=1094675&r2=1094676&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original) +++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Mon Apr 18 18:04:40 2011 @@ -76,11 +76,13 @@ ASMSOURCES= WIN32_SOURCES=\ $(TOPDIR)\os\win32\dso.c \ + $(TOPDIR)\os\win32\execmem.c \ $(TOPDIR)\os\win32\init.c \ $(TOPDIR)\os\win32\os.c \ $(TOPDIR)\os\win32\platform.c \ $(TOPDIR)\os\win32\procmutex.c \ $(TOPDIR)\os\win32\semaphore.c \ + $(TOPDIR)\os\win32\shmem.c \ $(TOPDIR)\os\win32\time.c \ $(TOPDIR)\os\win32\util.c \ $(TOPDIR)\os\win32\winapi.c Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c?rev=1094676&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c Mon Apr 18 18:04:40 2011 @@ -0,0 +1,48 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "acr/string.h" +#include "acr/clazz.h" +#include "acr/jniapi.h" +#include "acr/port.h" +#include "arch_opts.h" + +J_DECLARE_CLAZZ = { + INVALID_FIELD_OFFSET, + 0, + 0, + 0, + ACR_WIN_CP "WindowsExecutableMemoryImpl" +}; + +J_DECLARE_M_ID(0000) = { + 0, + "<init>", + "()V" +}; + +ACR_JNI_EXPORT(jobject, ExecutableMemoryImpl, init0)(JNI_STDARGS) +{ + if (_clazzn.u == 1) + return (*env)->NewObject(env, _clazzn.i, J4MID(0000)); + if (AcrLoadClass(env, &_clazzn, 0) != 0) { + ACR_THROW_MSG(ACR_EX_EINSTANCE, "WindowsExecutableMemoryImpl not initialized"); + return 0; + } + R_LOAD_METHOD(0000, 0); + _clazzn.u = 1; + return (*env)->NewObject(env, _clazzn.i, J4MID(0000)); +} Propchange: commons/sandbox/runtime/trunk/src/main/native/os/win32/execmem.c ------------------------------------------------------------------------------ svn:eol-style = native Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/shmem.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/shmem.c?rev=1094676&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/shmem.c (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/shmem.c Mon Apr 18 18:04:40 2011 @@ -0,0 +1,55 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "acr/string.h" +#include "acr/clazz.h" +#include "acr/jniapi.h" +#include "acr/port.h" +#include "arch_opts.h" + +typedef struct shmblock_t { + acr_uint32_t magic; /* Is this our memory */ + pid_t creator; /* Creator's process ID */ + acr_uint64_t length; /* Shared memory size */ +} shmblock_t; + +J_DECLARE_CLAZZ = { + INVALID_FIELD_OFFSET, + 0, + 0, + 0, + ACR_WIN_CP "WindowsShmImpl" +}; + +J_DECLARE_M_ID(0000) = { + 0, + "<init>", + "()V" +}; + +ACR_JNI_EXPORT(jobject, ShmImpl, init0)(JNI_STDARGS) +{ + if (_clazzn.u == 1) + return (*env)->NewObject(env, _clazzn.i, J4MID(0000)); + if (AcrLoadClass(env, &_clazzn, 0) != 0) { + ACR_THROW_MSG(ACR_EX_EINSTANCE, "WindowsShmemImpl not initialized"); + return 0; + } + R_LOAD_METHOD(0000, 0); + _clazzn.u = 1; + return (*env)->NewObject(env, _clazzn.i, J4MID(0000)); +} + Propchange: commons/sandbox/runtime/trunk/src/main/native/os/win32/shmem.c ------------------------------------------------------------------------------ svn:eol-style = native