org.apache.tomcat.jni

Class Stdlib

public class Stdlib extends Object

Stdlib

Version: $Revision: 832187 $, $Date: 2009-11-03 00:23:20 +0100 (Tue, 03 Nov 2009) $

Author: Mladen Turk

Method Summary
static longcalloc(int num, int sz)
Allocates an array in memory with elements initialized to 0.
static voidfree(long mem)
Deallocates or frees a memory block.
static intgetpid()
Get current process pid.
static intgetppid()
Get current process parent pid.
static longmalloc(int sz)
Allocates memory blocks.
static booleanmemread(byte[] dst, long src, int sz)
Read from plain memory
static booleanmemset(long dst, int c, int sz)
Sets buffers to a specified character
static booleanmemwrite(long dst, byte[] src, int sz)
Write to plain memory
static longrealloc(long mem, int sz)
Reallocate memory blocks.

Method Detail

calloc

public static long calloc(int num, int sz)
Allocates an array in memory with elements initialized to 0.

Parameters: num Number of elements. sz Length in bytes of each element.

free

public static void free(long mem)
Deallocates or frees a memory block.

Parameters: mem Previously allocated memory block to be freed.

getpid

public static int getpid()
Get current process pid.

Returns: current pid or < 1 in case of error.

getppid

public static int getppid()
Get current process parent pid.

Returns: parent pid or < 1 in case of error.

malloc

public static long malloc(int sz)
Allocates memory blocks.

Parameters: sz Bytes to allocate.

memread

public static boolean memread(byte[] dst, long src, int sz)
Read from plain memory

Parameters: dst Destination byte array src Source memory address sz Number of bytes to copy.

memset

public static boolean memset(long dst, int c, int sz)
Sets buffers to a specified character

Parameters: dst Destination memory address c Character to set. sz Number of characters.

memwrite

public static boolean memwrite(long dst, byte[] src, int sz)
Write to plain memory

Parameters: dst Destination memory address src Source byte array sz Number of bytes to copy.

realloc

public static long realloc(long mem, int sz)
Reallocate memory blocks.

Parameters: mem Pointer to previously allocated memory block. sz New size in bytes.

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.