Interface CLibrary

All Superinterfaces:
com.sun.jna.platform.unix.LibCAPI, com.sun.jna.Library, com.sun.jna.platform.unix.Reboot, com.sun.jna.platform.unix.Resource
All Known Subinterfaces:
FreeBsdLibc, LinuxLibc, SolarisLibc, SystemB

public interface CLibrary
extends com.sun.jna.platform.unix.LibCAPI, com.sun.jna.Library
C library with code common to all *nix-based operating systems. 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  CLibrary.Addrinfo  
    static class  CLibrary.Ip6stat
    Return type for sysctl net.inet6.ip6.stats
    static class  CLibrary.Ipstat
    Return type for sysctl net.inet.ip.stats
    static class  CLibrary.Sockaddr  
    static class  CLibrary.Tcpstat
    Return type for sysctl net.inet.ip.stats
    static class  CLibrary.Udpstat
    Return type for sysctl net.inet.udp.stats

    Nested classes/interfaces inherited from interface com.sun.jna.platform.unix.LibCAPI

    com.sun.jna.platform.unix.LibCAPI.size_t, com.sun.jna.platform.unix.LibCAPI.ssize_t

    Nested classes/interfaces inherited from interface com.sun.jna.Library

    com.sun.jna.Library.Handler

    Nested classes/interfaces inherited from interface com.sun.jna.platform.unix.Resource

    com.sun.jna.platform.unix.Resource.Rlimit
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int AI_CANONNAME  
    static int LOGIN_PROCESS  
    static int USER_PROCESS  
    static int UT_HOSTSIZE  
    static int UT_LINESIZE  
    static int UT_NAMESIZE  

    Fields inherited from interface com.sun.jna.platform.unix.LibCAPI

    HOST_NAME_MAX

    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
    void endutxent()
    Closes the utmp file.
    void freeaddrinfo​(com.sun.jna.Pointer res)
    Frees the memory that was allocated for the dynamically allocated linked list res.
    java.lang.String gai_strerror​(int e)
    Translates getaddrinfo error codes to a human readable string, suitable for error reporting.
    int getaddrinfo​(java.lang.String node, java.lang.String service, CLibrary.Addrinfo hints, com.sun.jna.ptr.PointerByReference res)
    Given node and service, which identify an Internet host and a service, getaddrinfo() returns one or more addrinfo structures, each of which contains an Internet address that can be specified in a call to bind(2) or connect(2).
    int getpid()
    Returns the process ID of the calling process.
    void setutxent()
    Rewinds the file pointer to the beginning of the utmp file.

    Methods inherited from interface com.sun.jna.platform.unix.LibCAPI

    close, getdomainname, getegid, getenv, geteuid, getgid, gethostname, getloadavg, getuid, msync, munmap, setdomainname, setegid, setenv, seteuid, setgid, sethostname, setuid, unsetenv

    Methods inherited from interface com.sun.jna.platform.unix.Reboot

    reboot

    Methods inherited from interface com.sun.jna.platform.unix.Resource

    getrlimit, setrlimit
  • Field Details

  • Method Details

    • getpid

      int getpid()
      Returns the process ID of the calling process. The ID is guaranteed to be unique and is useful for constructing temporary file names.
      Returns:
      the process ID of the calling process.
    • getaddrinfo

      int getaddrinfo​(java.lang.String node, java.lang.String service, CLibrary.Addrinfo hints, com.sun.jna.ptr.PointerByReference res)
      Given node and service, which identify an Internet host and a service, getaddrinfo() returns one or more addrinfo structures, each of which contains an Internet address that can be specified in a call to bind(2) or connect(2).
      Parameters:
      node - a numerical network address or a network hostname, whose network addresses are looked up and resolved.
      service - sets the port in each returned address structure.
      hints - specifies criteria for selecting the socket address structures returned in the list pointed to by res.
      res - returned address structure
      Returns:
      0 on success; sets errno on failure
    • freeaddrinfo

      void freeaddrinfo​(com.sun.jna.Pointer res)
      Frees the memory that was allocated for the dynamically allocated linked list res.
      Parameters:
      res - Pointer to linked list returned by getaddrinfo
    • gai_strerror

      java.lang.String gai_strerror​(int e)
      Translates getaddrinfo error codes to a human readable string, suitable for error reporting.
      Parameters:
      e - Error code from getaddrinfo
      Returns:
      A human-readable version of the error code
    • setutxent

      void setutxent()
      Rewinds the file pointer to the beginning of the utmp file. It is generally a good idea to call it before any of the other functions.
    • endutxent

      void endutxent()
      Closes the utmp file. It should be called when the user code is done accessing the file with the other functions.