org.apache.tomcat.jni

## Class Stdlib

- java.lang.Object
- - org.apache.tomcat.jni.Stdlib

-     public class Stdlib
      extends Object

  Stdlib
  Author:
    Mladen Turk

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Stdlib()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static long` | `calloc(int num, int sz)` Allocates an array in memory with elements initialized to 0.
    `static void` | `free(long mem)` Deallocates or frees a memory block.
    `static int` | `getpid()` Get current process pid.
    `static int` | `getppid()` Get current process parent pid.
    `static long` | `malloc(int sz)` Allocates memory blocks.
    `static boolean` | `memread(byte[] dst, long src, int sz)` Read from plain memory
    `static boolean` | `memset(long dst, int c, int sz)` Sets buffers to a specified character
    `static boolean` | `memwrite(long dst, byte[] src, int sz)` Write to plain memory
    `static long` | `realloc(long mem, int sz)` Reallocate memory blocks.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Stdlib

          public Stdlib()

  - ### Method Detail

    - #### 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.
      Returns:
        `true` if the operation was successful

    - #### 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.
      Returns:
        `true` if the operation was successful

    - #### 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.
      Returns:
        `true` if the operation was successful

    - #### malloc

          public static long malloc(int sz)

      Allocates memory blocks.
      Parameters:
        `sz` - Bytes to allocate.
      Returns:
        a pointer

    - #### 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.
      Returns:
        a pointer

    - #### 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.
      Returns:
        a pointer

    - #### 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.

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