Package jnr.posix

Class BaseNativePOSIX

    • Field Detail

      • signalHandlers

        protected final Map<jnr.constants.platform.Signal,​SignalHandler> signalHandlers
      • FileStatConverter

        public static final jnr.ffi.mapper.ToNativeConverter<FileStat,​jnr.ffi.Pointer> FileStatConverter
      • TimesConverter

        public static final jnr.ffi.mapper.ToNativeConverter<NativeTimes,​jnr.ffi.Pointer> TimesConverter
      • ConstantConverter

        public static final jnr.ffi.mapper.ToNativeConverter<jnr.constants.Constant,​Integer> ConstantConverter
      • MsgHdrConverter

        public static final jnr.ffi.mapper.ToNativeConverter<MsgHdr,​jnr.ffi.Pointer> MsgHdrConverter
    • Method Detail

      • libc

        public final LibC libc()
        Description copied from interface: POSIX
        Returns null if isNative returns false.
        Specified by:
        libc in interface POSIX
        Returns:
        the LibC implementation for this POSIX
      • crypt

        public final Crypt crypt()
      • unimplementedNull

        protected <T> T unimplementedNull()
      • unimplementedInt

        protected int unimplementedInt()
      • chmod

        public int chmod​(String filename,
                         int mode)
        Specified by:
        chmod in interface POSIX
      • fchmod

        public int fchmod​(int fd,
                          int mode)
        Specified by:
        fchmod in interface POSIX
      • chown

        public int chown​(String filename,
                         int user,
                         int group)
        Specified by:
        chown in interface POSIX
      • fchown

        public int fchown​(int fd,
                          int user,
                          int group)
        Specified by:
        fchown in interface POSIX
      • crypt

        public byte[] crypt​(byte[] key,
                            byte[] salt)
        Description copied from interface: POSIX
        Call the crypt function with the given key and salt as raw null-terminated byte (C char) strings.
        Specified by:
        crypt in interface POSIX
        Parameters:
        key - null-terminated key bytes
        salt - null-terminated salt bytes
        Returns:
        null-terminated crypted bytes, or null if there was an error
      • exec

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

        public int exec​(String path,
                        String[] args,
                        String[] envp)
        Description copied from interface: POSIX
        Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.
        Specified by:
        exec in interface POSIX
        Parameters:
        path - the path to execute
        args - 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
      • fstat

        public int fstat​(int fd,
                         FileStat stat)
        Specified by:
        fstat in interface POSIX
      • environ

        public jnr.ffi.Pointer environ()
        Specified by:
        environ in interface POSIX
      • getegid

        public int getegid()
        Specified by:
        getegid in interface POSIX
      • geteuid

        public int geteuid()
        Specified by:
        geteuid in interface POSIX
      • getgid

        public int getgid()
        Specified by:
        getgid in interface POSIX
      • getdtablesize

        public int getdtablesize()
        Specified by:
        getdtablesize in interface POSIX
      • getpgid

        public int getpgid()
        Specified by:
        getpgid in interface POSIX
      • getpgrp

        public int getpgrp()
        Specified by:
        getpgrp in interface POSIX
      • getpid

        public int getpid()
        Specified by:
        getpid in interface POSIX
      • getppid

        public int getppid()
        Specified by:
        getppid in interface POSIX
      • getgrgid

        public Group getgrgid​(int which)
        Specified by:
        getgrgid in interface POSIX
      • setpwent

        public int setpwent()
        Specified by:
        setpwent in interface POSIX
      • endpwent

        public int endpwent()
        Specified by:
        endpwent in interface POSIX
      • setgrent

        public int setgrent()
        Specified by:
        setgrent in interface POSIX
      • endgrent

        public int endgrent()
        Specified by:
        endgrent in interface POSIX
      • getuid

        public int getuid()
        Specified by:
        getuid in interface POSIX
      • getrlimit

        public int getrlimit​(int resource,
                             RLimit rlim)
        Specified by:
        getrlimit in interface POSIX
      • getrlimit

        public int getrlimit​(int resource,
                             jnr.ffi.Pointer rlim)
        Specified by:
        getrlimit in interface POSIX
      • getrlimit

        public RLimit getrlimit​(int resource)
        Specified by:
        getrlimit in interface POSIX
      • setrlimit

        public int setrlimit​(int resource,
                             RLimit rlim)
        Specified by:
        setrlimit in interface POSIX
      • setrlimit

        public int setrlimit​(int resource,
                             jnr.ffi.Pointer rlim)
        Specified by:
        setrlimit in interface POSIX
      • setrlimit

        public int setrlimit​(int resource,
                             long rlimCur,
                             long rlimMax)
        Specified by:
        setrlimit in interface POSIX
      • setegid

        public int setegid​(int egid)
        Specified by:
        setegid in interface POSIX
      • seteuid

        public int seteuid​(int euid)
        Specified by:
        seteuid in interface POSIX
      • setgid

        public int setgid​(int gid)
        Specified by:
        setgid in interface POSIX
      • getpgid

        public int getpgid​(int pid)
        Specified by:
        getpgid in interface POSIX
      • setpgid

        public int setpgid​(int pid,
                           int pgid)
        Specified by:
        setpgid in interface POSIX
      • setpgrp

        public int setpgrp​(int pid,
                           int pgrp)
        Specified by:
        setpgrp in interface POSIX
      • setsid

        public int setsid()
        Specified by:
        setsid in interface POSIX
      • setuid

        public int setuid​(int uid)
        Specified by:
        setuid in interface POSIX
      • kill

        public int kill​(int pid,
                        int signal)
        Specified by:
        kill in interface POSIX
      • kill

        public int kill​(long pid,
                        int signal)
        Specified by:
        kill in interface POSIX
      • raise

        public int raise​(int sig)
        Specified by:
        raise in interface POSIX
      • lchmod

        public int lchmod​(String filename,
                          int mode)
        Specified by:
        lchmod in interface POSIX
      • lchown

        public int lchown​(String filename,
                          int user,
                          int group)
        Specified by:
        lchown in interface POSIX
      • mkdir

        public int mkdir​(String path,
                         int mode)
        Specified by:
        mkdir in interface POSIX
      • rmdir

        public int rmdir​(String path)
        Specified by:
        rmdir in interface POSIX
      • setenv

        public int setenv​(String envName,
                          String envValue,
                          int overwrite)
        Specified by:
        setenv in interface POSIX
      • readlink

        public int readlink​(CharSequence path,
                            byte[] buf,
                            int bufsize)
        Specified by:
        readlink in interface POSIX
      • readlink

        public int readlink​(CharSequence path,
                            jnr.ffi.Pointer bufPtr,
                            int bufsize)
        Specified by:
        readlink in interface POSIX
      • unsetenv

        public int unsetenv​(String envName)
        Specified by:
        unsetenv in interface POSIX
      • umask

        public int umask​(int mask)
        Specified by:
        umask in interface POSIX
      • utimes

        public int utimes​(String path,
                          long[] atimeval,
                          long[] mtimeval)
        Specified by:
        utimes in interface POSIX
      • utimes

        public int utimes​(String path,
                          jnr.ffi.Pointer times)
        Specified by:
        utimes in interface POSIX
      • futimes

        public int futimes​(int fd,
                           long[] atimeval,
                           long[] mtimeval)
        Specified by:
        futimes in interface POSIX
      • lutimes

        public int lutimes​(String path,
                           long[] atimeval,
                           long[] mtimeval)
        Specified by:
        lutimes in interface POSIX
      • utimensat

        public int utimensat​(int dirfd,
                             String path,
                             long[] atimespec,
                             long[] mtimespec,
                             int flag)
        Specified by:
        utimensat in interface POSIX
      • utimensat

        public int utimensat​(int dirfd,
                             String path,
                             jnr.ffi.Pointer times,
                             int flag)
        Specified by:
        utimensat in interface POSIX
      • futimens

        public int futimens​(int fd,
                            long[] atimespec,
                            long[] mtimespec)
        Specified by:
        futimens in interface POSIX
      • futimens

        public int futimens​(int fd,
                            jnr.ffi.Pointer times)
        Specified by:
        futimens in interface POSIX
      • fork

        public int fork()
        Specified by:
        fork in interface POSIX
      • waitpid

        public int waitpid​(int pid,
                           int[] status,
                           int flags)
        Specified by:
        waitpid in interface POSIX
      • waitpid

        public int waitpid​(long pid,
                           int[] status,
                           int flags)
        Specified by:
        waitpid in interface POSIX
      • wait

        public int wait​(int[] status)
        Specified by:
        wait in interface POSIX
      • getpriority

        public int getpriority​(int which,
                               int who)
        Specified by:
        getpriority in interface POSIX
      • setpriority

        public int setpriority​(int which,
                               int who,
                               int prio)
        Specified by:
        setpriority in interface POSIX
      • isatty

        public int isatty​(int fd)
        Specified by:
        isatty in interface POSIX
      • errno

        public int errno()
        Specified by:
        errno in interface POSIX
      • errno

        public void errno​(int value)
        Specified by:
        errno in interface POSIX
      • chdir

        public int chdir​(String path)
        Specified by:
        chdir in interface POSIX
      • isNative

        public boolean isNative()
        Specified by:
        isNative in interface POSIX
      • flock

        public int flock​(int fd,
                         int mode)
        Specified by:
        flock in interface POSIX
      • dup

        public int dup​(int fd)
        Specified by:
        dup in interface POSIX
      • dup2

        public int dup2​(int oldFd,
                        int newFd)
        Specified by:
        dup2 in interface POSIX
      • fcntlInt

        public int fcntlInt​(int fd,
                            jnr.constants.platform.Fcntl fcntl,
                            int arg)
        Specified by:
        fcntlInt in interface POSIX
      • fcntl

        public int fcntl​(int fd,
                         jnr.constants.platform.Fcntl fcntl)
        Specified by:
        fcntl in interface POSIX
      • fcntl

        public int fcntl​(int fd,
                         jnr.constants.platform.Fcntl fcntl,
                         int arg)
        Specified by:
        fcntl in interface POSIX
      • fcntl

        @Deprecated
        public int fcntl​(int fd,
                         jnr.constants.platform.Fcntl fcntl,
                         int... args)
        Deprecated.
        Description copied from interface: POSIX
        fcntl(2)
        Specified by:
        fcntl in interface POSIX
        Parameters:
        fd - the file descriptor on which to act
        fcntl - the Fcntl enum value for the flag to set
        args - arguments for the flag or null if none
        Returns:
        0 if success, -1 if error
        See Also:
        POSIX.fcntlInt(int, jnr.constants.platform.Fcntl, int)
      • close

        public int close​(int fd)
        Specified by:
        close in interface POSIX
      • sysconf

        public long sysconf​(jnr.constants.platform.Sysconf name)
        Specified by:
        sysconf in interface POSIX
      • confstr

        public int confstr​(jnr.constants.platform.Confstr name,
                           ByteBuffer buf,
                           int len)
        Specified by:
        confstr in interface POSIX
      • fpathconf

        public int fpathconf​(int fd,
                             jnr.constants.platform.Pathconf name)
        Specified by:
        fpathconf in interface POSIX
      • open

        public int open​(CharSequence path,
                        int flags,
                        int perm)
        Specified by:
        open in interface POSIX
      • read

        public long read​(int fd,
                         byte[] buf,
                         long n)
        Specified by:
        read in interface POSIX
      • write

        public long write​(int fd,
                          byte[] buf,
                          long n)
        Specified by:
        write in interface POSIX
      • read

        public long read​(int fd,
                         ByteBuffer buf,
                         long n)
        Specified by:
        read in interface POSIX
      • write

        public long write​(int fd,
                          ByteBuffer buf,
                          long n)
        Specified by:
        write in interface POSIX
      • pread

        public long pread​(int fd,
                          byte[] buf,
                          long n,
                          long offset)
        Specified by:
        pread in interface POSIX
      • pwrite

        public long pwrite​(int fd,
                           byte[] buf,
                           long n,
                           long offset)
        Specified by:
        pwrite in interface POSIX
      • pread

        public long pread​(int fd,
                          ByteBuffer buf,
                          long n,
                          long offset)
        Specified by:
        pread in interface POSIX
      • pwrite

        public long pwrite​(int fd,
                           ByteBuffer buf,
                           long n,
                           long offset)
        Specified by:
        pwrite in interface POSIX
      • read

        public int read​(int fd,
                        byte[] buf,
                        int n)
        Specified by:
        read in interface POSIX
      • write

        public int write​(int fd,
                         byte[] buf,
                         int n)
        Specified by:
        write in interface POSIX
      • read

        public int read​(int fd,
                        ByteBuffer buf,
                        int n)
        Specified by:
        read in interface POSIX
      • write

        public int write​(int fd,
                         ByteBuffer buf,
                         int n)
        Specified by:
        write in interface POSIX
      • pread

        public int pread​(int fd,
                         byte[] buf,
                         int n,
                         int offset)
        Specified by:
        pread in interface POSIX
      • pwrite

        public int pwrite​(int fd,
                          byte[] buf,
                          int n,
                          int offset)
        Specified by:
        pwrite in interface POSIX
      • pread

        public int pread​(int fd,
                         ByteBuffer buf,
                         int n,
                         int offset)
        Specified by:
        pread in interface POSIX
      • pwrite

        public int pwrite​(int fd,
                          ByteBuffer buf,
                          int n,
                          int offset)
        Specified by:
        pwrite in interface POSIX
      • lseek

        public int lseek​(int fd,
                         long offset,
                         int whence)
        Specified by:
        lseek in interface POSIX
      • lseekLong

        public long lseekLong​(int fd,
                              long offset,
                              int whence)
        Specified by:
        lseekLong in interface POSIX
      • pipe

        public int pipe​(int[] fds)
        Specified by:
        pipe in interface POSIX
      • socketpair

        public int socketpair​(int domain,
                              int type,
                              int protocol,
                              int[] fds)
        Specified by:
        socketpair in interface POSIX
      • sendmsg

        public int sendmsg​(int socket,
                           MsgHdr message,
                           int flags)
        Specified by:
        sendmsg in interface POSIX
      • recvmsg

        public int recvmsg​(int socket,
                           MsgHdr message,
                           int flags)
        Specified by:
        recvmsg in interface POSIX
      • ftruncate

        public int ftruncate​(int fd,
                             long offset)
        Specified by:
        ftruncate in interface POSIX
      • fsync

        public int fsync​(int fd)
        Specified by:
        fsync in interface POSIX
      • fdatasync

        public int fdatasync​(int fd)
        Specified by:
        fdatasync in interface POSIX
      • mkfifo

        public int mkfifo​(String filename,
                          int mode)
        Specified by:
        mkfifo in interface POSIX
      • daemon

        public int daemon​(int nochdir,
                          int noclose)
        Specified by:
        daemon in interface POSIX
      • getgroups

        public long[] getgroups()
        Specified by:
        getgroups in interface POSIX
      • getgroups

        public int getgroups​(int size,
                             int[] groups)
        Specified by:
        getgroups in interface POSIX