com.sun.jna.platform.unix.solaris

## Interface LibKstat

All Superinterfaces:
  Library

    public interface LibKstat
    extends Library

Kstat library. The kstat facility is a general-purpose mechanism for providing kernel statistics to users.

Author:
  widdis[at]gmail[dot]com

### Nested Class Summary

Nested Classes
`static class` `LibKstat.Kstat` The kernel maintains a linked list of statistics structures, or kstats.
`static class` `LibKstat.KstatCtl` A kstat control structure.
`static class` `LibKstat.KstatIntr` Interrupt statistics.
`static class` `LibKstat.KstatIO` IO Statistics.
`static class` `LibKstat.KstatNamed` A list of arbitrary name=value statistics.
`static class` `LibKstat.KstatTimer` Event timer statistics.

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

`Library.Handler`

### Field Summary

Fields
`static int` `EAGAIN`
`static LibKstat` `INSTANCE`
`static byte` `KSTAT_DATA_CHAR`
`static byte` `KSTAT_DATA_INT32`
`static byte` `KSTAT_DATA_INT64`
`static byte` `KSTAT_DATA_STRING`
`static byte` `KSTAT_DATA_UINT32`
`static byte` `KSTAT_DATA_UINT64`
`static int` `KSTAT_INTR_HARD`
`static int` `KSTAT_INTR_MULTSVC`
`static int` `KSTAT_INTR_SOFT`
`static int` `KSTAT_INTR_SPURIOUS`
`static int` `KSTAT_INTR_WATCHDOG`
`static int` `KSTAT_NUM_INTRS`
`static int` `KSTAT_STRLEN`
`static byte` `KSTAT_TYPE_INTR`
`static byte` `KSTAT_TYPE_IO`
`static byte` `KSTAT_TYPE_NAMED`
`static byte` `KSTAT_TYPE_RAW`
`static byte` `KSTAT_TYPE_TIMER`

### 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_SYMBOL_PROVIDER, OPTION_TYPE_MAPPER`

### Method Summary

All Methods Instance Methods Abstract Methods
`int` `kstat_chain_update(LibKstat.KstatCtl kc)` The kstat_chain_update() function brings the user's kstat header chain in sync with that of the kernel.
`int` `kstat_close(LibKstat.KstatCtl kc)` The kstat_close() function frees all resources that were associated with kc.
`Pointer` `kstat_data_lookup(LibKstat.Kstat ksp, java.lang.String name)` The kstat_data_lookup() function searches the kstat's data section for the record with the specified name .
`LibKstat.Kstat` `kstat_lookup(LibKstat.KstatCtl kc, java.lang.String ks_module, int ks_instance, java.lang.String ks_name)` The kstat_lookup() function traverses the kstat chain, kc.kc_chain, searching for a kstat with the same ks_module, ks_instance, and ks_name fields; this triplet uniquely identifies a kstat.
`LibKstat.KstatCtl` `kstat_open()` The kstat_open() function initializes a kstat control structure, which provides access to the kernel statistics library.
`int` `kstat_read(LibKstat.KstatCtl kc, LibKstat.Kstat ksp, Pointer p)` kstat_read() gets data from the kernel for the kstat pointed to by ksp.
`int` `kstat_write(LibKstat.KstatCtl kc, LibKstat.Kstat ksp, Pointer buf)` kstat_write() writes data from buf, or from ksp.ks_data if buf is NULL, to the corresponding kstat in the kernel.

### Field Detail

#### INSTANCE

    static final LibKstat INSTANCE

#### KSTAT_TYPE_RAW

    static final byte KSTAT_TYPE_RAW

See Also:
  Constant Field Values

#### KSTAT_TYPE_NAMED

    static final byte KSTAT_TYPE_NAMED

See Also:
  Constant Field Values

#### KSTAT_TYPE_INTR

    static final byte KSTAT_TYPE_INTR

See Also:
  Constant Field Values

#### KSTAT_TYPE_IO

    static final byte KSTAT_TYPE_IO

See Also:
  Constant Field Values

#### KSTAT_TYPE_TIMER

    static final byte KSTAT_TYPE_TIMER

See Also:
  Constant Field Values

#### KSTAT_DATA_CHAR

    static final byte KSTAT_DATA_CHAR

See Also:
  Constant Field Values

#### KSTAT_DATA_INT32

    static final byte KSTAT_DATA_INT32

See Also:
  Constant Field Values

#### KSTAT_DATA_UINT32

    static final byte KSTAT_DATA_UINT32

See Also:
  Constant Field Values

#### KSTAT_DATA_INT64

    static final byte KSTAT_DATA_INT64

See Also:
  Constant Field Values

#### KSTAT_DATA_UINT64

    static final byte KSTAT_DATA_UINT64

See Also:
  Constant Field Values

#### KSTAT_DATA_STRING

    static final byte KSTAT_DATA_STRING

See Also:
  Constant Field Values

#### KSTAT_INTR_HARD

    static final int KSTAT_INTR_HARD

See Also:
  Constant Field Values

#### KSTAT_INTR_SOFT

    static final int KSTAT_INTR_SOFT

See Also:
  Constant Field Values

