Android APIs
public final class

Os

extends Object
java.lang.Object
   ↳ android.system.Os

Class Overview

Access to low-level system functionality. Most of these are system calls. Most users will want to use higher-level APIs where available, but this class provides access to the underlying primitives used to implement the higher-level APIs.

The corresponding constants can be found in OsConstants.

Summary

Public Methods
static FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress)
See accept(2).
static boolean access(String path, int mode)
See access(2).
static void bind(FileDescriptor fd, InetAddress address, int port)
See bind(2).
static void chmod(String path, int mode)
See chmod(2).
static void chown(String path, int uid, int gid)
See chown(2).
static void close(FileDescriptor fd)
See close(2).
static void connect(FileDescriptor fd, InetAddress address, int port)
See connect(2).
static FileDescriptor dup(FileDescriptor oldFd)
See dup(2).
static FileDescriptor dup2(FileDescriptor oldFd, int newFd)
See dup2(2).
static String[] environ()
See environ(3).
static void execv(String filename, String[] argv)
See execv(2).
static void execve(String filename, String[] argv, String[] envp)
See execve(2).
static void fchmod(FileDescriptor fd, int mode)
See fchmod(2).
static void fchown(FileDescriptor fd, int uid, int gid)
See fchown(2).
static void fdatasync(FileDescriptor fd)
static StructStat fstat(FileDescriptor fd)
See fstat(2).
static StructStatVfs fstatvfs(FileDescriptor fd)
static void fsync(FileDescriptor fd)
See fsync(2).
static void ftruncate(FileDescriptor fd, long length)
static String gai_strerror(int error)
static int getegid()
See getegid(2).
static String getenv(String name)
See getenv(3).
static int geteuid()
See geteuid(2).
static int getgid()
See getgid(2).
static SocketAddress getpeername(FileDescriptor fd)
static int getpid()
See getpid(2).
static int getppid()
See getppid(2).
static SocketAddress getsockname(FileDescriptor fd)
static int gettid()
See gettid(2).
static int getuid()
See getuid(2).
static String if_indextoname(int index)
static InetAddress inet_pton(int family, String address)
static boolean isatty(FileDescriptor fd)
See isatty(3).
static void kill(int pid, int signal)
See kill(2).
static void lchown(String path, int uid, int gid)
See lchown(2).
static void link(String oldPath, String newPath)
See link(2).
static void listen(FileDescriptor fd, int backlog)
See listen(2).
static long lseek(FileDescriptor fd, long offset, int whence)
See lseek(2).
static StructStat lstat(String path)
See lstat(2).
static void mincore(long address, long byteCount, byte[] vector)
See mincore(2).
static void mkdir(String path, int mode)
See mkdir(2).
static void mkfifo(String path, int mode)
See mkfifo(3).
static void mlock(long address, long byteCount)
See mlock(2).
static long mmap(long address, long byteCount, int prot, int flags, FileDescriptor fd, long offset)
See mmap(2).
static void msync(long address, long byteCount, int flags)
See msync(2).
static void munlock(long address, long byteCount)
See munlock(2).
static void munmap(long address, long byteCount)
See munmap(2).
static FileDescriptor open(String path, int flags, int mode)
See open(2).
static FileDescriptor[] pipe()
See pipe(2).
static int poll(StructPollfd[] fds, int timeoutMs)
See poll(2).
static void posix_fallocate(FileDescriptor fd, long offset, long length)
static int prctl(int option, long arg2, long arg3, long arg4, long arg5)
See prctl(2).
static int pread(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)
See pread(2).
static int pread(FileDescriptor fd, ByteBuffer buffer, long offset)
See pread(2).
static int pwrite(FileDescriptor fd, ByteBuffer buffer, long offset)
See pwrite(2).
static int pwrite(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)
See pwrite(2).
static int read(FileDescriptor fd, ByteBuffer buffer)
See read(2).
static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)
See read(2).
static String readlink(String path)
static int readv(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)
See readv(2).
static int recvfrom(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetSocketAddress srcAddress)
static int recvfrom(FileDescriptor fd, ByteBuffer buffer, int flags, InetSocketAddress srcAddress)
static void remove(String path)
See remove(3).
static void rename(String oldPath, String newPath)
See rename(2).
static long sendfile(FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount)
static int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port)
See sendto(2).
static int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port)
See sendto(2).
static void setegid(int egid)
See setegid(2).
static void setenv(String name, String value, boolean overwrite)
See setenv(3).
static void seteuid(int euid)
See seteuid(2).
static void setgid(int gid)
See setgid(2).
static int setsid()
See setsid(2).
static void setuid(int uid)
See setuid(2).
static void shutdown(FileDescriptor fd, int how)
static FileDescriptor socket(int domain, int type, int protocol)
See socket(2).
static void socketpair(int domain, int type, int protocol, FileDescriptor fd1, FileDescriptor fd2)
static StructStat stat(String path)
See stat(2).
static StructStatVfs statvfs(String path)
See statvfs(2).
static String strerror(int errno)
static String strsignal(int signal)
static void symlink(String oldPath, String newPath)
See symlink(2).
static long sysconf(int name)
See sysconf(3).
static void tcdrain(FileDescriptor fd)
See tcdrain(3).
static void tcsendbreak(FileDescriptor fd, int duration)
static int umask(int mask)
See umask(2).
static StructUtsname uname()
See uname(2).
static void unsetenv(String name)
static int waitpid(int pid, MutableInt status, int options)
See waitpid(2).
static int write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)
See write(2).
static int write(FileDescriptor fd, ByteBuffer buffer)
See write(2).
static int writev(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)
See writev(2).
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static FileDescriptor accept (FileDescriptor fd, InetSocketAddress peerAddress)

