Package oshi.jna.platform.unix.freebsd
Interface FreeBsdLibc
- All Superinterfaces:
CLibrary
,com.sun.jna.platform.unix.LibCAPI
,com.sun.jna.Library
,com.sun.jna.platform.unix.Reboot
,com.sun.jna.platform.unix.Resource
public interface FreeBsdLibc extends CLibrary
C library. This class should be considered non-API as it may be removed
if/when its code is incorporated into the JNA project.
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
FreeBsdLibc.CpTime
static class
FreeBsdLibc.FreeBsdUtmpx
static class
FreeBsdLibc.Timeval
Return type for BSD sysctl kern.boottimeNested classes/interfaces inherited from interface oshi.jna.platform.unix.CLibrary
CLibrary.Addrinfo, CLibrary.Ip6stat, CLibrary.Ipstat, CLibrary.Sockaddr, CLibrary.Tcpstat, CLibrary.Udpstat
-
Field Summary
Fields Modifier and Type Field Description static int
CP_IDLE
ConstantCP_IDLE=4
static int
CP_INTR
ConstantCP_INTR=3
static int
CP_NICE
ConstantCP_NICE=1
static int
CP_SYS
ConstantCP_SYS=2
static int
CP_USER
ConstantCP_USER=0
static int
CPUSTATES
ConstantCPUSTATES=5
static FreeBsdLibc
INSTANCE
static int
INT_SIZE
ConstantINT_SIZE=Native.getNativeSize(int.class)
static int
UINT64_SIZE
ConstantUINT64_SIZE=Native.getNativeSize(long.class)
static int
UTX_HOSTSIZE
static int
UTX_IDSIZE
static int
UTX_LINESIZE
static int
UTX_USERSIZE
Fields inherited from interface oshi.jna.platform.unix.CLibrary
AI_CANONNAME, LOGIN_PROCESS, USER_PROCESS, UT_HOSTSIZE, UT_LINESIZE, UT_NAMESIZE
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
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 FreeBsdLibc.FreeBsdUtmpx
getutxent()
Reads a line from the current file position in the utmp file.int
sysctl(int[] name, int namelen, com.sun.jna.Pointer oldp, com.sun.jna.ptr.IntByReference oldlenp, com.sun.jna.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, com.sun.jna.Pointer oldp, com.sun.jna.ptr.IntByReference oldlenp, com.sun.jna.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, com.sun.jna.Pointer mibp, com.sun.jna.ptr.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.Methods inherited from interface oshi.jna.platform.unix.CLibrary
endutxent, freeaddrinfo, gai_strerror, getaddrinfo, getpid, setutxent
-
Field Details
-
INSTANCE
-
UTX_USERSIZE
static final int UTX_USERSIZE- See Also:
- Constant Field Values
-
UTX_LINESIZE
static final int UTX_LINESIZE- See Also:
- Constant Field Values
-
UTX_IDSIZE
static final int UTX_IDSIZE- See Also:
- Constant Field Values
-
UTX_HOSTSIZE
static final int UTX_HOSTSIZE- See Also:
- Constant Field Values
-
UINT64_SIZE
static final int UINT64_SIZEConstantUINT64_SIZE=Native.getNativeSize(long.class)
-
INT_SIZE
static final int INT_SIZEConstantINT_SIZE=Native.getNativeSize(int.class)
-
CPUSTATES
static final int CPUSTATESConstantCPUSTATES=5
- See Also:
- Constant Field Values
-
CP_USER
static final int CP_USERConstantCP_USER=0
- See Also:
- Constant Field Values
-
CP_NICE
static final int CP_NICEConstantCP_NICE=1
- See Also:
- Constant Field Values
-
CP_SYS
static final int CP_SYSConstantCP_SYS=2
- See Also:
- Constant Field Values
-
CP_INTR
static final int CP_INTRConstantCP_INTR=3
- See Also:
- Constant Field Values
-
CP_IDLE
static final int CP_IDLEConstantCP_IDLE=4
- See Also:
- Constant Field Values
-
-
Method Details
-
sysctl
int sysctl(int[] name, int namelen, com.sun.jna.Pointer oldp, com.sun.jna.ptr.IntByReference oldlenp, com.sun.jna.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 integersnamelen
- length of the MIB arrayoldp
- Information retrievedoldlenp
- Size of information retrievednewp
- Information to be writtennewlen
- Size of information to be written- Returns:
- 0 on success; sets errno on failure
-
sysctlbyname
int sysctlbyname(java.lang.String name, com.sun.jna.Pointer oldp, com.sun.jna.ptr.IntByReference oldlenp, com.sun.jna.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 nameoldp
- Information retrievedoldlenp
- Size of information retrievednewp
- Information to be writtennewlen
- Size of information to be written- Returns:
- 0 on success; sets errno on failure
-
sysctlnametomib
int sysctlnametomib(java.lang.String name, com.sun.jna.Pointer mibp, com.sun.jna.ptr.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 namemibp
- 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
-
getutxent
FreeBsdLibc.FreeBsdUtmpx getutxent()Reads a line from the current file position in the utmp file. It returns a pointer to a structure containing the fields of the line.Not thread safe
- Returns:
- a
FreeBsdLibc.FreeBsdUtmpx
on success, and NULL on failure (which includes the "record not found" case)
-