public final class Os extends Object
The corresponding constants can be found in OsConstants
.
Modifier and Type | Method and Description |
---|---|
static FileDescriptor |
accept(FileDescriptor fd,
InetSocketAddress peerAddress)
See accept(2).
|
static FileDescriptor |
accept(FileDescriptor fd,
SocketAddress peerAddress)
TODO Change the public API by removing the overload above and unhiding this version.
|
static boolean |
access(String path,
int mode)
See access(2).
|
static InetAddress[] |
android_getaddrinfo(String node,
StructAddrinfo hints,
int netId) |
static void |
bind(FileDescriptor fd,
InetAddress address,
int port)
See bind(2).
|
static void |
bind(FileDescriptor fd,
SocketAddress address) |
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 void |
connect(FileDescriptor fd,
SocketAddress address) |
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 int |
fcntlFlock(FileDescriptor fd,
int cmd,
StructFlock arg) |
static int |
fcntlInt(FileDescriptor fd,
int cmd,
int arg) |
static int |
fcntlVoid(FileDescriptor fd,
int cmd) |
static void |
fdatasync(FileDescriptor fd)
See fdatasync(2).
|
static StructStat |
fstat(FileDescriptor fd)
See fstat(2).
|
static StructStatVfs |
fstatvfs(FileDescriptor fd)
See fstatvfs(2).
|
static void |
fsync(FileDescriptor fd)
See fsync(2).
|
static void |
ftruncate(FileDescriptor fd,
long length)
See ftruncate(2).
|
static String |
gai_strerror(int error)
See gai_strerror(3).
|
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 String |
getnameinfo(InetAddress address,
int flags) |
static SocketAddress |
getpeername(FileDescriptor fd)
See getpeername(2).
|
static int |
getpgid(int pid) |
static int |
getpid()
See getpid(2).
|
static int |
getppid()
See getppid(2).
|
static StructPasswd |
getpwnam(String name) |
static StructPasswd |
getpwuid(int uid) |
static SocketAddress |
getsockname(FileDescriptor fd)
See getsockname(2).
|
static int |
getsockoptByte(FileDescriptor fd,
int level,
int option) |
static InetAddress |
getsockoptInAddr(FileDescriptor fd,
int level,
int option) |
static int |
getsockoptInt(FileDescriptor fd,
int level,
int option) |
static StructLinger |
getsockoptLinger(FileDescriptor fd,
int level,
int option) |
static StructTimeval |
getsockoptTimeval(FileDescriptor fd,
int level,
int option) |
static StructUcred |
getsockoptUcred(FileDescriptor fd,
int level,
int option) |
static int |
gettid()
See gettid(2).
|
static int |
getuid()
See getuid(2).
|
static int |
getxattr(String path,
String name,
byte[] outValue) |
static String |
if_indextoname(int index)
See if_indextoname(3).
|
static InetAddress |
inet_pton(int family,
String address)
See inet_pton(3).
|
static InetAddress |
ioctlInetAddress(FileDescriptor fd,
int cmd,
String interfaceName) |
static int |
ioctlInt(FileDescriptor fd,
int cmd,
MutableInt arg) |
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 FileDescriptor[] |
pipe2(int flags) |
static int |
poll(StructPollfd[] fds,
int timeoutMs)
See poll(2).
|
static void |
posix_fallocate(FileDescriptor fd,
long offset,
long length)
See posix_fallocate(2).
|
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,
byte[] bytes,
int byteOffset,
int byteCount,
long offset)
See pwrite(2).
|
static int |
pwrite(FileDescriptor fd,
ByteBuffer buffer,
long offset)
See pwrite(2).
|
static int |
read(FileDescriptor fd,
byte[] bytes,
int byteOffset,
int byteCount)
See read(2).
|
static int |
read(FileDescriptor fd,
ByteBuffer buffer)
See read(2).
|
static String |
readlink(String path)
See readlink(2).
|
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)
See recvfrom(2).
|
static int |
recvfrom(FileDescriptor fd,
ByteBuffer buffer,
int flags,
InetSocketAddress srcAddress)
See recvfrom(2).
|
static void |
remove(String path)
See remove(3).
|
static void |
removexattr(String path,
String name) |
static void |
rename(String oldPath,
String newPath)
See rename(2).
|
static long |
sendfile(FileDescriptor outFd,
FileDescriptor inFd,
MutableLong inOffset,
long byteCount)
See sendfile(2).
|
static int |
sendto(FileDescriptor fd,
byte[] bytes,
int byteOffset,
int byteCount,
int flags,
InetAddress inetAddress,
int port)
See sendto(2).
|
static int |
sendto(FileDescriptor fd,
byte[] bytes,
int byteOffset,
int byteCount,
int flags,
SocketAddress address) |
static int |
sendto(FileDescriptor fd,
ByteBuffer buffer,
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 void |
setpgid(int pid,
int pgid) |
static void |
setregid(int rgid,
int egid) |
static void |
setreuid(int ruid,
int euid) |
static int |
setsid()
See setsid(2).
|
static void |
setsockoptByte(FileDescriptor fd,
int level,
int option,
int value) |
static void |
setsockoptGroupReq(FileDescriptor fd,
int level,
int option,
StructGroupReq value) |
static void |
setsockoptGroupSourceReq(FileDescriptor fd,
int level,
int option,
StructGroupSourceReq value) |
static void |
setsockoptIfreq(FileDescriptor fd,
int level,
int option,
String value) |
static void |
setsockoptInt(FileDescriptor fd,
int level,
int option,
int value) |
static void |
setsockoptIpMreqn(FileDescriptor fd,
int level,
int option,
int value) |
static void |
setsockoptLinger(FileDescriptor fd,
int level,
int option,
StructLinger value) |
static void |
setsockoptTimeval(FileDescriptor fd,
int level,
int option,
StructTimeval value) |
static void |
setuid(int uid)
See setuid(2).
|
static void |
setxattr(String path,
String name,
byte[] value,
int flags) |
static void |
shutdown(FileDescriptor fd,
int how)
See shutdown(2).
|
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)
See socketpair(2).
|
static StructStat |
stat(String path)
See stat(2).
|
static StructStatVfs |
statvfs(String path)
See statvfs(2).
|
static String |
strerror(int errno)
See strerror(2).
|
static String |
strsignal(int signal)
See strsignal(3).
|
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)
See tcsendbreak(3).
|
static int |
umask(int mask)
See umask(2).
|
static StructUtsname |
uname()
See uname(2).
|
static void |
unlink(String pathname) |
static void |
unsetenv(String name)
See unsetenv(3).
|
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).
|
public static FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress) throws ErrnoException, SocketException
ErrnoException
SocketException
public static FileDescriptor accept(FileDescriptor fd, SocketAddress peerAddress) throws ErrnoException, SocketException
ErrnoException
SocketException
public static boolean access(String path, int mode) throws ErrnoException
ErrnoException
public static InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException
GaiException
public static void bind(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException
ErrnoException
SocketException
public static void bind(FileDescriptor fd, SocketAddress address) throws ErrnoException, SocketException
ErrnoException
SocketException
public static void chmod(String path, int mode) throws ErrnoException
ErrnoException
public static void chown(String path, int uid, int gid) throws ErrnoException
ErrnoException
public static void close(FileDescriptor fd) throws ErrnoException
ErrnoException
public static void connect(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException
ErrnoException
SocketException
public static void connect(FileDescriptor fd, SocketAddress address) throws ErrnoException, SocketException
ErrnoException
SocketException
public static FileDescriptor dup(FileDescriptor oldFd) throws ErrnoException
ErrnoException
public static FileDescriptor dup2(FileDescriptor oldFd, int newFd) throws ErrnoException
ErrnoException
public static String[] environ()
public static void execv(String filename, String[] argv) throws ErrnoException
ErrnoException
public static void execve(String filename, String[] argv, String[] envp) throws ErrnoException
ErrnoException
public static void fchmod(FileDescriptor fd, int mode) throws ErrnoException
ErrnoException
public static void fchown(FileDescriptor fd, int uid, int gid) throws ErrnoException
ErrnoException
public static int fcntlFlock(FileDescriptor fd, int cmd, StructFlock arg) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int fcntlInt(FileDescriptor fd, int cmd, int arg) throws ErrnoException
ErrnoException
public static int fcntlVoid(FileDescriptor fd, int cmd) throws ErrnoException
ErrnoException
public static void fdatasync(FileDescriptor fd) throws ErrnoException
ErrnoException
public static StructStat fstat(FileDescriptor fd) throws ErrnoException
ErrnoException
public static StructStatVfs fstatvfs(FileDescriptor fd) throws ErrnoException
ErrnoException
public static void fsync(FileDescriptor fd) throws ErrnoException
ErrnoException
public static void ftruncate(FileDescriptor fd, long length) throws ErrnoException
ErrnoException
public static String gai_strerror(int error)
public static int getegid()
public static int geteuid()
public static int getgid()
public static String getnameinfo(InetAddress address, int flags) throws GaiException
GaiException
public static SocketAddress getpeername(FileDescriptor fd) throws ErrnoException
ErrnoException
public static int getpgid(int pid) throws ErrnoException
ErrnoException
public static int getpid()
public static int getppid()
public static StructPasswd getpwnam(String name) throws ErrnoException
ErrnoException
public static StructPasswd getpwuid(int uid) throws ErrnoException
ErrnoException
public static SocketAddress getsockname(FileDescriptor fd) throws ErrnoException
ErrnoException
public static int getsockoptByte(FileDescriptor fd, int level, int option) throws ErrnoException
ErrnoException
public static InetAddress getsockoptInAddr(FileDescriptor fd, int level, int option) throws ErrnoException
ErrnoException
public static int getsockoptInt(FileDescriptor fd, int level, int option) throws ErrnoException
ErrnoException
public static StructLinger getsockoptLinger(FileDescriptor fd, int level, int option) throws ErrnoException
ErrnoException
public static StructTimeval getsockoptTimeval(FileDescriptor fd, int level, int option) throws ErrnoException
ErrnoException
public static StructUcred getsockoptUcred(FileDescriptor fd, int level, int option) throws ErrnoException
ErrnoException
public static int gettid()
public static int getuid()
public static int getxattr(String path, String name, byte[] outValue) throws ErrnoException
ErrnoException
public static String if_indextoname(int index)
public static InetAddress inet_pton(int family, String address)
public static InetAddress ioctlInetAddress(FileDescriptor fd, int cmd, String interfaceName) throws ErrnoException
ErrnoException
public static int ioctlInt(FileDescriptor fd, int cmd, MutableInt arg) throws ErrnoException
ErrnoException
public static boolean isatty(FileDescriptor fd)
public static void kill(int pid, int signal) throws ErrnoException
ErrnoException
public static void lchown(String path, int uid, int gid) throws ErrnoException
ErrnoException
public static void link(String oldPath, String newPath) throws ErrnoException
ErrnoException
public static void listen(FileDescriptor fd, int backlog) throws ErrnoException
ErrnoException
public static long lseek(FileDescriptor fd, long offset, int whence) throws ErrnoException
ErrnoException
public static StructStat lstat(String path) throws ErrnoException
ErrnoException
public static void mincore(long address, long byteCount, byte[] vector) throws ErrnoException
ErrnoException
public static void mkdir(String path, int mode) throws ErrnoException
ErrnoException
public static void mkfifo(String path, int mode) throws ErrnoException
ErrnoException
public static void mlock(long address, long byteCount) throws ErrnoException
ErrnoException
public static long mmap(long address, long byteCount, int prot, int flags, FileDescriptor fd, long offset) throws ErrnoException
ErrnoException
public static void msync(long address, long byteCount, int flags) throws ErrnoException
ErrnoException
public static void munlock(long address, long byteCount) throws ErrnoException
ErrnoException
public static void munmap(long address, long byteCount) throws ErrnoException
ErrnoException
public static FileDescriptor open(String path, int flags, int mode) throws ErrnoException
ErrnoException
public static FileDescriptor[] pipe() throws ErrnoException
ErrnoException
public static FileDescriptor[] pipe2(int flags) throws ErrnoException
ErrnoException
public static int poll(StructPollfd[] fds, int timeoutMs) throws ErrnoException
Note that in Lollipop this could throw an ErrnoException
with EINTR
.
In later releases, the implementation will automatically just restart the system call with
an appropriately reduced timeout.
ErrnoException
public static void posix_fallocate(FileDescriptor fd, long offset, long length) throws ErrnoException
ErrnoException
public static int prctl(int option, long arg2, long arg3, long arg4, long arg5) throws ErrnoException
ErrnoException
public static int pread(FileDescriptor fd, ByteBuffer buffer, long offset) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int pread(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int pwrite(FileDescriptor fd, ByteBuffer buffer, long offset) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int pwrite(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int read(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static String readlink(String path) throws ErrnoException
ErrnoException
public static int readv(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int recvfrom(FileDescriptor fd, ByteBuffer buffer, int flags, InetSocketAddress srcAddress) throws ErrnoException, SocketException
ErrnoException
SocketException
public static int recvfrom(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetSocketAddress srcAddress) throws ErrnoException, SocketException
ErrnoException
SocketException
public static void remove(String path) throws ErrnoException
ErrnoException
public static void removexattr(String path, String name) throws ErrnoException
ErrnoException
public static void rename(String oldPath, String newPath) throws ErrnoException
ErrnoException
public static long sendfile(FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount) throws ErrnoException
ErrnoException
public static int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException
ErrnoException
SocketException
public static int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException
ErrnoException
SocketException
public static int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, SocketAddress address) throws ErrnoException, SocketException
ErrnoException
SocketException
public static void setegid(int egid) throws ErrnoException
ErrnoException
public static void setenv(String name, String value, boolean overwrite) throws ErrnoException
ErrnoException
public static void seteuid(int euid) throws ErrnoException
ErrnoException
public static void setgid(int gid) throws ErrnoException
ErrnoException
public static void setpgid(int pid, int pgid) throws ErrnoException
ErrnoException
public static void setregid(int rgid, int egid) throws ErrnoException
ErrnoException
public static void setreuid(int ruid, int euid) throws ErrnoException
ErrnoException
public static int setsid() throws ErrnoException
ErrnoException
public static void setsockoptByte(FileDescriptor fd, int level, int option, int value) throws ErrnoException
ErrnoException
public static void setsockoptIfreq(FileDescriptor fd, int level, int option, String value) throws ErrnoException
ErrnoException
public static void setsockoptInt(FileDescriptor fd, int level, int option, int value) throws ErrnoException
ErrnoException
public static void setsockoptIpMreqn(FileDescriptor fd, int level, int option, int value) throws ErrnoException
ErrnoException
public static void setsockoptGroupReq(FileDescriptor fd, int level, int option, StructGroupReq value) throws ErrnoException
ErrnoException
public static void setsockoptGroupSourceReq(FileDescriptor fd, int level, int option, StructGroupSourceReq value) throws ErrnoException
ErrnoException
public static void setsockoptLinger(FileDescriptor fd, int level, int option, StructLinger value) throws ErrnoException
ErrnoException
public static void setsockoptTimeval(FileDescriptor fd, int level, int option, StructTimeval value) throws ErrnoException
ErrnoException
public static void setuid(int uid) throws ErrnoException
ErrnoException
public static void setxattr(String path, String name, byte[] value, int flags) throws ErrnoException
ErrnoException
public static void shutdown(FileDescriptor fd, int how) throws ErrnoException
ErrnoException
public static FileDescriptor socket(int domain, int type, int protocol) throws ErrnoException
ErrnoException
public static void socketpair(int domain, int type, int protocol, FileDescriptor fd1, FileDescriptor fd2) throws ErrnoException
ErrnoException
public static StructStat stat(String path) throws ErrnoException
ErrnoException
public static StructStatVfs statvfs(String path) throws ErrnoException
ErrnoException
public static String strerror(int errno)
public static String strsignal(int signal)
public static void symlink(String oldPath, String newPath) throws ErrnoException
ErrnoException
public static long sysconf(int name)
public static void tcdrain(FileDescriptor fd) throws ErrnoException
ErrnoException
public static void tcsendbreak(FileDescriptor fd, int duration) throws ErrnoException
ErrnoException
public static int umask(int mask)
public static StructUtsname uname()
public static void unlink(String pathname) throws ErrnoException
ErrnoException
public static void unsetenv(String name) throws ErrnoException
ErrnoException
public static int waitpid(int pid, MutableInt status, int options) throws ErrnoException
ErrnoException
public static int write(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException
public static int writev(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts) throws ErrnoException, InterruptedIOException
ErrnoException
InterruptedIOException