Added in API level 21

public static boolean access (String path, int mode)

Added in API level 21

public static void bind (FileDescriptor fd, InetAddress address, int port)

Added in API level 21

public static void chmod (String path, int mode)

Added in API level 21

See chmod(2).

public static void chown (String path, int uid, int gid)

Added in API level 21

See chown(2).

public static void close (FileDescriptor fd)

Added in API level 21

See close(2).

public static void connect (FileDescriptor fd, InetAddress address, int port)

Added in API level 21

public static FileDescriptor dup (FileDescriptor oldFd)

Added in API level 21

See dup(2).

public static FileDescriptor dup2 (FileDescriptor oldFd, int newFd)

Added in API level 21

See dup2(2).

public static String[] environ ()

Added in API level 21

public static void execv (String filename, String[] argv)

Added in API level 21

See execv(2).

public static void execve (String filename, String[] argv, String[] envp)

Added in API level 21

public static void fchmod (FileDescriptor fd, int mode)

Added in API level 21

public static void fchown (FileDescriptor fd, int uid, int gid)

Added in API level 21

public static void fdatasync (FileDescriptor fd)

Added in API level 21

public static StructStat fstat (FileDescriptor fd)

Added in API level 21

See fstat(2).

public static StructStatVfs fstatvfs (FileDescriptor fd)

Added in API level 21

public static void fsync (FileDescriptor fd)

Added in API level 21

See fsync(2).

public static void ftruncate (FileDescriptor fd, long length)

Added in API level 21

public static String gai_strerror (int error)

Added in API level 21

public static int getegid ()

Added in API level 21

public static String getenv (String name)

Added in API level 21

See getenv(3).

public static int geteuid ()

Added in API level 21

public static int getgid ()

Added in API level 21

See getgid(2).

public static SocketAddress getpeername (FileDescriptor fd)

Added in API level 21

public static int getpid ()

Added in API level 21

See getpid(2).

public static int getppid ()

Added in API level 21

public static SocketAddress getsockname (FileDescriptor fd)

Added in API level 21

public static int gettid ()

Added in API level 21

See gettid(2).

public static int getuid ()

Added in API level 21

See getuid(2).

public static String if_indextoname (int index)

Added in API level 21

public static InetAddress inet_pton (int family, String address)

Added in API level 21

public static boolean isatty (FileDescriptor fd)

Added in API level 21

See isatty(3).

public static void kill (int pid, int signal)

Added in API level 21

See kill(2).

