LibCAPI (JNA API)

com.sun.jna.platform.unix

## Interface LibCAPI

- All Superinterfaces:
    Reboot, Resource
  All Known Subinterfaces:
    LibC

      public interface LibCAPI
      extends Reboot, Resource

  Note: we are using this "intermediate" API in order to allow Linux-like O/S-es to implement the same API, but maybe using a different library name
  Author:
    Lyor Goldstein

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.sun.jna.platform.unix.Resource

      `Resource.Rlimit`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `HOST_NAME_MAX`

    - ### Fields inherited from interface com.sun.jna.platform.unix.Reboot

      `RB_AUTOBOOT, RB_DISABLE_CAD, RB_ENABLE_CAD, RB_HALT_SYSTEM, RB_KEXEC, RB_POWER_OFF, RB_SW_SUSPEND`

    - ### Fields inherited from interface com.sun.jna.platform.unix.Resource

      `RLIMIT_AS, RLIMIT_CORE, RLIMIT_CPU, RLIMIT_DATA, RLIMIT_FSIZE, RLIMIT_LOCKS, RLIMIT_MEMLOCK, RLIMIT_MSGQUEUE, RLIMIT_NICE, RLIMIT_NLIMITS, RLIMIT_NOFILE, RLIMIT_NPROC, RLIMIT_RSS, RLIMIT_RTPRIO, RLIMIT_RTTIME, RLIMIT_SIGPENDING, RLIMIT_STACK`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getdomainname(char[] name, int len)`
    `int` | `getegid()`
    `java.lang.String` | `getenv(java.lang.String name)`
    `int` | `geteuid()`
    `int` | `getgid()`
    `int` | `gethostname(char[] name, int len)`
    `int` | `getloadavg(double[] loadavg, int nelem)` The getloadavg() function returns the number of processes in the system run queue averaged over various periods of time.
    `int` | `getuid()`
    `int` | `setdomainname(char[] name, int len)`
    `int` | `setegid(int gid)`
    `int` | `setenv(java.lang.String name, java.lang.String value, int overwrite)` Update or add a variable in the environment of the calling process.
    `int` | `seteuid(int uid)`
    `int` | `setgid(int gid)`
    `int` | `sethostname(char[] name, int len)`
    `int` | `setuid(int uid)`
    `int` | `unsetenv(java.lang.String name)`

    - ### Methods inherited from interface com.sun.jna.platform.unix.Reboot

      `reboot`

    - ### Methods inherited from interface com.sun.jna.platform.unix.Resource

      `getrlimit, setrlimit`

- - ### Field Detail

    - #### HOST_NAME_MAX

          static final int HOST_NAME_MAX

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getuid

          int getuid()

    - #### geteuid

          int geteuid()

    - #### getgid

          int getgid()

    - #### getegid

          int getegid()

    - #### setuid

          int setuid(int uid)

    - #### seteuid

          int seteuid(int uid)

    - #### setgid

          int setgid(int gid)

    - #### setegid

          int setegid(int gid)

    - #### gethostname

          int gethostname(char[] name,
                        int len)

    - #### sethostname

          int sethostname(char[] name,
                        int len)

    - #### getdomainname

          int getdomainname(char[] name,
                          int len)

    - #### setdomainname

          int setdomainname(char[] name,
                          int len)

    - #### getenv

          java.lang.String getenv(java.lang.String name)

      Parameters:
        `name` - Environment variable name
      Returns:
        Returns the value in the environment, or `null` if there is no match for the name
      See Also:
        getenv(3)

    - #### setenv

          int setenv(java.lang.String name,
                   java.lang.String value,
                   int overwrite)

      Update or add a variable in the environment of the calling process.
      Parameters:
        `name` - Environment variable name
        `value` - Required value
        `overwrite` - If the environment variable already exists and the value of `overwrite` is non-zero, the function shall return success and the environment shall be updated. If the environment variable already exists and the value of `overwrite` is zero, the function shall return success and the environment shall remain unchanged.
      Returns:
        Upon successful completion, zero shall be returned. Otherwise, -1 shall be returned, `errno` set to indicate the error, and the environment shall be unchanged
      See Also:
        getenv(3)

    - #### unsetenv

          int unsetenv(java.lang.String name)

      Parameters:
        `name` - Environment variable name - If the named variable does not exist in the current environment, the environment shall be unchanged and the function is considered to have completed successfully.
      Returns:
        Upon successful completion, zero shall be returned. Otherwise, -1 shall be returned, `errno` set to indicate the error, and the environment shall be unchanged
      See Also:
        getenv(3)

    - #### getloadavg

          int getloadavg(double[] loadavg,
                       int nelem)

      The getloadavg() function returns the number of processes in the system run queue averaged over various periods of time. Up to nelem samples are retrieved and assigned to successive elements of loadavg[]. The system imposes a maximum of 3 samples, representing averages over the last 1, 5, and 15 minutes, respectively.
      Parameters:
        `loadavg` - An array of doubles which will be filled with the results
        `nelem` - Number of samples to return
      Returns:
        If the load average was unobtainable, -1 is returned; otherwise, the number of samples actually retrieved is returned.
      See Also:
        getloadavg(3)

Copyright © 2007-2016 Timothy Wall. All Rights Reserved.