Package com.sun.jna.platform.mac

# Interface SystemB

All Superinterfaces:
  `LibCAPI`, `Library`, `Reboot`, `Resource`

public interface SystemB extends LibCAPI, Library

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static class`
  `SystemB.Group`
  Return type for getgrgid
  `static class`
  `SystemB.HostCpuLoadInfo`
  `static class`
  `SystemB.HostLoadInfo`
  `static class`
  `SystemB.IFdata`
  Data type as part of IFmsgHdr
  `static class`
  `SystemB.IFdata64`
  Data type as part of IFmsgHdr
  `static class`
  `SystemB.IFmsgHdr`
  Return type for sysctl CTL_NET,PF_ROUTE
  `static class`
  `SystemB.IFmsgHdr2`
  Return type for sysctl CTL_NET,PF_ROUTE
  `static class`
  `SystemB.Passwd`
  Return type for getpwuid
  `static class`
  `SystemB.ProcBsdInfo`
  `static class`
  `SystemB.ProcTaskAllInfo`
  `static class`
  `SystemB.ProcTaskInfo`
  `static class`
  `SystemB.RUsageInfoV2`
  `static class`
  `SystemB.Statfs`
  The statfs() routine returns information about a mounted file system.
  `static class`
  `SystemB.Timeval`
  Time value
  `static class`
  `SystemB.Timezone`
  Time Zone
  `static class`
  `SystemB.VMMeter`
  `static class`
  `SystemB.VMStatistics`
  `static class`
  `SystemB.VMStatistics64`
  `static class`
  `SystemB.VnodeInfoPath`
  `static class`
  `SystemB.VnodePathInfo`
  `static class`
  `SystemB.XswUsage`
  Return type for sysctl vm.swapusage

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

  `LibCAPI.size_t, LibCAPI.ssize_t`

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

  `Library.Handler`

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

  `Resource.Rlimit`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `CPU_STATE_IDLE`
  `static final int`
  `CPU_STATE_MAX`
  `static final int`
  `CPU_STATE_NICE`
  `static final int`
  `CPU_STATE_SYSTEM`
  `static final int`
  `CPU_STATE_USER`
  `static final int`
  `HOST_CPU_LOAD_INFO`
  `static final int`
  `HOST_LOAD_INFO`
  `static final int`
  `HOST_VM_INFO`
  `static final int`
  `HOST_VM_INFO64`
  `static final SystemB`
  `INSTANCE`
  `static final int`
  `INT_SIZE`
  `static final int`
  `MAXCOMLEN`
  `static final int`
  `MAXPATHLEN`
  `static final int`
  `MFSTYPENAMELEN`
  `static final int`
  `MNAMELEN`
  `static final int`
  `MNT_DWAIT`
  `static final int`
  `MNT_NOWAIT`
  `static final int`
  `MNT_WAIT`
  `static final int`
  `PROC_ALL_PIDS`
  `static final int`
  `PROC_PIDPATHINFO_MAXSIZE`
  `static final int`
  `PROC_PIDTASKALLINFO`
  `static final int`
  `PROC_PIDTASKINFO`
  `static final int`
  `PROC_PIDTBSDINFO`
  `static final int`
  `PROC_PIDVNODEPATHINFO`
  `static final int`
  `PROCESSOR_BASIC_INFO`
  `static final int`
  `PROCESSOR_CPU_LOAD_INFO`
  `static final int`
  `RUSAGE_INFO_V2`
  `static final int`
  `UINT64_SIZE`

  ### Fields inherited from interface com.sun.jna.platform.unix.LibCAPI

  `HOST_NAME_MAX`

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

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

  Modifier and Type
  Method
  Description
  `int`
  `getfsstat64(SystemB.Statfs[] buf, int bufsize, int flags)`
  The getfsstat() function returns information about all mounted file systems.
  `SystemB.Group`
  `getgrgid(int gid)`
  This function searches the group database for the given group name pointed to by the group id given by gid, returning the first one encountered.
  `int`
  `getpid()`
  Returns the process ID of the calling process.
  `SystemB.Passwd`
  `getpwuid(int uid)`
  This function searches the password database for the given user uid, always returning the first one encountered.
  `int`
  `gettimeofday(SystemB.Timeval tp, SystemB.Timezone tzp)`
  The system's notion of the current Greenwich time and the current time zone is obtained with the gettimeofday() call, and set with the settimeofday() call.
  `int`
  `host_page_size(int hostPort, LongByReference pPageSize)`
  The host_page_size function returns the page size for the given host.
  `int`
  `host_processor_info(int hostPort, int flavor, IntByReference procCount, PointerByReference procInfo, IntByReference procInfoCount)`
  The host_processor_info function returns information about processors.
  `int`
  `host_statistics(int hostPort, 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 hostPort, 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_port_deallocate(int port, int name)`
  Decrement the target port right's user reference count.
  `int`
  `mach_task_self()`
  The mach_task_self system call returns the calling thread's task_self port.
  `int`
  `proc_listpids(int type, int typeinfo, int[] buffer, int buffersize)`
  Search through the current processes
  `int`
  `proc_pid_rusage(int pid, int flavor, SystemB.RUsageInfoV2 buffer)`
  Return resource usage information for the given pid, which can be a live process or a zombie.
  `int`
  `proc_pidinfo(int pid, int flavor, long arg, Structure buffer, int buffersize)`
  Return in buffer a proc_*info structure corresponding to the flavor for the specified process
  `int`
  `proc_pidpath(int pid, Pointer buffer, int buffersize)`
  Return in buffer the name of the specified process
  `int`
  `sysctl(int[] name, int namelen, Pointer oldp, LibCAPI.size_t.ByReference oldlenp, Pointer newp, LibCAPI.size_t newlen)`
  The sysctl() function retrieves system information and allows processes with appropriate privileges to set system information.
  `int`
  `sysctl(int[] name, int namelen, Pointer oldp, IntByReference oldlenp, Pointer newp, int newlen)`
  Deprecated.
  Use `sysctl(int[], int, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t.ByReference, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t)`
  `int`
  `sysctlbyname(String name, Pointer oldp, LibCAPI.size_t.ByReference oldlenp, Pointer newp, LibCAPI.size_t newlen)`
  The sysctlbyname() function accepts an ASCII representation of the name and internally looks up the integer name vector.
  `int`
  `sysctlbyname(String name, Pointer oldp, IntByReference oldlenp, Pointer newp, int newlen)`
  Deprecated.
  Use `sysctlbyname(String, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t.ByReference, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t)`
  `int`
  `sysctlnametomib(String name, Pointer mibp, LibCAPI.size_t.ByReference sizep)`
  This 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.
  `int`
  `sysctlnametomib(String name, Pointer mibp, IntByReference sizep)`
  Deprecated.
  Use `sysctlnametomib(String, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t.ByReference)`

  ### Methods inherited from interface com.sun.jna.platform.unix.LibCAPI

  `close, getdomainname, getegid, getenv, geteuid, getgid, gethostname, getloadavg, getuid, msync, munmap, setdomainname, setegid, setenv, seteuid, setgid, sethostname, setuid, unsetenv`

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

  `reboot`

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

  `getrlimit, setrlimit`

- ## Field Details

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

  - ### MAXCOMLEN

    static final int MAXCOMLEN
    See Also:
      - Constant Field Values

  - ### MAXPATHLEN

    static final int MAXPATHLEN
    See Also:
      - Constant Field Values

  - ### PROC_PIDPATHINFO_MAXSIZE

    static final int PROC_PIDPATHINFO_MAXSIZE
    See Also:
      - Constant Field Values

  - ### PROC_ALL_PIDS

    static final int PROC_ALL_PIDS
    See Also:
      - Constant Field Values

  - ### PROC_PIDTASKALLINFO

    static final int PROC_PIDTASKALLINFO
    See Also:
      - Constant Field Values

  - ### PROC_PIDTBSDINFO

    static final int PROC_PIDTBSDINFO
    See Also:
      - Constant Field Values

  - ### PROC_PIDTASKINFO

    static final int PROC_PIDTASKINFO
    See Also:
      - Constant Field Values

  - ### PROC_PIDVNODEPATHINFO

    static final int PROC_PIDVNODEPATHINFO
    See Also:
      - Constant Field Values

  - ### MFSTYPENAMELEN

    static final int MFSTYPENAMELEN
    See Also:
      - Constant Field Values

  - ### MNAMELEN

    static final int MNAMELEN
    See Also:
      - Constant Field Values

  - ### MNT_WAIT

    static final int MNT_WAIT
    See Also:
      - Constant Field Values

  - ### MNT_NOWAIT

    static final int MNT_NOWAIT
    See Also:
      - Constant Field Values

  - ### MNT_DWAIT

    static final int MNT_DWAIT
    See Also:
      - Constant Field Values

  - ### RUSAGE_INFO_V2

    static final int RUSAGE_INFO_V2
    See Also:
      - Constant Field Values

- ## Method Details

  - ### gettimeofday

    int gettimeofday(SystemB.Timeval tp, SystemB.Timezone tzp)
    The system's notion of the current Greenwich time and the current time zone is obtained with the gettimeofday() call, and set with the settimeofday() call. The time is expressed in seconds and microseconds since midnight (0 hour), January 1, 1970. The resolution of the system clock is hardware dependent, and the time may be updated continuously or in ``ticks.'' If tp is NULL and tzp is non-NULL, gettimeofday() will populate the timezone struct in tzp. If tp is non-NULL and tzp is NULL, then only the timeval struct in tp is populated. If both tp and tzp are NULL, nothing is returned.
    Parameters:
      `tp` - Timeval structure
      `tzp` - Timezone structure
    Returns:
      A 0 return value indicates that the call succeeded. A -1 return value indicates an error occurred, and in this case an error code is stored into the global variable errno.

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

  - ### mach_port_deallocate

    int mach_port_deallocate(int port, int name)
    Decrement the target port right's user reference count.
    Parameters:
      `port` - The port holding the right.
      `name` - The port's name for the right.
    Returns:
      0 if successful, a `kern_return_t` code otherwise.

  - ### host_page_size

    int host_page_size(int hostPort, LongByReference pPageSize)
    The host_page_size function returns the page size for the given host.
    Parameters:
      `hostPort` - 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 hostPort, int hostStat, Structure stats, IntByReference count)
    The host_statistics function returns scheduling and virtual memory statistics concerning the host as specified by hostStat.
    Parameters:
      `hostPort` - 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 hostPort, int hostStat, Structure stats, IntByReference count)
    The host_statistics64 function returns 64-bit virtual memory statistics concerning the host as specified by hostStat.
    Parameters:
      `hostPort` - 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, LibCAPI.size_t.ByReference oldlenp, Pointer newp, LibCAPI.size_t 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` - a Management Information Base (MIB) array of integers
      `namelen` - the length of the array in `name`
      `oldp` - A buffer to hold the information retrieved
      `oldlenp` - Size of the buffer, a pointer to a `LibCAPI.size_t` value
      `newp` - To set a new value, a buffer of information to be written. May be null if no value is to be set.
      `newlen` - Size of the information to be written. May be 0 if no value is to be set.
    Returns:
      0 on success; sets errno on failure

  - ### sysctl

    @Deprecated int sysctl(int[] name, int namelen, Pointer oldp, IntByReference oldlenp, Pointer newp, int newlen)
    Deprecated.
    Use `sysctl(int[], int, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t.ByReference, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t)`

  - ### sysctlbyname

    int sysctlbyname(String name, Pointer oldp, LibCAPI.size_t.ByReference oldlenp, Pointer newp, LibCAPI.size_t 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` - A buffer to hold the information retrieved
      `oldlenp` - Size of the buffer, a pointer to a `LibCAPI.size_t` value
      `newp` - To set a new value, a buffer of information to be written. May be null if no value is to be set.
      `newlen` - Size of the information to be written. May be 0 if no value is to be set.
    Returns:
      0 on success; sets errno on failure

  - ### sysctlbyname

    @Deprecated int sysctlbyname(String name, Pointer oldp, IntByReference oldlenp, Pointer newp, int newlen)
    Deprecated.
    Use `sysctlbyname(String, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t.ByReference, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t)`

  - ### sysctlnametomib

    int sysctlnametomib(String name, Pointer mibp, LibCAPI.size_t.ByReference sizep)
    This 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.
      `sizep` - On input, number of elements in the returned array; on output, the number of entries copied.
    Returns:
      0 on success; sets errno on failure

  - ### sysctlnametomib

    @Deprecated int sysctlnametomib(String name, Pointer mibp, IntByReference sizep)
    Deprecated.
    Use `sysctlnametomib(String, Pointer, com.sun.jna.platform.unix.LibCAPI.size_t.ByReference)`

  - ### host_processor_info

    int host_processor_info(int hostPort, int flavor, IntByReference procCount, PointerByReference procInfo, IntByReference procInfoCount)
    The host_processor_info function returns information about processors.
    Parameters:
      `hostPort` - 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

  - ### getpwuid

    SystemB.Passwd getpwuid(int uid)
    This function searches the password database for the given user uid, always returning the first one encountered.
    Parameters:
      `uid` - The user ID
    Returns:
      a Passwd structure matching that user

  - ### getgrgid

    SystemB.Group getgrgid(int gid)
    This function searches the group database for the given group name pointed to by the group id given by gid, returning the first one encountered. Identical group gids may result in undefined behavior.
    Parameters:
      `gid` - The group ID
    Returns:
      a Group structure matching that group

  - ### proc_listpids

    int proc_listpids(int type, int typeinfo, int[] buffer, int buffersize)
    Search through the current processes
    Parameters:
      `type` - types of processes to be searched
      `typeinfo` - adjunct information for type
      `buffer` - a C array of int-sized values to be filled with process identifiers that hold an open file reference matching the specified path or volume. Pass NULL to obtain the minimum buffer size needed to hold the currently active processes.
      `buffersize` - the size (in bytes) of the provided buffer.
    Returns:
      the number of bytes of data returned in the provided buffer; -1 if an error was encountered;

  - ### proc_pidinfo

    int proc_pidinfo(int pid, int flavor, long arg, Structure buffer, int buffersize)
    Return in buffer a proc_*info structure corresponding to the flavor for the specified process
    Parameters:
      `pid` - the process identifier
      `flavor` - the type of information requested
      `arg` - argument possibly needed for some flavors
      `buffer` - holds results
      `buffersize` - size of results
    Returns:
      the number of bytes of data returned in the provided buffer; -1 if an error was encountered;

  - ### proc_pidpath

    int proc_pidpath(int pid, Pointer buffer, int buffersize)
    Return in buffer the name of the specified process
    Parameters:
      `pid` - the process identifier
      `buffer` - holds results
      `buffersize` - size of results
    Returns:
      the length of the name returned in buffer if successful; 0 otherwise

  - ### proc_pid_rusage

    int proc_pid_rusage(int pid, int flavor, SystemB.RUsageInfoV2 buffer)
    Return resource usage information for the given pid, which can be a live process or a zombie.
    Parameters:
      `pid` - the process identifier
      `flavor` - the type of information requested
      `buffer` - holds results
    Returns:
      0 on success; or -1 on failure, with errno set to indicate the specific error.

  - ### getfsstat64

    int getfsstat64(SystemB.Statfs[] buf, int bufsize, int flags)
    The getfsstat() function returns information about all mounted file systems. The buf argument is a pointer to an array of statfs structures. Fields that are undefined for a particular file system are set to -1. The buffer is filled with an array of statfs structures, one for each mounted file system up to the size specified by bufsize.
    Parameters:
      `buf` - Array of statfs structures that will be filled with results. If buf is given as NULL, getfsstat() returns just the number of mounted file systems.
      `bufsize` - Size of the buffer to fill
      `flags` - If flags is set to MNT_NOWAIT, getfsstat() will directly return the information retained in the kernel to avoid delays caused by waiting for updated information from a file system that is perhaps temporarily unable to respond. Some of the information returned may be out of date, however; if flags is set to MNT_WAIT or MNT_DWAIT instead, getfsstat() will request updated information from each mounted filesystem before returning.
    Returns:
      Upon successful completion, the number of statfs structures is returned. Otherwise, -1 is returned and the global variable errno is set to indicate the error.

  - ### getpid

    int getpid()
    Returns the process ID of the calling process. The ID is guaranteed to be unique and is useful for constructing temporary file names.
    Returns:
      the process ID of the calling process.