#### KSTAT_INTR_WATCHDOG

    static final int KSTAT_INTR_WATCHDOG

See Also:
  Constant Field Values

#### KSTAT_INTR_SPURIOUS

    static final int KSTAT_INTR_SPURIOUS

See Also:
  Constant Field Values

#### KSTAT_INTR_MULTSVC

    static final int KSTAT_INTR_MULTSVC

See Also:
  Constant Field Values

#### KSTAT_NUM_INTRS

    static final int KSTAT_NUM_INTRS

See Also:
  Constant Field Values

#### KSTAT_STRLEN

    static final int KSTAT_STRLEN

See Also:
  Constant Field Values

#### EAGAIN

    static final int EAGAIN

See Also:
  Constant Field Values

### Method Detail

#### kstat_open

    LibKstat.KstatCtl kstat_open()

The kstat_open() function initializes a kstat control structure, which provides access to the kernel statistics library.

Returns:
  A pointer to this structure, which must be supplied as the kc argument in subsequent libkstat function calls.

#### kstat_close

    int kstat_close(LibKstat.KstatCtl kc)

The kstat_close() function frees all resources that were associated with kc.

Parameters:
  `kc` - a kstat control structure
Returns:
  0 on success and -1 on failure.

#### kstat_chain_update

    int kstat_chain_update(LibKstat.KstatCtl kc)

The kstat_chain_update() function brings the user's kstat header chain in sync with that of the kernel. The kstat chain is a linked list of kstat headers (kstat_t's) pointed to by kc.kc_chain, which is initialized by kstat_open(3KSTAT). This chain constitutes a list of all kstats currently in the system. During normal operation, the kernel creates new kstats and delete old ones as various device instances are added and removed, thereby causing the user's copy of the kstat chain to become out of date. The kstat_chain_update() function detects this condition by comparing the kernel's current kstat chain ID(KCID), which is incremented every time the kstat chain changes, to the user's KCID, kc.kc_chain_id. If the KCIDs match, kstat_chain_update() does nothing. Otherwise, it deletes any invalid kstat headers from the user's kstat chain, adds any new ones, and sets kc.kc_chain_id to the new KCID. All other kstat headers in the user's kstat chain are unmodified.

Parameters:
  `kc` - a kstat control structure
Returns:
  the new KCID if the kstat chain has changed, 0 if it hasn't, or -1 on failure.

#### kstat_read

    int kstat_read(LibKstat.KstatCtl kc,
                   LibKstat.Kstat ksp,
                   Pointer p)

kstat_read() gets data from the kernel for the kstat pointed to by ksp. ksp.ks_data is automatically allocated (or reallocated) to be large enough to hold all of the data. ksp.ks_ndata is set to the number of data fields, ksp.ks_data_size is set to the total size of the data, and ksp.ks_snaptime is set to the high-resolution time at which the data snapshot was taken.

Parameters:
  `kc` - The kstat control structure
  `ksp` - The kstat from which to retrieve data
  `p` - If buf is non-NULL , the data is copied from ksp.ks_data into buf.
Returns:
  On success, return the current kstat chain ID (KCID). On failure, return -1.

#### kstat_write

    int kstat_write(LibKstat.KstatCtl kc,
                    LibKstat.Kstat ksp,
                    Pointer buf)

kstat_write() writes data from buf, or from ksp.ks_data if buf is NULL, to the corresponding kstat in the kernel. Only the superuser can use kstat_write() .

Parameters:
  `kc` - The kstat control structure
  `ksp` - The kstat on which to set data
  `buf` - If buf is non-NULL, the data is copied from buf into ksp.ks_data.
Returns:
  On success, return the current kstat chain ID (KCID). On failure, return -1.

#### kstat_lookup

    LibKstat.Kstat kstat_lookup(LibKstat.KstatCtl kc,
                                java.lang.String ks_module,
                                int ks_instance,
                                java.lang.String ks_name)

The kstat_lookup() function traverses the kstat chain, kc.kc_chain, searching for a kstat with the same ks_module, ks_instance, and ks_name fields; this triplet uniquely identifies a kstat. If ks_module is NULL, ks_instance is -1, or ks_name is NULL, then those fields will be ignored in the search. For example, kstat_lookup(kc, NULL, -1, "foo") will simply find the first kstat with name "foo".

Parameters:
  `kc` - The kstat control structure
  `ks_module` - The kstat module to search
  `ks_instance` - The kstat instance number
  `ks_name` - The kstat name to search
Returns:
  a pointer to the requested kstat if it is found, or NULL if it is not.

#### kstat_data_lookup

    Pointer kstat_data_lookup(LibKstat.Kstat ksp,
                              java.lang.String name)

The kstat_data_lookup() function searches the kstat's data section for the record with the specified name . This operation is valid only for kstat types which have named data records. Currently, only the KSTAT_TYPE_NAMED and KSTAT_TYPE_TIMER kstats have named data records.

Parameters:
  `ksp` - The kstat to search
  `name` - The key for the name-value pair, or name of the timer as applicable
Returns:
  a pointer to the requested data record if it is found. If the requested record is not found, or if the kstat type is invalid, returns NULL.

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