Package jnr.posix

Interface POSIX

    • Method Detail

      • crypt

        byte[] crypt​(byte[] key,
                     byte[] salt)
        Call the crypt function with the given key and salt as raw null-terminated byte (C char) strings.
        Parameters:
        key - null-terminated key bytes
        salt - null-terminated salt bytes
        Returns:
        null-terminated crypted bytes, or null if there was an error
      • chmod

        int chmod​(String filename,
                  int mode)
      • fchmod

        int fchmod​(int fd,
                   int mode)
      • chown

        int chown​(String filename,
                  int user,
                  int group)
      • fchown

        int fchown​(int fd,
                   int user,
                   int group)
      • exec

        int exec​(String path,
                 String... argv)
        Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.
        Parameters:
        path - the path to execute
        argv - the arguments to pass, with arg0 equal to the desired process name
        Returns:
        does not return if successful; -1 if failed
      • exec

        int exec​(String path,
                 String[] argv,
                 String[] envp)
        Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.
        Parameters:
        path - the path to execute
        argv - the arguments to pass, with arg0 equal to the desired process name
        envp - a set of KEY=VALUE environment strings to set for the new execution
        Returns:
        does not return if successful; -1 if failed
      • fork

        int fork()
      • fstat

        FileStat fstat​(int descriptor)
      • fstat

        int fstat​(int fd,
                  FileStat stat)
      • environ

        jnr.ffi.Pointer environ()
      • getegid

        int getegid()
      • geteuid

        int geteuid()
      • seteuid

        int seteuid​(int euid)
      • getgid

        int getgid()
      • getdtablesize

        int getdtablesize()
      • getpgid

        int getpgid()
      • getpgid

        int getpgid​(int pid)
      • getpgrp

        int getpgrp()
      • getpid

        int getpid()
      • getppid

        int getppid()
      • getpriority

        int getpriority​(int which,
                        int who)
      • getpwuid

        Passwd getpwuid​(int which)
      • getgrgid

        Group getgrgid​(int which)
      • getgrent

        Group getgrent()
      • endgrent

        int endgrent()
      • setgrent

        int setgrent()
      • endpwent

        int endpwent()
      • setpwent

        int setpwent()
      • getuid

        int getuid()
      • getrlimit

        int getrlimit​(int resource,
                      RLimit rlim)
      • getrlimit

        int getrlimit​(int resource,
                      jnr.ffi.Pointer rlim)
      • getrlimit

        RLimit getrlimit​(int resource)
      • setrlimit

        int setrlimit​(int resource,
                      RLimit rlim)
      • setrlimit

        int setrlimit​(int resource,
                      jnr.ffi.Pointer rlim)
      • setrlimit

        int setrlimit​(int resource,
                      long rlimCur,
                      long rlimMax)
      • isatty

        int isatty​(int descriptor)
      • kill

        int kill​(int pid,
                 int signal)
      • kill

        int kill​(long pid,
                 int signal)
      • raise

        int raise​(int sig)
      • lchmod

        int lchmod​(String filename,
                   int mode)
      • lchown

        int lchown​(String filename,
                   int user,
                   int group)
      • mkdir

        int mkdir​(String path,
                  int mode)
      • readlink

        int readlink​(CharSequence path,
                     byte[] buf,
                     int bufsize)
      • readlink

        int readlink​(CharSequence path,
                     jnr.ffi.Pointer bufPtr,
                     int bufsize)
      • rmdir

        int rmdir​(String path)
      • setenv

        int setenv​(String envName,
                   String envValue,
                   int overwrite)
      • setsid

        int setsid()
      • setgid

        int setgid​(int gid)
      • setegid

        int setegid​(int egid)
      • setpgid

        int setpgid​(int pid,
                    int pgid)
      • setpgrp

        int setpgrp​(int pid,
                    int pgrp)
      • setpriority

        int setpriority​(int which,
                        int who,
                        int prio)
      • setuid

        int setuid​(int uid)
      • umask

        int umask​(int mask)
      • unsetenv

        int unsetenv​(String envName)
      • utimes

        int utimes​(String path,
                   long[] atimeval,
                   long[] mtimeval)
      • utimes

        int utimes​(String path,
                   jnr.ffi.Pointer times)
      • futimes

        int futimes​(int fd,
                    long[] atimeval,
                    long[] mtimeval)
      • lutimes

        int lutimes​(String path,
                    long[] atimeval,
                    long[] mtimeval)
      • utimensat

        int utimensat​(int dirfd,
                      String path,
                      long[] atimespec,
                      long[] mtimespec,
                      int flag)
      • utimensat

        int utimensat​(int dirfd,
                      String path,
                      jnr.ffi.Pointer times,
                      int flag)
      • futimens

        int futimens​(int fd,
                     long[] atimespec,
                     long[] mtimespec)
      • futimens

        int futimens​(int fd,
                     jnr.ffi.Pointer times)
      • waitpid

        int waitpid​(int pid,
                    int[] status,
                    int flags)
      • waitpid

        int waitpid​(long pid,
                    int[] status,
                    int flags)
      • wait

        int wait​(int[] status)
      • errno

        int errno()
      • errno

        void errno​(int value)
      • strerror

        String strerror​(int code)
      • chdir

        int chdir​(String path)
      • isNative

        boolean isNative()
      • libc

        LibC libc()
        Returns null if isNative returns false.
        Returns:
        the LibC implementation for this POSIX
      • sysconf

        long sysconf​(jnr.constants.platform.Sysconf name)
      • confstr

        int confstr​(jnr.constants.platform.Confstr name,
                    ByteBuffer buf,
                    int len)
      • fpathconf

        int fpathconf​(int fd,
                      jnr.constants.platform.Pathconf name)
      • flock

        int flock​(int fd,
                  int operation)
      • dup

        int dup​(int fd)
      • dup2

        int dup2​(int oldFd,
                 int newFd)
      • fcntlInt

        int fcntlInt​(int fd,
                     jnr.constants.platform.Fcntl fcntlConst,
                     int arg)
      • fcntl

        int fcntl​(int fd,
                  jnr.constants.platform.Fcntl fcntlConst,
                  int arg)
      • fcntl

        int fcntl​(int fd,
                  jnr.constants.platform.Fcntl fcntlConst)
      • close

        int close​(int fd)
      • open

        int open​(CharSequence path,
                 int flags,
                 int perm)
      • read

        long read​(int fd,
                  byte[] buf,
                  long n)
      • write

        long write​(int fd,
                   byte[] buf,
                   long n)
      • read

        long read​(int fd,
                  ByteBuffer buf,
                  long n)
      • write

        long write​(int fd,
                   ByteBuffer buf,
                   long n)
      • pread

        long pread​(int fd,
                   byte[] buf,
                   long n,
                   long offset)
      • pwrite

        long pwrite​(int fd,
                    byte[] buf,
                    long n,
                    long offset)
      • pread

        long pread​(int fd,
                   ByteBuffer buf,
                   long n,
                   long offset)
      • pwrite

        long pwrite​(int fd,
                    ByteBuffer buf,
                    long n,
                    long offset)
      • read

        int read​(int fd,
                 byte[] buf,
                 int n)
      • write

        int write​(int fd,
                  byte[] buf,
                  int n)
      • read

        int read​(int fd,
                 ByteBuffer buf,
                 int n)
      • write

        int write​(int fd,
                  ByteBuffer buf,
                  int n)
      • pread

        int pread​(int fd,
                  byte[] buf,
                  int n,
                  int offset)
      • pwrite

        int pwrite​(int fd,
                   byte[] buf,
                   int n,
                   int offset)
      • pread

        int pread​(int fd,
                  ByteBuffer buf,
                  int n,
                  int offset)
      • pwrite

        int pwrite​(int fd,
                   ByteBuffer buf,
                   int n,
                   int offset)
      • lseek

        int lseek​(int fd,
                  long offset,
                  int whence)
      • lseekLong

        long lseekLong​(int fd,
                       long offset,
                       int whence)
      • pipe

        int pipe​(int[] fds)
      • truncate

        int truncate​(CharSequence path,
                     long length)
      • ftruncate

        int ftruncate​(int fd,
                      long offset)
      • gethostname

        String gethostname()
      • socketpair

        int socketpair​(int domain,
                       int type,
                       int protocol,
                       int[] fds)
      • sendmsg

        int sendmsg​(int socket,
                    MsgHdr message,
                    int flags)
      • recvmsg

        int recvmsg​(int socket,
                    MsgHdr message,
                    int flags)
      • allocateMsgHdr

        MsgHdr allocateMsgHdr()
      • fcntl

        @Deprecated
        int fcntl​(int fd,
                  jnr.constants.platform.Fcntl fcntlConst,
                  int... arg)
        Deprecated.
        This version does not pass args because jnr-ffi does not support variadic invocation.
        fcntl(2)
        Parameters:
        fd - the file descriptor on which to act
        fcntlConst - the Fcntl enum value for the flag to set
        arg - arguments for the flag or null if none
        Returns:
        0 if success, -1 if error
        See Also:
        fcntlInt(int, jnr.constants.platform.Fcntl, int)
      • fsync

        int fsync​(int fd)
      • fdatasync

        int fdatasync​(int fd)
      • mkfifo

        int mkfifo​(String filename,
                   int mode)
      • daemon

        int daemon​(int nochdir,
                   int noclose)
      • getgroups

        long[] getgroups()
      • getgroups

        int getgroups​(int size,
                      int[] groups)
      • nl_langinfo

        String nl_langinfo​(int item)
      • setlocale

        String setlocale​(int category,
                         String locale)
      • allocateTimeval

        Timeval allocateTimeval()
      • gettimeofday

        int gettimeofday​(Timeval tv)