Top Description Inners Fields Methods
com.sun.jna.platform.linux

public Interface LibC

extends LibCAPI, Library
Imports
java.lang.reflect.Field, java.util.ArrayList, .Iterator, .List, com.sun.jna.Library, .Native, .NativeLong, .Structure, .Structure.FieldOrder, com.sun.jna.platform.unix.LibCAPI

LibC structures and functions unique to Linux

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
public static final LibC
public static final String
Inherited from com.sun.jna.Library:
OPTION_ALLOW_OBJECTSOPTION_CALLING_CONVENTIONOPTION_CLASSLOADEROPTION_FUNCTION_MAPPEROPTION_INVOCATION_MAPPEROPTION_OPEN_FLAGSOPTION_STRING_ENCODINGOPTION_STRUCTURE_ALIGNMENTOPTION_SYMBOL_PROVIDEROPTION_TYPE_MAPPER
Inherited from com.sun.jna.platform.unix.LibCAPI:
HOST_NAME_MAX

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
statvfs
(String
the pathname of any file within the mounted filesystem.
path
,
LibC.Statvfs
a pointer to a statvfs structure
buf
)

The function statvfs() returns information about a mounted filesystem.

public int

Returns:

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
sysinfo
(LibC.Sysinfo
A Sysinfo structure which will be populated
info
)

sysinfo() provides a simple way of getting overall system statistics.

Inherited from com.sun.jna.platform.unix.LibCAPI:
closegetdomainnamegetegidgetenvgeteuidgetgidgethostnamegetloadavggetuidmsyncmunmapsetdomainnamesetegidsetenvseteuidsetgidsethostnamesetuidunsetenv

Field Detail

INSTANCEback to summary
public static final LibC INSTANCE
NAMEback to summary
public static final String NAME

Method Detail

statvfsback to summary
public int statvfs(String path, LibC.Statvfs buf)

The function statvfs() returns information about a mounted filesystem.

Parameters
path:String

the pathname of any file within the mounted filesystem.

buf:LibC.Statvfs

a pointer to a statvfs structure

Returns:int

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

sysinfoback to summary
public int sysinfo(LibC.Sysinfo info)

sysinfo() provides a simple way of getting overall system statistics. This is more portable than reading /dev/kmem.

Parameters
info:LibC.Sysinfo

A Sysinfo structure which will be populated

Returns:int

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

com.sun.jna.platform.linux back to summary

public Class LibC.Statvfs

extends Structure
Class Inheritance
Annotations
@FieldOrder:f_bsize, f_frsize, f_blocks, f_bfree, f_bavail, f_files, f_ffree, f_favail, f_fsid, _f_unused, f_flag, f_namemax, _f_spare

Field Summary

Modifier and TypeField and Description
public int[]
public int
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong
Inherited from com.sun.jna.Structure:
ALIGN_DEFAULTALIGN_GNUCALIGN_MSVCALIGN_NONECALCULATE_SIZE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected List<Field>
getFieldList()

Overrides com.sun.jna.Structure.getFieldList.

Look up all fields in this class and superclasses.
protected List<String>
getFieldOrder()

Overrides com.sun.jna.Structure.getFieldOrder.

Returns this Structure's field names in their proper order.
Inherited from com.sun.jna.Structure:
allocateMemoryallocateMemoryautoAllocateautoReadautoReadautoWriteautoWritecacheTypeInfocalculateSizeclearcreateFieldsOrdercreateFieldsOrdercreateFieldsOrdercreateFieldsOrderdataEqualsdataEqualsensureAllocatedequalsfieldOffsetgetAutoReadgetAutoWritegetFieldsgetNativeAlignmentgetNativeSizegetNativeSizegetPointergetStringEncodinggetStructAlignmenthashCodenewInstancenewInstancereadreadFieldreadFieldsetAlignTypesetAutoReadsetAutoSynchsetAutoWritesetStringEncodingsizesortFieldstoArraytoArraytoStringtoStringuseMemoryuseMemorywritewriteFieldwriteFieldwriteField

Field Detail

_f_spareback to summary
public int[] _f_spare
_f_unusedback to summary
public int _f_unused
f_bavailback to summary
public NativeLong f_bavail
f_bfreeback to summary
public NativeLong f_bfree
f_blocksback to summary
public NativeLong f_blocks
f_bsizeback to summary
public NativeLong f_bsize
f_favailback to summary
public NativeLong f_favail
f_ffreeback to summary
public NativeLong f_ffree
f_filesback to summary
public NativeLong f_files
f_flagback to summary
public NativeLong f_flag
f_frsizeback to summary
public NativeLong f_frsize
f_fsidback to summary
public NativeLong f_fsid
f_namemaxback to summary
public NativeLong f_namemax

Constructor Detail

Statvfsback to summary
public Statvfs()

Method Detail

getFieldListback to summary
protected List<Field> getFieldList()

