FileDocCategorySizeDatePackage
Shm.javaAPI DocApache Tomcat 6.0.145211Fri Jul 20 04:20:34 BST 2007org.apache.tomcat.jni

Shm

public class Shm extends Object
Shm
author
Mladen Turk
version
$Revision: 467222 $, $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $

Fields Summary
Constructors Summary
Methods Summary
public static native longattach(java.lang.String filename, long pool)
Attach to a shared memory segment that was created by another process.

param
filename The file used to create the original segment. (This MUST match the original filename.)
param
pool the pool from which to allocate the shared memory structure for this process.
return
The created shared memory structure.

public static native longbaseaddr(long m)
Retrieve the base address of the shared memory segment. NOTE: This address is only usable within the callers address space, since this API does not guarantee that other attaching processes will maintain the same address mapping.

param
m The shared memory segment from which to retrieve the base address.
return
address, aligned by APR_ALIGN_DEFAULT.

public static native java.nio.ByteBufferbuffer(long m)
Retrieve new ByteBuffer base address of the shared memory segment. NOTE: This address is only usable within the callers address space, since this API does not guarantee that other attaching processes will maintain the same address mapping.

param
m The shared memory segment from which to retrieve the base address.
return
address, aligned by APR_ALIGN_DEFAULT.

public static native longcreate(long reqsize, java.lang.String filename, long pool)
Create and make accessable a shared memory segment.
A note about Anonymous vs. Named shared memory segments:
Not all plaforms support anonymous shared memory segments, but in some cases it is prefered over other types of shared memory implementations. Passing a NULL 'file' parameter to this function will cause the subsystem to use anonymous shared memory segments. If such a system is not available, APR_ENOTIMPL is returned.
A note about allocation sizes:
On some platforms it is necessary to store some metainformation about the segment within the actual segment. In order to supply the caller with the requested size it may be necessary for the implementation to request a slightly greater segment length from the subsystem. In all cases, the apr_shm_baseaddr_get() function will return the first usable byte of memory.

param
reqsize The desired size of the segment.
param
filename The file to use for shared memory on platforms that require it.
param
pool the pool from which to allocate the shared memory structure.
return
The created shared memory structure.

public static native intdestroy(long m)
Destroy a shared memory segment and associated memory.

param
m The shared memory segment structure to destroy.

public static native intdetach(long m)
Detach from a shared memory segment without destroying it.

param
m The shared memory structure representing the segment to detach from.

public static native intremove(java.lang.String filename, long pool)
Remove shared memory segment associated with a filename.
This function is only supported on platforms which support name-based shared memory segments, and will return APR_ENOTIMPL on platforms without such support.

param
filename The filename associated with shared-memory segment which needs to be removed
param
pool The pool used for file operations

public static native longsize(long m)
Retrieve the length of a shared memory segment in bytes.

param
m The shared memory segment from which to retrieve the segment length.