public static void lchown (String path, int uid, int gid)

Added in API level 21

public static void link (String oldPath, String newPath)

Added in API level 21

See link(2).

public static void listen (FileDescriptor fd, int backlog)

Added in API level 21

public static long lseek (FileDescriptor fd, long offset, int whence)

Added in API level 21

See lseek(2).

public static StructStat lstat (String path)

Added in API level 21

See lstat(2).

public static void mincore (long address, long byteCount, byte[] vector)

Added in API level 21

public static void mkdir (String path, int mode)

Added in API level 21

See mkdir(2).

public static void mkfifo (String path, int mode)

Added in API level 21

public static void mlock (long address, long byteCount)

Added in API level 21

See mlock(2).

public static long mmap (long address, long byteCount, int prot, int flags, FileDescriptor fd, long offset)

Added in API level 21

See mmap(2).

public static void msync (long address, long byteCount, int flags)

Added in API level 21

See msync(2).

public static void munlock (long address, long byteCount)

Added in API level 21

public static void munmap (long address, long byteCount)

Added in API level 21

public static FileDescriptor open (String path, int flags, int mode)

Added in API level 21

See open(2).

public static FileDescriptor[] pipe ()

Added in API level 21

See pipe(2).

public static int poll (StructPollfd[] fds, int timeoutMs)

Added in API level 21

See poll(2).

public static void posix_fallocate (FileDescriptor fd, long offset, long length)

Added in API level 21

public static int prctl (int option, long arg2, long arg3, long arg4, long arg5)

Added in API level 21

See prctl(2).

public static int pread (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)

Added in API level 21

public static int pread (FileDescriptor fd, ByteBuffer buffer, long offset)

Added in API level 21

public static int pwrite (FileDescriptor fd, ByteBuffer buffer, long offset)

Added in API level 21

public static int pwrite (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)

Added in API level 21

public static int read (FileDescriptor fd, ByteBuffer buffer)

Added in API level 21

public static int read (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)

Added in API level 21

public static String readlink (String path)

Added in API level 21

public static int readv (FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)

Added in API level 21

public static int recvfrom (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetSocketAddress srcAddress)

Added in API level 21

public static int recvfrom (FileDescriptor fd, ByteBuffer buffer, int flags, InetSocketAddress srcAddress)

Added in API level 21

public static void remove (String path)

Added in API level 21

public static void rename (String oldPath, String newPath)

Added in API level 21

public static long sendfile (FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount)

Added in API level 21

public static int sendto (FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port)

Added in API level 21

public static int sendto (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port)

Added in API level 21

public static void setegid (int egid)

Added in API level 21

public static void setenv (String name, String value, boolean overwrite)

Added in API level 21

public static void seteuid (int euid)

Added in API level 21

public static void setgid (int gid)

Added in API level 21

public static int setsid ()

Added in API level 21

public static void setuid (int uid)

Added in API level 21

public static void shutdown (FileDescriptor fd, int how)

Added in API level 21

public static FileDescriptor socket (int domain, int type, int protocol)

Added in API level 21

public static void socketpair (int domain, int type, int protocol, FileDescriptor fd1, FileDescriptor fd2)

Added in API level 21

public static StructStat stat (String path)

Added in API level 21

See stat(2).

public static StructStatVfs statvfs (String path)

Added in API level 21

public static String strerror (int errno)

Added in API level 21

public static String strsignal (int signal)

Added in API level 21

public static void symlink (String oldPath, String newPath)

Added in API level 21

public static long sysconf (int name)

Added in API level 21

public static void tcdrain (FileDescriptor fd)

Added in API level 21

public static void tcsendbreak (FileDescriptor fd, int duration)

Added in API level 21

public static int umask (int mask)

Added in API level 21

See umask(2).

public static StructUtsname uname ()

Added in API level 21

See uname(2).

public static void unsetenv (String name)

Added in API level 21

public static int waitpid (int pid, MutableInt status, int options)

Added in API level 21

public static int write (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)

Added in API level 21

public static int write (FileDescriptor fd, ByteBuffer buffer)

Added in API level 21

public static int writev (FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)

Added in API level 21