J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 1999-2003 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | #ifndef _JAVASOFT_SYSSHMEM_H |
| 26 | |
| 27 | #include <jni.h> |
| 28 | #include "sys.h" |
| 29 | #include "shmem_md.h" |
| 30 | |
| 31 | int sysSharedMemCreate(const char *name, int length, sys_shmem_t *, void **buffer); |
| 32 | int sysSharedMemOpen(const char *name, sys_shmem_t *, void **buffer); |
| 33 | int sysSharedMemClose(sys_shmem_t, void *buffer); |
| 34 | |
| 35 | /* Mutexes that can be used for inter-process communication */ |
| 36 | int sysIPMutexCreate(const char *name, sys_ipmutex_t *mutex); |
| 37 | int sysIPMutexOpen(const char *name, sys_ipmutex_t *mutex); |
| 38 | int sysIPMutexEnter(sys_ipmutex_t mutex, sys_event_t event); |
| 39 | int sysIPMutexExit(sys_ipmutex_t mutex); |
| 40 | int sysIPMutexClose(sys_ipmutex_t mutex); |
| 41 | |
| 42 | /* Inter-process events */ |
| 43 | int sysEventCreate(const char *name, sys_event_t *event, jboolean manualreset); |
| 44 | int sysEventOpen(const char *name, sys_event_t *event); |
| 45 | int sysEventWait(sys_process_t otherProcess, sys_event_t event, long timeout); |
| 46 | int sysEventSignal(sys_event_t event); |
| 47 | int sysEventClose(sys_event_t event); |
| 48 | |
| 49 | jlong sysProcessGetID(); |
| 50 | int sysProcessOpen(jlong processID, sys_process_t *process); |
| 51 | int sysProcessClose(sys_process_t *process); |
| 52 | |
| 53 | /* access to errno or equivalent */ |
| 54 | int sysGetLastError(char *buf, int size); |
| 55 | |
| 56 | /* access to thread-local storage */ |
| 57 | int sysTlsAlloc(); |
| 58 | void sysTlsFree(int index); |
| 59 | void sysTlsPut(int index, void *value); |
| 60 | void *sysTlsGet(int index); |
| 61 | |
| 62 | /* misc. functions */ |
| 63 | void sysSleep(long duration); |
| 64 | |
| 65 | #endif |