/*
 *  Copyright 1999-2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.apache.tomcat.jni;

/** OS
 *
 * @author Mladen Turk
 * @version $Revision$, $Date$
 */

public class OS {

    /* OS Enums */
    private static final int UNIX     = 1;
    private static final int NETWARE  = 2;
    private static final int WIN32    = 3;
    private static final int WIN64    = 4;

    /**
     * Check for OS type.
     * @param type OS type to test.
     */
    private static native boolean is(int type);

    static {
        IS_UNIX    = is(UNIX);
        IS_NETWARE = is(NETWARE);
        IS_WIN32   = is(WIN32);
        IS_WIN64   = is(WIN64);
    }

    public static boolean IS_UNIX    = false;
    public static boolean IS_NETWARE = false;
    public static boolean IS_WIN32   = false;
    public static boolean IS_WIN64   = false;

    /**
     * Get the name of the system default characer set.
     * @param pool the pool to allocate the name from, if needed
     */
    public static native String defaultEncoding(long pool);

    /**
     * Get the name of the current locale character set.
     * Defers to apr_os_default_encoding if the current locale's
     * data can't be retreved on this system.
     * @param pool the pool to allocate the name from, if needed
     */
    public static native String localeEncoding(long pool);

    /**
     * Sleep for the specified number of micro-seconds.
     * <br /><b>Warning :</b> May sleep for longer than the specified time.
     * @param t desired amount of time to sleep.
     */
    public static native void sleep(long t);

    /**
     * Generate random bytes.
     * @param buf Buffer to fill with random bytes
     * @param len Length of buffer in bytes
     */
    public static native int random(byte [] buf, int len);

    
}

@@ -1922,368 +1922,983 @@
   * 
-Sleep for the specified number of micro-seconds.%0A     * %3Cbr /%3E%3Cb%3EWarning :%3C/b%3E May sleep for longer than the specified time.%0A     * @param t desired amount of time to sleep.%0A     */%0A    public static native void sleep(long t);%0A%0A    /**%0A     * Generate random bytes.%0A     * @param buf Buffer to fill with random bytes%0A     * @param len Length of buffer in bytes
+Generate random bytes.%0A     * @param buf Buffer to fill with random bytes%0A     * @param len Length of buffer in bytes%0A     */%0A    public static native int random(byte %5B%5D buf, int len);%0A%0A    /**%0A     * Gather system info.%0A     * %3CPRE%3E%0A     * On exit the inf array will be filled with:%0A     * inf%5B0%5D  - Physical RAM%0A     * inf%5B1%5D  - Available RAM%0A     * inf%5B2%5D  - Total page file (swap + Physical RAM)%0A     * inf%5B3%5D  - Free page file%0A     * inf%5B4%5D  - Memory Load%0A     *%0A     * inf%5B5%5D  - Idle Time in microseconds%0A     * inf%5B6%5D  - Kernel Time in microseconds%0A     * inf%5B7%5D  - User Time in microseconds%0A     *%0A     * inf%5B8%5D  - Process creation time (apr_time_t)%0A     * inf%5B9%5D  - Process Kernel Time in microseconds%0A     * inf%5B10%5D - Process User Time in microseconds%0A     *%0A     * inf%5B11%5D - Current working set size.%0A     * inf%5B12%5D - Peak working set size.%0A     * inf%5B13%5D - Number of page faults.%0A     * %3C/PRE%3E%0A     * @param inf array that will be filled with system informations.
 %0A   
@@ -2935,39 +2935,27 @@
 int 
-random(byte %5B%5D buf, int len
+info(long %5B%5D inf
 );%0A
-%0A
     

Add OS.info for gathering stats