SystemB (JNA API)

com.sun.jna.platform.mac

## Interface SystemB

- All Superinterfaces:
    Library

      public interface SystemB
      extends Library

  Author: Daniel Widdis Date: 6/5/15

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `SystemB.HostCpuLoadInfo`
    `static class` | `SystemB.HostLoadInfo`
    `static class` | `SystemB.VMStatistics`
    `static class` | `SystemB.VMStatistics64`

    - ### Nested classes/interfaces inherited from interface com.sun.jna.Library

      `Library.Handler`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `CPU_STATE_IDLE`
    `static int` | `CPU_STATE_MAX`
    `static int` | `CPU_STATE_NICE`
    `static int` | `CPU_STATE_SYSTEM`
    `static int` | `CPU_STATE_USER`
    `static int` | `HOST_CPU_LOAD_INFO`
    `static int` | `HOST_LOAD_INFO`
    `static int` | `HOST_VM_INFO`
    `static int` | `HOST_VM_INFO64`
    `static SystemB` | `INSTANCE`
    `static int` | `INT_SIZE`
    `static int` | `PROCESSOR_BASIC_INFO`
    `static int` | `PROCESSOR_CPU_LOAD_INFO`
    `static int` | `UINT64_SIZE`

    - ### Fields inherited from interface com.sun.jna.Library

      `OPTION_ALLOW_OBJECTS, OPTION_CALLING_CONVENTION, OPTION_CLASSLOADER, OPTION_FUNCTION_MAPPER, OPTION_INVOCATION_MAPPER, OPTION_OPEN_FLAGS, OPTION_STRING_ENCODING, OPTION_STRUCTURE_ALIGNMENT, OPTION_TYPE_MAPPER`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `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` | `host_page_size(int machPort, LongByReference pPageSize)` The host_page_size function returns the page size for the given host.
    `int` | `host_processor_info(int machPort, int flavor, IntByReference procCount, PointerByReference procInfo, IntByReference procInfoCount)` The host_processor_info function returns information about processors.
    `int` | `host_statistics(int machPort, int hostStat, Structure stats, IntByReference count)` The host_statistics function returns scheduling and virtual memory statistics concerning the host as specified by hostStat.
    `int` | `host_statistics64(int machPort, int hostStat, Structure stats, IntByReference count)` The host_statistics64 function returns 64-bit virtual memory statistics concerning the host as specified by hostStat.
    `int` | `mach_host_self()` The mach_host_self system call returns the calling thread's host name port.
    `int` | `mach_task_self()` The mach_task_self system call returns the calling thread's task_self port.
    `int` | `sysctl(int[] name, int namelen, Pointer oldp, IntByReference oldlenp, Pointer newp, int newlen)` The sysctl() function retrieves system information and allows processes with appropriate privileges to set system information.
    `int` | `sysctlbyname(java.lang.String name, Pointer oldp, IntByReference oldlenp, Pointer newp, int newlen)` The sysctlbyname() function accepts an ASCII representation of the name and internally looks up the integer name vector.
    `int` | `sysctlnametomib(java.lang.String name, Pointer mibp, IntByReference size)` The sysctlnametomib() function accepts an ASCII representation of the name, looks up the integer name vector, and returns the numeric representation in the mib array pointed to by mibp.

