public interface LibC
extends com.sun.jna.Library
Modifier and Type | Field and Description |
---|---|
static LibC |
INSTANCE
Native library instance.
|
Modifier and Type | Method and Description |
---|---|
int |
fclose(com.sun.jna.Pointer stream)
Close a file stream.
|
com.sun.jna.Pointer |
fdopen(int filedes,
String mode)
Open a stream for a file descriptor.
|
com.sun.jna.Pointer |
freopen(String path,
String mode,
com.sun.jna.Pointer stream)
Associate an existing stream to a new file.
|
int |
getpid()
Get the current process id.
|
int |
mlock(com.sun.jna.Pointer addr,
com.sun.jna.NativeLong length)
Locks (pins) parts of virtual address space into RAM so it can not be swapped out.
|
int |
munlock(com.sun.jna.Pointer addr,
com.sun.jna.NativeLong length)
Unlock previously locked memory.
|
int |
setenv(String name,
String value,
int overwrite)
Change or add an evironment variable.
|
int |
unsetenv(String name)
Unset an environment variable.
|
int |
vsnprintf(ByteBuffer str,
int size,
String format,
com.sun.jna.Pointer args)
Format a string with a variable arguments list into a fixed size buffer.
|
static final LibC INSTANCE
int vsnprintf(ByteBuffer str, int size, String format, com.sun.jna.Pointer args)
The resultant string will be truncated to the size of the buffer if it would otherwise exceed it.
For example, if the buffer has a capacity of 10 this is a maximum of 9 characters plus a null terminator for a total capacity of 10. This means if 10 characters are required, the buffer capacity must be 11 to accommodate the null terminator.
str
- buffersize
- capacity of the buffer, including space for a null terminatorformat
- format stringargs
- format argumentsint mlock(com.sun.jna.Pointer addr, com.sun.jna.NativeLong length)
addr
- address pointerlength
- lengtherrno
to an error codeint munlock(com.sun.jna.Pointer addr, com.sun.jna.NativeLong length)
addr
- address pointerlength
- lengtherrno
to an error codecom.sun.jna.Pointer fdopen(int filedes, String mode)
filedes
- file descriptormode
- open modeNULL
, setting errno
to an error codecom.sun.jna.Pointer freopen(String path, String mode, com.sun.jna.Pointer stream)
path
- new file pathmode
- open modestream
- file streamNULL
, setting errno
to an error codeint fclose(com.sun.jna.Pointer stream)
stream
- streamerrno
to an error codeint setenv(String name, String value, int overwrite)
The value strings are copied (natively).
Not available on Windows.
name
- name of environment variablevalue
- value of the environment variableoverwrite
- non-zero to replace any existing valueerrno
to an error codeint unsetenv(String name)
Not available on Windows.
name
- name of environment variableerrno
to an error codeint getpid()
Not available on Windows.
Copyright © 2009–2015 Caprica Software Limited. All rights reserved.