Overrides com.sun.jna.Structure.getFieldList.

Doc from com.sun.jna.Structure.getFieldList.

Look up all fields in this class and superclasses.

Returns:List<Field>

ordered list of public java.lang.reflect.Field available on this Structure class.

Annotations
@Override
getFieldOrderback to summary
protected List<String> getFieldOrder()

Overrides com.sun.jna.Structure.getFieldOrder.

Doc from com.sun.jna.Structure.getFieldOrder.

Returns this Structure's field names in their proper order.
When defining a new Structure you shouldn't override this method, but use FieldOrder annotation to define your field order(this also works with inheritance)
If you want to do something non-standard you can override the method and define it as followed


protected List getFieldOrder() {
    return Arrays.asList(...);
}

Important Note

When deriving from an existing Structure subclass, ensure that you augment the list provided by the superclass, e.g.


protected List getFieldOrder() {
    List fields = new LinkedList(super.getFieldOrder());
    fields.addAll(Arrays.asList(...));
    return fields;
}
Field order must be explicitly indicated, since the field order as returned by Class#getFields() is not guaranteed to be predictable.
Returns:List<String>

ordered list of field names

Annotations
@Override
com.sun.jna.platform.linux back to summary

public Class LibC.Sysinfo

extends Structure
Class Inheritance
Annotations
@FieldOrder:uptime, loads, totalram, freeram, sharedram, bufferram, totalswap, freeswap, procs, totalhigh, freehigh, mem_unit, _f

Field Summary

Modifier and TypeField and Description
public byte[]
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong[]
public int
private static final int
public short
public NativeLong
public NativeLong
public NativeLong
public NativeLong
public NativeLong
Inherited from com.sun.jna.Structure:
ALIGN_DEFAULTALIGN_GNUCALIGN_MSVCALIGN_NONECALCULATE_SIZE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected List<Field>
getFieldList()

Overrides com.sun.jna.Structure.getFieldList.

Look up all fields in this class and superclasses.
protected List<String>
getFieldOrder()

Overrides com.sun.jna.Structure.getFieldOrder.

Returns this Structure's field names in their proper order.
Inherited from com.sun.jna.Structure:
allocateMemoryallocateMemoryautoAllocateautoReadautoReadautoWriteautoWritecacheTypeInfocalculateSizeclearcreateFieldsOrdercreateFieldsOrdercreateFieldsOrdercreateFieldsOrderdataEqualsdataEqualsensureAllocatedequalsfieldOffsetgetAutoReadgetAutoWritegetFieldsgetNativeAlignmentgetNativeSizegetNativeSizegetPointergetStringEncodinggetStructAlignmenthashCodenewInstancenewInstancereadreadFieldreadFieldsetAlignTypesetAutoReadsetAutoSynchsetAutoWritesetStringEncodingsizesortFieldstoArraytoArraytoStringtoStringuseMemoryuseMemorywritewriteFieldwriteFieldwriteField

Field Detail

_fback to summary
public byte[] _f
bufferramback to summary
public NativeLong bufferram
freehighback to summary
public NativeLong freehigh
freeramback to summary
public NativeLong freeram
freeswapback to summary
public NativeLong freeswap
loadsback to summary
public NativeLong[] loads
mem_unitback to summary
public int mem_unit
PADDING_SIZEback to summary
private static final int PADDING_SIZE
procsback to summary
public short procs
sharedramback to summary
public NativeLong sharedram
totalhighback to summary
public NativeLong totalhigh
totalramback to summary
public NativeLong totalram
totalswapback to summary
public NativeLong totalswap
uptimeback to summary
public NativeLong uptime

Constructor Detail

Sysinfoback to summary
public Sysinfo()

Method Detail

getFieldListback to summary
protected List<Field> getFieldList()

Overrides com.sun.jna.Structure.getFieldList.

Doc from com.sun.jna.Structure.getFieldList.

Look up all fields in this class and superclasses.

Returns:List<Field>

ordered list of public java.lang.reflect.Field available on this Structure class.

Annotations
@Override
getFieldOrderback to summary
protected List<String> getFieldOrder()

Overrides com.sun.jna.Structure.getFieldOrder.

Doc from com.sun.jna.Structure.getFieldOrder.

Returns this Structure's field names in their proper order.
When defining a new Structure you shouldn't override this method, but use FieldOrder annotation to define your field order(this also works with inheritance)
If you want to do something non-standard you can override the method and define it as followed


protected List getFieldOrder() {
    return Arrays.asList(...);
}

Important Note

When deriving from an existing Structure subclass, ensure that you augment the list provided by the superclass, e.g.


protected List getFieldOrder() {
    List fields = new LinkedList(super.getFieldOrder());
    fields.addAll(Arrays.asList(...));
    return fields;
}
Field order must be explicitly indicated, since the field order as returned by Class#getFields() is not guaranteed to be predictable.
Returns:List<String>

ordered list of field names

Annotations
@Override