Os
public
final
class
Os
extends Object
java.lang.Object | |
↳ | android.system.Os |
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
|
bind(FileDescriptor fd, SocketAddress address)
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
void
|
connect(FileDescriptor fd, SocketAddress address)
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 exec(3). |
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
|
fcntlInt(FileDescriptor fd, int cmd, int arg)
See fcntl(2). |
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
SocketAddress
|
getpeername(FileDescriptor fd)
See getpeername(2). |
static
int
|
getpid()
See getpid(2). |
static
int
|
getppid()
See getppid(2). |
static
SocketAddress
|
getsockname(FileDescriptor fd)
See getsockname(2). |
static
StructTimeval
|
getsockoptTimeval(FileDescriptor fd, int level, int option)
See getsockopt(2). |
static
int
|
gettid()
See gettid(2). |
static
int
|
getuid()
See getuid(2). |
static
byte[]
|
getxattr(String path, String name)
See getxattr(2) |
static
String
|
if_indextoname(int index)
See if_indextoname(3). |
static
int
|
if_nametoindex(String name)
See if_nametoindex(3). |
static
InetAddress
|
inet_pton(int family, String address)
See inet_pton(3). |
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
String[]
|
listxattr(String path)
See listxattr(2) |
static
long
|
lseek(FileDescriptor fd, long offset, int whence)
See lseek(2). |
static
StructStat
|
lstat(String path)
See lstat(2). |
static
FileDescriptor
|
memfd_create(String name, int flags)
See memfd_create(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)
See posix_fallocate(3). |
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
int
|
recvmsg(FileDescriptor fd, StructMsghdr msg, int flags)
See recvmsg(2). |
static
void
|
remove(String path)
See remove(3). |
static
void
|
removexattr(String path, String name)
See removexattr(2). |
static
void
|
rename(String oldPath, String newPath)
See rename(2). |
static
long
|
sendfile(FileDescriptor outFd, FileDescriptor inFd, Int64Ref offset, long byteCount)
See sendfile(2). |
static
int
|
sendmsg(FileDescriptor fd, StructMsghdr msg, int flags)
See sendmsg(2). |
static
int
|
sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, SocketAddress address)
See sendto(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, ByteBuffer buffer, int flags, InetAddress inetAddress, int port)
See sendto(2). |
static
void
|
setegid(int egid)
This method was deprecated in API level 29. Android Applications do not have sufficient privileges to call this method. |
static
void
|
setenv(String name, String value, boolean overwrite)
See setenv(3). |
static
void
|
seteuid(int euid)
This method was deprecated in API level 29. Android Applications do not have sufficient privileges to call this method. |
static
void
|
setgid(int gid)
This method was deprecated in API level 29. Android Applications do not have sufficient privileges to call this method. |
static
int
|
setsid()
See setsid(2). |
static
void
|
setsockoptInt(FileDescriptor fd, int level, int option, int value)
See setsockopt(2). |
static
void
|
setsockoptTimeval(FileDescriptor fd, int level, int option, StructTimeval value)
See setsockopt(2). |
static
void
|
setuid(int uid)
This method was deprecated in API level 29. Android Applications do not have sufficient privileges to call this method. |
static
void
|
setxattr(String path, String name, byte[] value, int flags)
See setxattr(2) |
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
|
unsetenv(String name)
See unsetenv(3). |
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). |
Inherited methods | |
---|---|
Public methods
accept
public static FileDescriptor accept (FileDescriptor fd, InetSocketAddress peerAddress)
See accept(2).
Parameters | |
---|---|
fd |
FileDescriptor |
peerAddress |
InetSocketAddress |
Returns | |
---|---|
FileDescriptor |
Throws | |
---|---|
ErrnoException |
|
SocketException |
access
public static boolean access (String path, int mode)
See access(2).
Parameters | |
---|---|
path |
String |
mode |
int |
Returns | |
---|---|
boolean |
Throws | |
---|---|
ErrnoException |
bind
public static void bind (FileDescriptor fd, InetAddress address, int port)
See bind(2).
Parameters | |
---|---|
fd |
FileDescriptor |
address |
InetAddress |
port |
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
bind
public static void bind (FileDescriptor fd, SocketAddress address)
See bind(2).
Parameters | |
---|---|
fd |
FileDescriptor : This value cannot be null . |
address |
SocketAddress : This value cannot be null . |
Throws | |
---|---|
ErrnoException |
|
SocketException |
chmod
public static void chmod (String path, int mode)
See chmod(2).
Parameters | |
---|---|
path |
String |
mode |
int |
Throws | |
---|---|
ErrnoException |
chown
public static void chown (String path, int uid, int gid)
See chown(2).
Parameters | |
---|---|
path |
String |
uid |
int |
gid |
int |
Throws | |
---|---|
ErrnoException |
close
public static void close (FileDescriptor fd)
See close(2).
Parameters | |
---|---|
fd |
FileDescriptor |
Throws | |
---|---|
ErrnoException |
connect
public static void connect (FileDescriptor fd, InetAddress address, int port)
See connect(2).
Parameters | |
---|---|
fd |
FileDescriptor |
address |
InetAddress |
port |
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
connect
public static void connect (FileDescriptor fd, SocketAddress address)
See connect(2).
Parameters | |
---|---|
fd |
FileDescriptor : This value cannot be null . |
address |
SocketAddress : This value cannot be null . |
Throws | |
---|---|
ErrnoException |
|
SocketException |
dup
public static FileDescriptor dup (FileDescriptor oldFd)
See dup(2).
Parameters | |
---|---|
oldFd |
FileDescriptor |
Returns | |
---|---|
FileDescriptor |
Throws | |
---|---|
ErrnoException |
dup2
public static FileDescriptor dup2 (FileDescriptor oldFd, int newFd)
See dup2(2).
Parameters | |
---|---|
oldFd |
FileDescriptor |
newFd |
int |
Returns | |
---|---|
FileDescriptor |
Throws | |
---|---|
ErrnoException |
execv
public static void execv (String filename, String[] argv)
See exec(3).
Parameters | |
---|---|
filename |
String |
argv |
String |
Throws | |
---|---|
ErrnoException |
execve
public static void execve (String filename, String[] argv, String[] envp)
See execve(2).
Parameters | |
---|---|
filename |
String |
argv |
String |
envp |
String |
Throws | |
---|---|
ErrnoException |
fchmod
public static void fchmod (FileDescriptor fd, int mode)
See fchmod(2).
Parameters | |
---|---|
fd |
FileDescriptor |
mode |
int |
Throws | |
---|---|
ErrnoException |
fchown
public static void fchown (FileDescriptor fd, int uid, int gid)
See fchown(2).
Parameters | |
---|---|
fd |
FileDescriptor |
uid |
int |
gid |
int |
Throws | |
---|---|
ErrnoException |
fcntlInt
public static int fcntlInt (FileDescriptor fd, int cmd, int arg)
See fcntl(2).
Parameters | |
---|---|
fd |
FileDescriptor : This value cannot be null . |
cmd |
int |
arg |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
fdatasync
public static void fdatasync (FileDescriptor fd)
See fdatasync(2).
Parameters | |
---|---|
fd |
FileDescriptor |
Throws | |
---|---|
ErrnoException |
fstat
public static StructStat fstat (FileDescriptor fd)
See fstat(2).
Parameters | |
---|---|
fd |
FileDescriptor |
Returns | |
---|---|
StructStat |
Throws | |
---|---|
ErrnoException |
fstatvfs
public static StructStatVfs fstatvfs (FileDescriptor fd)
See fstatvfs(2).
Parameters | |
---|---|
fd |
FileDescriptor |
Returns | |
---|---|
StructStatVfs |
Throws | |
---|---|
ErrnoException |
fsync
public static void fsync (FileDescriptor fd)
See fsync(2).
Parameters | |
---|---|
fd |
FileDescriptor |
Throws | |
---|---|
ErrnoException |
ftruncate
public static void ftruncate (FileDescriptor fd, long length)
See ftruncate(2).
Parameters | |
---|---|
fd |
FileDescriptor |
length |
long |
Throws | |
---|---|
ErrnoException |
gai_strerror
public static String gai_strerror (int error)
See gai_strerror(3).
Parameters | |
---|---|
error |
int |
Returns | |
---|---|
String |
getenv
public static String getenv (String name)
See getenv(3).
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
String |
getpeername
public static SocketAddress getpeername (FileDescriptor fd)
See getpeername(2).
Parameters | |
---|---|
fd |
FileDescriptor |
Returns | |
---|---|
SocketAddress |
Throws | |
---|---|
ErrnoException |
getsockname
public static SocketAddress getsockname (FileDescriptor fd)
See getsockname(2).
Parameters | |
---|---|
fd |
FileDescriptor |
Returns | |
---|---|
SocketAddress |
Throws | |
---|---|
ErrnoException |
getsockoptTimeval
public static StructTimeval getsockoptTimeval (FileDescriptor fd, int level, int option)
See getsockopt(2).
Only for use with option
values that return a struct timeval
such as
OsConstants.SO_RCVTIMEO
and OsConstants.SO_SNDTIMEO
. Use with other
options may throw an IllegalArgumentException
or return junk values.
Parameters | |
---|---|
fd |
FileDescriptor : This value cannot be null . |
level |
int |
option |
int |
Returns | |
---|---|
StructTimeval |
This value cannot be null . |
Throws | |
---|---|
ErrnoException |
getxattr
public static byte[] getxattr (String path, String name)
See getxattr(2)
Parameters | |
---|---|
path |
String |
name |
String |
Returns | |
---|---|
byte[] |
Throws | |
---|---|
ErrnoException |
if_indextoname
public static String if_indextoname (int index)
See if_indextoname(3).
Parameters | |
---|---|
index |
int |
Returns | |
---|---|
String |
if_nametoindex
public static int if_nametoindex (String name)
See if_nametoindex(3).
Parameters | |
---|---|
name |
String |
Returns | |
---|---|
int |
inet_pton
public static InetAddress inet_pton (int family, String address)
See inet_pton(3).
Parameters | |
---|---|
family |
int |
address |
String |
Returns | |
---|---|
InetAddress |
isatty
public static boolean isatty (FileDescriptor fd)
See isatty(3).
Parameters | |
---|---|
fd |
FileDescriptor |
Returns | |
---|---|
boolean |
kill
public static void kill (int pid, int signal)
See kill(2).
Parameters | |
---|---|
pid |
int |
signal |
int |
Throws | |
---|---|
ErrnoException |
lchown
public static void lchown (String path, int uid, int gid)
See lchown(2).
Parameters | |
---|---|
path |
String |
uid |
int |
gid |
int |
Throws | |
---|---|
ErrnoException |
link
public static void link (String oldPath, String newPath)
See link(2).
Parameters | |
---|---|
oldPath |
String |
newPath |
String |
Throws | |
---|---|
ErrnoException |
listen
public static void listen (FileDescriptor fd, int backlog)
See listen(2).
Parameters | |
---|---|
fd |
FileDescriptor |
backlog |
int |
Throws | |
---|---|
ErrnoException |
listxattr
public static String[] listxattr (String path)
See listxattr(2)
Parameters | |
---|---|
path |
String |
Returns | |
---|---|
String[] |
Throws | |
---|---|
ErrnoException |
lseek
public static long lseek (FileDescriptor fd, long offset, int whence)
See lseek(2).
Parameters | |
---|---|
fd |
FileDescriptor |
offset |
long |
whence |
int |
Returns | |
---|---|
long |
Throws | |
---|---|
ErrnoException |
lstat
public static StructStat lstat (String path)
See lstat(2).
Parameters | |
---|---|
path |
String |
Returns | |
---|---|
StructStat |
Throws | |
---|---|
ErrnoException |
memfd_create
public static FileDescriptor memfd_create (String name, int flags)
See memfd_create(2).
Parameters | |
---|---|
name |
String : This value cannot be null . |
flags |
int |
Returns | |
---|---|
FileDescriptor |
This value cannot be null . |
Throws | |
---|---|
ErrnoException |
mincore
public static void mincore (long address, long byteCount, byte[] vector)
See mincore(2).
Parameters | |
---|---|
address |
long |
byteCount |
long |
vector |
byte |
Throws | |
---|---|
ErrnoException |
mkdir
public static void mkdir (String path, int mode)
See mkdir(2).
Parameters | |
---|---|
path |
String |
mode |
int |
Throws | |
---|---|
ErrnoException |
mkfifo
public static void mkfifo (String path, int mode)
See mkfifo(3).
Parameters | |
---|---|
path |
String |
mode |
int |
Throws | |
---|---|
ErrnoException |
mlock
public static void mlock (long address, long byteCount)
See mlock(2).
Parameters | |
---|---|
address |
long |
byteCount |
long |
Throws | |
---|---|
ErrnoException |
mmap
public static long mmap (long address, long byteCount, int prot, int flags, FileDescriptor fd, long offset)
See mmap(2).
Parameters | |
---|---|
address |
long |
byteCount |
long |
prot |
int |
flags |
int |
fd |
FileDescriptor |
offset |
long |
Returns | |
---|---|
long |
Throws | |
---|---|
ErrnoException |
msync
public static void msync (long address, long byteCount, int flags)
See msync(2).
Parameters | |
---|---|
address |
long |
byteCount |
long |
flags |
int |
Throws | |
---|---|
ErrnoException |
munlock
public static void munlock (long address, long byteCount)
See munlock(2).
Parameters | |
---|---|
address |
long |
byteCount |
long |
Throws | |
---|---|
ErrnoException |
munmap
public static void munmap (long address, long byteCount)
See munmap(2).
Parameters | |
---|---|
address |
long |
byteCount |
long |
Throws | |
---|---|
ErrnoException |
open
public static FileDescriptor open (String path, int flags, int mode)
See open(2).
Parameters | |
---|---|
path |
String |
flags |
int |
mode |
int |
Returns | |
---|---|
FileDescriptor |
Throws | |
---|---|
ErrnoException |
pipe
public static FileDescriptor[] pipe ()
See pipe(2).
Returns | |
---|---|
FileDescriptor[] |
Throws | |
---|---|
ErrnoException |
poll
public static int poll (StructPollfd[] fds, int timeoutMs)
See poll(2).
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.
Parameters | |
---|---|
fds |
StructPollfd |
timeoutMs |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
posix_fallocate
public static void posix_fallocate (FileDescriptor fd, long offset, long length)
See posix_fallocate(3).
Parameters | |
---|---|
fd |
FileDescriptor |
offset |
long |
length |
long |
Throws | |
---|---|
ErrnoException |
prctl
public static int prctl (int option, long arg2, long arg3, long arg4, long arg5)
See prctl(2).
Parameters | |
---|---|
option |
int |
arg2 |
long |
arg3 |
long |
arg4 |
long |
arg5 |
long |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
pread
public static int pread (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)
See pread(2).
Parameters | |
---|---|
fd |
FileDescriptor |
bytes |
byte |
byteOffset |
int |
byteCount |
int |
offset |
long |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
pread
public static int pread (FileDescriptor fd, ByteBuffer buffer, long offset)
See pread(2).
Parameters | |
---|---|
fd |
FileDescriptor |
buffer |
ByteBuffer |
offset |
long |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
pwrite
public static int pwrite (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset)
See pwrite(2).
Parameters | |
---|---|
fd |
FileDescriptor |
bytes |
byte |
byteOffset |
int |
byteCount |
int |
offset |
long |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
pwrite
public static int pwrite (FileDescriptor fd, ByteBuffer buffer, long offset)
See pwrite(2).
Parameters | |
---|---|
fd |
FileDescriptor |
buffer |
ByteBuffer |
offset |
long |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
read
public static int read (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)
See read(2).
Parameters | |
---|---|
fd |
FileDescriptor |
bytes |
byte |
byteOffset |
int |
byteCount |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
read
public static int read (FileDescriptor fd, ByteBuffer buffer)
See read(2).
Parameters | |
---|---|
fd |
FileDescriptor |
buffer |
ByteBuffer |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
readlink
public static String readlink (String path)
See readlink(2).
Parameters | |
---|---|
path |
String |
Returns | |
---|---|
String |
Throws | |
---|---|
ErrnoException |
readv
public static int readv (FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)
See readv(2).
Parameters | |
---|---|
fd |
FileDescriptor |
buffers |
Object |
offsets |
int |
byteCounts |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
recvfrom
public static int recvfrom (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetSocketAddress srcAddress)
See recvfrom(2).
Parameters | |
---|---|
fd |
FileDescriptor |
bytes |
byte |
byteOffset |
int |
byteCount |
int |
flags |
int |
srcAddress |
InetSocketAddress |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
recvfrom
public static int recvfrom (FileDescriptor fd, ByteBuffer buffer, int flags, InetSocketAddress srcAddress)
See recvfrom(2).
Parameters | |
---|---|
fd |
FileDescriptor |
buffer |
ByteBuffer |
flags |
int |
srcAddress |
InetSocketAddress |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
recvmsg
public static int recvmsg (FileDescriptor fd, StructMsghdr msg, int flags)
See recvmsg(2).
Parameters | |
---|---|
fd |
FileDescriptor : This value cannot be null . |
msg |
StructMsghdr : This value cannot be null . |
flags |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
remove
public static void remove (String path)
See remove(3).
Parameters | |
---|---|
path |
String |
Throws | |
---|---|
ErrnoException |
removexattr
public static void removexattr (String path, String name)
See removexattr(2).
Parameters | |
---|---|
path |
String |
name |
String |
Throws | |
---|---|
ErrnoException |
rename
public static void rename (String oldPath, String newPath)
See rename(2).
Parameters | |
---|---|
oldPath |
String |
newPath |
String |
Throws | |
---|---|
ErrnoException |
sendfile
public static long sendfile (FileDescriptor outFd, FileDescriptor inFd, Int64Ref offset, long byteCount)
See sendfile(2).
Parameters | |
---|---|
outFd |
FileDescriptor |
inFd |
FileDescriptor |
offset |
Int64Ref |
byteCount |
long |
Returns | |
---|---|
long |
Throws | |
---|---|
ErrnoException |
sendmsg
public static int sendmsg (FileDescriptor fd, StructMsghdr msg, int flags)
See sendmsg(2).
Parameters | |
---|---|
fd |
FileDescriptor : This value cannot be null . |
msg |
StructMsghdr : This value cannot be null . |
flags |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
sendto
public static int sendto (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, SocketAddress address)
See sendto(2).
Parameters | |
---|---|
fd |
FileDescriptor : This value cannot be null . |
bytes |
byte : This value cannot be null . |
byteOffset |
int |
byteCount |
int |
flags |
int |
address |
SocketAddress : This value may be null . |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
sendto
public static int sendto (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port)
See sendto(2).
Parameters | |
---|---|
fd |
FileDescriptor |
bytes |
byte |
byteOffset |
int |
byteCount |
int |
flags |
int |
inetAddress |
InetAddress |
port |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
sendto
public static int sendto (FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port)
See sendto(2).
Parameters | |
---|---|
fd |
FileDescriptor |
buffer |
ByteBuffer |
flags |
int |
inetAddress |
InetAddress |
port |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
SocketException |
setegid
public static void setegid (int egid)
This method was deprecated
in API level 29.
Android Applications do not have sufficient privileges to call this method.
See setegid(2).
Parameters | |
---|---|
egid |
int |
Throws | |
---|---|
ErrnoException |
setenv
public static void setenv (String name, String value, boolean overwrite)
See setenv(3).
Parameters | |
---|---|
name |
String |
value |
String |
overwrite |
boolean |
Throws | |
---|---|
ErrnoException |
seteuid
public static void seteuid (int euid)
This method was deprecated
in API level 29.
Android Applications do not have sufficient privileges to call this method.
See seteuid(2).
Parameters | |
---|---|
euid |
int |
Throws | |
---|---|
ErrnoException |
setgid
public static void setgid (int gid)
This method was deprecated
in API level 29.
Android Applications do not have sufficient privileges to call this method.
See setgid(2).
Parameters | |
---|---|
gid |
int |
Throws | |
---|---|
ErrnoException |
setsid
public static int setsid ()
See setsid(2).
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
setsockoptInt
public static void setsockoptInt (FileDescriptor fd, int level, int option, int value)
See setsockopt(2).
Parameters | |
---|---|
fd |
FileDescriptor |
level |
int |
option |
int |
value |
int |
Throws | |
---|---|
ErrnoException |
setsockoptTimeval
public static void setsockoptTimeval (FileDescriptor fd, int level, int option, StructTimeval value)
See setsockopt(2).
Only for use with option
values that take a struct timeval
such as
OsConstants.SO_RCVTIMEO
and OsConstants.SO_SNDTIMEO
. Use with other
options is likely to cause incorrect behavior.
Parameters | |
---|---|
fd |
FileDescriptor : This value cannot be null . |
level |
int |
option |
int |
value |
StructTimeval : This value cannot be null . |
Throws | |
---|---|
ErrnoException |
setuid
public static void setuid (int uid)
This method was deprecated
in API level 29.
Android Applications do not have sufficient privileges to call this method.
See setuid(2).
Parameters | |
---|---|
uid |
int |
Throws | |
---|---|
ErrnoException |
setxattr
public static void setxattr (String path, String name, byte[] value, int flags)
See setxattr(2)
Parameters | |
---|---|
path |
String |
name |
String |
value |
byte |
flags |
int |
Throws | |
---|---|
ErrnoException |
shutdown
public static void shutdown (FileDescriptor fd, int how)
See shutdown(2).
Parameters | |
---|---|
fd |
FileDescriptor |
how |
int |
Throws | |
---|---|
ErrnoException |
socket
public static FileDescriptor socket (int domain, int type, int protocol)
See socket(2).
Parameters | |
---|---|
domain |
int |
type |
int |
protocol |
int |
Returns | |
---|---|
FileDescriptor |
Throws | |
---|---|
ErrnoException |
socketpair
public static void socketpair (int domain, int type, int protocol, FileDescriptor fd1, FileDescriptor fd2)
See socketpair(2).
Parameters | |
---|---|
domain |
int |
type |
int |
protocol |
int |
fd1 |
FileDescriptor |
fd2 |
FileDescriptor |
Throws | |
---|---|
ErrnoException |
stat
public static StructStat stat (String path)
See stat(2).
Parameters | |
---|---|
path |
String |
Returns | |
---|---|
StructStat |
Throws | |
---|---|
ErrnoException |
statvfs
public static StructStatVfs statvfs (String path)
See statvfs(2).
Parameters | |
---|---|
path |
String |
Returns | |
---|---|
StructStatVfs |
Throws | |
---|---|
ErrnoException |
strerror
public static String strerror (int errno)
See strerror(2).
Parameters | |
---|---|
errno |
int |
Returns | |
---|---|
String |
strsignal
public static String strsignal (int signal)
See strsignal(3).
Parameters | |
---|---|
signal |
int |
Returns | |
---|---|
String |
symlink
public static void symlink (String oldPath, String newPath)
See symlink(2).
Parameters | |
---|---|
oldPath |
String |
newPath |
String |
Throws | |
---|---|
ErrnoException |
sysconf
public static long sysconf (int name)
See sysconf(3).
Parameters | |
---|---|
name |
int |
Returns | |
---|---|
long |
tcdrain
public static void tcdrain (FileDescriptor fd)
See tcdrain(3).
Parameters | |
---|---|
fd |
FileDescriptor |
Throws | |
---|---|
ErrnoException |
tcsendbreak
public static void tcsendbreak (FileDescriptor fd, int duration)
See tcsendbreak(3).
Parameters | |
---|---|
fd |
FileDescriptor |
duration |
int |
Throws | |
---|---|
ErrnoException |
umask
public static int umask (int mask)
See umask(2).
Parameters | |
---|---|
mask |
int |
Returns | |
---|---|
int |
uname
public static StructUtsname uname ()
See uname(2).
Returns | |
---|---|
StructUtsname |
unsetenv
public static void unsetenv (String name)
See unsetenv(3).
Parameters | |
---|---|
name |
String |
Throws | |
---|---|
ErrnoException |
write
public static int write (FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount)
See write(2).
Parameters | |
---|---|
fd |
FileDescriptor |
bytes |
byte |
byteOffset |
int |
byteCount |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
write
public static int write (FileDescriptor fd, ByteBuffer buffer)
See write(2).
Parameters | |
---|---|
fd |
FileDescriptor |
buffer |
ByteBuffer |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |
writev
public static int writev (FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts)
See writev(2).
Parameters | |
---|---|
fd |
FileDescriptor |
buffers |
Object |
offsets |
int |
byteCounts |
int |
Returns | |
---|---|
int |
Throws | |
---|---|
ErrnoException |
|
InterruptedIOException |