Interface PosixCLibrary
- All Superinterfaces:
NativeLibrary
Provides access to methods in libc.so available on POSIX systems.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
static interface
corresponds to struct rlimitstatic interface
Marker interface for sockaddr struct implementations.static interface
corresponds to struct stat64 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final short
socket domain indicating unix file socketstatic final int
socket type indicating a datagram-oriented socket -
Method Summary
Modifier and TypeMethodDescriptionint
close
(int fd) Close a file descriptorint
connect
(int sockfd, PosixCLibrary.SockAddr addr) Connect a socket to an address.int
errno()
Return the error number from the last failed C library call.int
fcntl
(int fd, int cmd, PosixCLibrary.FStore fst) int
fstat64
(int fd, PosixCLibrary.Stat64 stats) int
ftruncate
(int fd, long length) int
geteuid()
Gets the effective userid of the current process.int
getrlimit
(int resource, PosixCLibrary.RLimit rlimit) Retrieve the current rlimit values for the given resource.int
mlockall
(int flags) Lock all the current process's virtual address space into RAM.Create a new RLimit struct for use by getrlimit.newStat64
(int sizeof, int stSizeOffset, int stBlocksOffset) newUnixSockAddr
(String path) Create a sockaddr for the AF_UNIX family.int
int
long
send
(int sockfd, CloseableByteBuffer buffer, int flags) Send a message to a socket.int
setrlimit
(int resource, PosixCLibrary.RLimit rlimit) int
socket
(int domain, int type, int protocol) Open a file descriptor to connect to a socket.strerror
(int errno) Return a string description for an error.
-
Field Details
-
AF_UNIX
static final short AF_UNIXsocket domain indicating unix file socket- See Also:
-
SOCK_DGRAM
static final int SOCK_DGRAMsocket type indicating a datagram-oriented socket- See Also:
-
-
Method Details
-
geteuid
int geteuid()Gets the effective userid of the current process.- Returns:
- the effective user id
- See Also:
-
newRLimit
PosixCLibrary.RLimit newRLimit()Create a new RLimit struct for use by getrlimit. -
getrlimit
Retrieve the current rlimit values for the given resource.- Returns:
- 0 on success, -1 on failure with errno set
- See Also:
-
setrlimit
-
mlockall
int mlockall(int flags) Lock all the current process's virtual address space into RAM.- Parameters:
flags
- flags determining how memory will be locked- Returns:
- 0 on success, -1 on failure with errno set
- See Also:
-
newStat64
-
open
-
open
-
fstat64
-
ftruncate
int ftruncate(int fd, long length) -
newFStore
PosixCLibrary.FStore newFStore() -
fcntl
-
socket
int socket(int domain, int type, int protocol) Open a file descriptor to connect to a socket.- Parameters:
domain
- The socket protocol family, eg AF_UNIXtype
- The socket type, eg SOCK_DGRAMprotocol
- The protocol for the given protocl family, normally 0- Returns:
- an open file descriptor, or -1 on failure with errno set
- See Also:
-
newUnixSockAddr
Create a sockaddr for the AF_UNIX family. -
connect
Connect a socket to an address.- Parameters:
sockfd
- An open socket file descriptoraddr
- The address to connect to- Returns:
- 0 on success, -1 on failure with errno set
-
send
Send a message to a socket.- Parameters:
sockfd
- The open socket file descriptorbuffer
- The message bytes to sendflags
- Flags that may adjust how the message is sent- Returns:
- The number of bytes sent, or -1 on failure with errno set
- See Also:
-
close
int close(int fd) Close a file descriptor- Parameters:
fd
- The file descriptor to close- Returns:
- 0 on success, -1 on failure with errno set
- See Also:
-
strerror
Return a string description for an error.- Parameters:
errno
- The error number- Returns:
- a String description for the error
- See Also:
-
errno
int errno()Return the error number from the last failed C library call.- See Also:
-