- - ### Field Detail

    - #### INSTANCE

          static final SystemB INSTANCE

    - #### HOST_LOAD_INFO

          static final int HOST_LOAD_INFO

      See Also:
        Constant Field Values

    - #### HOST_VM_INFO

          static final int HOST_VM_INFO

      See Also:
        Constant Field Values

    - #### HOST_CPU_LOAD_INFO

          static final int HOST_CPU_LOAD_INFO

      See Also:
        Constant Field Values

    - #### HOST_VM_INFO64

          static final int HOST_VM_INFO64

      See Also:
        Constant Field Values

    - #### CPU_STATE_MAX

          static final int CPU_STATE_MAX

      See Also:
        Constant Field Values

    - #### CPU_STATE_USER

          static final int CPU_STATE_USER

      See Also:
        Constant Field Values

    - #### CPU_STATE_SYSTEM

          static final int CPU_STATE_SYSTEM

      See Also:
        Constant Field Values

    - #### CPU_STATE_IDLE

          static final int CPU_STATE_IDLE

      See Also:
        Constant Field Values

    - #### CPU_STATE_NICE

          static final int CPU_STATE_NICE

      See Also:
        Constant Field Values

    - #### PROCESSOR_BASIC_INFO

          static final int PROCESSOR_BASIC_INFO

      See Also:
        Constant Field Values

    - #### PROCESSOR_CPU_LOAD_INFO

          static final int PROCESSOR_CPU_LOAD_INFO

      See Also:
        Constant Field Values

    - #### UINT64_SIZE

          static final int UINT64_SIZE

    - #### INT_SIZE

          static final int INT_SIZE

  - ### Method Detail

    - #### mach_host_self

          int mach_host_self()

      The mach_host_self system call returns the calling thread's host name port. It has an effect equivalent to receiving a send right for the host port.
      Returns:
        the host's name port

    - #### mach_task_self

          int mach_task_self()

      The mach_task_self system call returns the calling thread's task_self port. It has an effect equivalent to receiving a send right for the task's kernel port.
      Returns:
        the task's kernel port

    - #### host_page_size

          int host_page_size(int machPort,
                             LongByReference pPageSize)

      The host_page_size function returns the page size for the given host.
      Parameters:
        `machPort` - The name (or control) port for the host for which the page size is desired.
        `pPageSize` - The host's page size (in bytes), set on success.
      Returns:
        0 on success; sets errno on failure

    - #### host_statistics

          int host_statistics(int machPort,
                              int hostStat,
                              Structure stats,
                              IntByReference count)

      The host_statistics function returns scheduling and virtual memory statistics concerning the host as specified by hostStat.
      Parameters:
        `machPort` - The control port for the host for which information is to be obtained.
        `hostStat` - The type of statistics desired (HOST_LOAD_INFO, HOST_VM_INFO, or HOST_CPU_LOAD_INFO)
        `stats` - Statistics about the specified host.
        `count` - On input, the maximum size of the buffer; on output, the size returned (in natural-sized units).
      Returns:
        0 on success; sets errno on failure

    - #### host_statistics64

          int host_statistics64(int machPort,
                                int hostStat,
                                Structure stats,
                                IntByReference count)

      The host_statistics64 function returns 64-bit virtual memory statistics concerning the host as specified by hostStat.
      Parameters:
        `machPort` - The control port for the host for which information is to be obtained.
        `hostStat` - The type of statistics desired (HOST_VM_INFO64)
        `stats` - Statistics about the specified host.
        `count` - On input, the maximum size of the buffer; on output, the size returned (in natural-sized units).
      Returns:
        0 on success; sets errno on failure

    - #### sysctl

          int sysctl(int[] name,
                     int namelen,
                     Pointer oldp,
                     IntByReference oldlenp,
                     Pointer newp,
                     int newlen)

      The sysctl() function retrieves system information and allows processes with appropriate privileges to set system information. The information available from sysctl() consists of integers, strings, and tables. The state is described using a "Management Information Base" (MIB) style name, listed in name, which is a namelen length array of integers. The information is copied into the buffer specified by oldp. The size of the buffer is given by the location specified by oldlenp before the call, and that location gives the amount of data copied after a successful call and after a call that returns with the error code ENOMEM. If the amount of data available is greater than the size of the buffer supplied, the call supplies as much data as fits in the buffer provided and returns with the error code ENOMEM. If the old value is not desired, oldp and oldlenp should be set to NULL. The size of the available data can be determined by calling sysctl() with the NULL argument for oldp. The size of the available data will be returned in the location pointed to by oldlenp. For some operations, the amount of space may change often. For these operations, the system attempts to round up so that the returned size is large enough for a call to return the data shortly thereafter. To set a new value, newp is set to point to a buffer of length newlen from which the requested value is to be taken. If a new value is not to be set, newp should be set to NULL and newlen set to 0.
      Parameters:
        `name` - MIB array of integers
        `namelen` - length of the MIB array
        `oldp` - Information retrieved
        `oldlenp` - Size of information retrieved
        `newp` - Information to be written
        `newlen` - Size of information to be written
      Returns:
        0 on success; sets errno on failure

    - #### sysctlbyname

          int sysctlbyname(java.lang.String name,
                           Pointer oldp,
                           IntByReference oldlenp,
                           Pointer newp,
                           int newlen)

      The sysctlbyname() function accepts an ASCII representation of the name and internally looks up the integer name vector. Apart from that, it behaves the same as the standard sysctl() function.
      Parameters:
        `name` - ASCII representation of the MIB name
        `oldp` - Information retrieved
        `oldlenp` - Size of information retrieved
        `newp` - Information to be written
        `newlen` - Size of information to be written
      Returns:
        0 on success; sets errno on failure

    - #### sysctlnametomib

          int sysctlnametomib(java.lang.String name,
                              Pointer mibp,
                              IntByReference size)

      The sysctlnametomib() function accepts an ASCII representation of the name, looks up the integer name vector, and returns the numeric representation in the mib array pointed to by mibp. The number of elements in the mib array is given by the location specified by sizep before the call, and that location gives the number of entries copied after a successful call. The resulting mib and size may be used in subsequent sysctl() calls to get the data associated with the requested ASCII name. This interface is intended for use by applications that want to repeatedly request the same variable (the sysctl() function runs in about a third the time as the same request made via the sysctlbyname() function). The number of elements in the mib array can be determined by calling sysctlnametomib() with the NULL argument for mibp. The sysctlnametomib() function is also useful for fetching mib prefixes. If size on input is greater than the number of elements written, the array still contains the additional elements which may be written programmatically.
      Parameters:
        `name` - ASCII representation of the name
        `mibp` - Integer array containing the corresponding name vector.
        `size` - On input, number of elements in the returned array; on output, the number of entries copied.
      Returns:
        0 on success; sets errno on failure

    - #### host_processor_info

          int host_processor_info(int machPort,
                                  int flavor,
                                  IntByReference procCount,
                                  PointerByReference procInfo,
                                  IntByReference procInfoCount)

      The host_processor_info function returns information about processors.
      Parameters:
        `machPort` - The control port for the host for which information is to be obtained.
        `flavor` - The type of information requested.
        `procCount` - Pointer to the number of processors
        `procInfo` - Pointer to the structure corresponding to the requested flavor
        `procInfoCount` - Pointer to number of elements in the returned structure
      Returns:
        0 on success; sets errno on failure

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