Interface PosixCLibrary

All Superinterfaces:
NativeLibrary

public non-sealed interface PosixCLibrary extends NativeLibrary
Provides access to methods in libc.so available on POSIX systems.
  • Field Details

    • AF_UNIX

      static final short AF_UNIX
      socket domain indicating unix file socket
      See Also:
    • SOCK_DGRAM

      static final int SOCK_DGRAM
      socket 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

      Create a new RLimit struct for use by getrlimit.
    • getrlimit

      int getrlimit(int resource, PosixCLibrary.RLimit rlimit)
      Retrieve the current rlimit values for the given resource.
      Returns:
      0 on success, -1 on failure with errno set
      See Also:
    • setrlimit

      int setrlimit(int resource, PosixCLibrary.RLimit rlimit)
    • 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

      PosixCLibrary.Stat64 newStat64(int sizeof, int stSizeOffset, int stBlocksOffset)
    • open

      int open(String pathname, int flags, int mode)
    • open

      int open(String pathname, int flags)
    • fstat64

      int fstat64(int fd, PosixCLibrary.Stat64 stats)
    • ftruncate

      int ftruncate(int fd, long length)
    • newFStore

    • fcntl

      int fcntl(int fd, int cmd, PosixCLibrary.FStore fst)
    • 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_UNIX
      type - The socket type, eg SOCK_DGRAM
      protocol - The protocol for the given protocl family, normally 0
      Returns:
      an open file descriptor, or -1 on failure with errno set
      See Also:
    • newUnixSockAddr

      PosixCLibrary.SockAddr newUnixSockAddr(String path)
      Create a sockaddr for the AF_UNIX family.
    • connect

      int connect(int sockfd, PosixCLibrary.SockAddr addr)
      Connect a socket to an address.
      Parameters:
      sockfd - An open socket file descriptor
      addr - The address to connect to
      Returns:
      0 on success, -1 on failure with errno set
    • send

      long send(int sockfd, CloseableByteBuffer buffer, int flags)
      Send a message to a socket.
      Parameters:
      sockfd - The open socket file descriptor
      buffer - The message bytes to send
      flags - 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

      String strerror(int errno)
      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: