posix
Class SharedMem

java.lang.Object
  extended by posix.IPC
      extended by posix.SharedMem

public class SharedMem
extends IPC

A Posix shared memory segment. Shared physical memory is not supported, since this requires superuser privilege and is very hardware dependent.


Nested Class Summary
static class SharedMem.shmid_ds
           
 
Nested classes/interfaces inherited from class posix.IPC
IPC.Perm
 
Field Summary
static long SHMLBA
          The modulus for attaching shared memory by logical address.
 
Fields inherited from class posix.IPC
egid, euid, id, IPC_ALLOC, IPC_CI, IPC_CREAT, IPC_EXCL, IPC_NOCLEAR, IPC_NOWAIT, IPC_PHYS, IPC_PRIVATE, owner, pid
 
Constructor Summary
SharedMem(int key, int flag)
          Attach an existing shared memory segment.
SharedMem(int key, int size, int flag)
          Attach or create a shared memory segment.
SharedMem(java.lang.String path, int type)
           
 
Method Summary
 CPtr attach()
           
 void dispose()
           
 IPC.Perm getPerm()
          Return the permissions for this IPC data structure.
 SharedMem.shmid_ds getStatus()
           
 void remove()
          Remove this IPC data structure from the system.
 
Methods inherited from class posix.IPC
finalize, ftok, getId, isPidValid
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHMLBA

public static final long SHMLBA
The modulus for attaching shared memory by logical address. This is system dependent and therefore computed by the class initializer. While attaching shared memory to a specific address is somewhat system dependent, it is easily handled by configuration or property settings.

Constructor Detail

SharedMem

public SharedMem(int key,
                 int flag)
          throws IPCException
Attach an existing shared memory segment.

Throws:
IPCException

SharedMem

public SharedMem(int key,
                 int size,
                 int flag)
          throws IPCException
Attach or create a shared memory segment.

Parameters:
key - IPC key or IPC_PRIVATE
size - size of shared memory
flag - options
Throws:
IPCException

SharedMem

public SharedMem(java.lang.String path,
                 int type)
          throws IPCException
Throws:
IPCException
Method Detail

getStatus

public SharedMem.shmid_ds getStatus()
                             throws IPCException
Throws:
IPCException

getPerm

public IPC.Perm getPerm()
                 throws IPCException
Description copied from class: IPC
Return the permissions for this IPC data structure.

Specified by:
getPerm in class IPC
Throws:
IPCException

attach

public CPtr attach()
            throws IPCException
Throws:
IPCException

remove

public void remove()
Description copied from class: IPC
Remove this IPC data structure from the system.

Specified by:
remove in class IPC

dispose

public void dispose()
Overrides:
dispose in class IPC