15d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes/* 25d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * Copyright (C) 2011 The Android Open Source Project 35d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * 45d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 55d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * you may not use this file except in compliance with the License. 65d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * You may obtain a copy of the License at 75d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * 85d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 95d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * 105d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * Unless required by applicable law or agreed to in writing, software 115d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 125d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 135d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * See the License for the specific language governing permissions and 145d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * limitations under the License. 155d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes */ 165d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes 175d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughespackage android.system; 185d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes 195d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport android.util.MutableInt; 205d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport android.util.MutableLong; 215d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport java.io.FileDescriptor; 225d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport java.io.InterruptedIOException; 235d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport java.net.InetAddress; 245d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport java.net.InetSocketAddress; 255d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport java.net.SocketAddress; 265d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport java.net.SocketException; 275d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport java.nio.ByteBuffer; 285d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughesimport libcore.io.Libcore; 295d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes 305d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes/** 3134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * Access to low-level system functionality. Most of these are system calls. Most users will want 3234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * to use higher-level APIs where available, but this class provides access to the underlying 3334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * primitives used to implement the higher-level APIs. 3434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * 3534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * <p>The corresponding constants can be found in {@link OsConstants}. 365d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes */ 375d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughespublic final class Os { 385d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes private Os() {} 395d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes 4034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 4134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/accept.2.html">accept(2)</a>. 4234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 435d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress) throws ErrnoException, SocketException { return Libcore.os.accept(fd, peerAddress); } 440ab1a26ca767ae36fbbe27b62893670b208fa494Neil Fuller 450ab1a26ca767ae36fbbe27b62893670b208fa494Neil Fuller /** 460ab1a26ca767ae36fbbe27b62893670b208fa494Neil Fuller * TODO Change the public API by removing the overload above and unhiding this version. 470ab1a26ca767ae36fbbe27b62893670b208fa494Neil Fuller * @hide 480ab1a26ca767ae36fbbe27b62893670b208fa494Neil Fuller */ 490ab1a26ca767ae36fbbe27b62893670b208fa494Neil Fuller public static FileDescriptor accept(FileDescriptor fd, SocketAddress peerAddress) throws ErrnoException, SocketException { return Libcore.os.accept(fd, peerAddress); } 5034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 5134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 5234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/access.2.html">access(2)</a>. 5334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 545d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static boolean access(String path, int mode) throws ErrnoException { return Libcore.os.access(path, mode); } 5534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 563e58734d651080009c9190c7062837fca5c7cf4ePaul Jensen /** @hide */ public static InetAddress[] android_getaddrinfo(String node, StructAddrinfo hints, int netId) throws GaiException { return Libcore.os.android_getaddrinfo(node, hints, netId); } 573e58734d651080009c9190c7062837fca5c7cf4ePaul Jensen 5834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 5934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/bind.2.html">bind(2)</a>. 6034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 615d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void bind(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { Libcore.os.bind(fd, address, port); } 6234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 638f5b46d72e5c1b1b1dd4357580c4fb5a60e3f4deErik Kline /** @hide */ public static void bind(FileDescriptor fd, SocketAddress address) throws ErrnoException, SocketException { Libcore.os.bind(fd, address); } 648f5b46d72e5c1b1b1dd4357580c4fb5a60e3f4deErik Kline 6534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 665744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe * See <a href="http://man7.org/linux/man-pages/man2/capget.2.html">capget(2)</a>. 675744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe * 685744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe * @hide 695744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe */ 705744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe public static StructCapUserData[] capget(StructCapUserHeader hdr) throws ErrnoException { 715744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe return Libcore.os.capget(hdr); 725744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe } 735744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe 745744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe /** 755744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe * See <a href="http://man7.org/linux/man-pages/man2/capset.2.html">capset(2)</a>. 765744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe * 775744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe * @hide 785744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe */ 795744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe public static void capset(StructCapUserHeader hdr, StructCapUserData[] data) 805744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe throws ErrnoException { 815744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe Libcore.os.capset(hdr, data); 825744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe } 835744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe 845744e4a762ca12243b47dd8aed24d87d963b4d3bAndreas Gampe /** 8534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/chmod.2.html">chmod(2)</a>. 8634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 875d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void chmod(String path, int mode) throws ErrnoException { Libcore.os.chmod(path, mode); } 8834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 8934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 9034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/chown.2.html">chown(2)</a>. 9134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 925d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void chown(String path, int uid, int gid) throws ErrnoException { Libcore.os.chown(path, uid, gid); } 9334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 9434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 9534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/close.2.html">close(2)</a>. 9634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 975d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void close(FileDescriptor fd) throws ErrnoException { Libcore.os.close(fd); } 9834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 9934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 10034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/connect.2.html">connect(2)</a>. 10134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1025d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void connect(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException { Libcore.os.connect(fd, address, port); } 10334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 1048f5b46d72e5c1b1b1dd4357580c4fb5a60e3f4deErik Kline /** @hide */ public static void connect(FileDescriptor fd, SocketAddress address) throws ErrnoException, SocketException { Libcore.os.connect(fd, address); } 1058f5b46d72e5c1b1b1dd4357580c4fb5a60e3f4deErik Kline 10634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 10734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/dup.2.html">dup(2)</a>. 10834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1095d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static FileDescriptor dup(FileDescriptor oldFd) throws ErrnoException { return Libcore.os.dup(oldFd); } 11034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 11134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 11234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/dup2.2.html">dup2(2)</a>. 11334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1145d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static FileDescriptor dup2(FileDescriptor oldFd, int newFd) throws ErrnoException { return Libcore.os.dup2(oldFd, newFd); } 11534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 11634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 11734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/environ.3.html">environ(3)</a>. 11834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1195d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static String[] environ() { return Libcore.os.environ(); } 12034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 12134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 12234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/execv.2.html">execv(2)</a>. 12334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1245d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void execv(String filename, String[] argv) throws ErrnoException { Libcore.os.execv(filename, argv); } 12534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 12634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 12734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/execve.2.html">execve(2)</a>. 12834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1295d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void execve(String filename, String[] argv, String[] envp) throws ErrnoException { Libcore.os.execve(filename, argv, envp); } 13034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 13134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 13234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/fchmod.2.html">fchmod(2)</a>. 13334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1345d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void fchmod(FileDescriptor fd, int mode) throws ErrnoException { Libcore.os.fchmod(fd, mode); } 13534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 13634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 13734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/fchown.2.html">fchown(2)</a>. 13834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1395d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void fchown(FileDescriptor fd, int uid, int gid) throws ErrnoException { Libcore.os.fchown(fd, uid, gid); } 14034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 14199a0c82619a88c6aea038757cf14090f5d33afebNeil Fuller /** @hide */ public static int fcntlFlock(FileDescriptor fd, int cmd, StructFlock arg) throws ErrnoException, InterruptedIOException { return Libcore.os.fcntlFlock(fd, cmd, arg); } 142c8d9ea662de6f4856b28907b4119087cfc5a44d2Narayan Kamath /** @hide */ public static int fcntlInt(FileDescriptor fd, int cmd, int arg) throws ErrnoException { return Libcore.os.fcntlInt(fd, cmd, arg); } 143c8d9ea662de6f4856b28907b4119087cfc5a44d2Narayan Kamath /** @hide */ public static int fcntlVoid(FileDescriptor fd, int cmd) throws ErrnoException { return Libcore.os.fcntlVoid(fd, cmd); } 14434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 14534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 14634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/fdatasync.2.html">fdatasync(2)</a>. 14734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1485d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void fdatasync(FileDescriptor fd) throws ErrnoException { Libcore.os.fdatasync(fd); } 14934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 15034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 15134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/fstat.2.html">fstat(2)</a>. 15234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1535d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static StructStat fstat(FileDescriptor fd) throws ErrnoException { return Libcore.os.fstat(fd); } 15434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 15534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 15634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/fstatvfs.2.html">fstatvfs(2)</a>. 15734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1585d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static StructStatVfs fstatvfs(FileDescriptor fd) throws ErrnoException { return Libcore.os.fstatvfs(fd); } 15934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 16034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 16134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/fsync.2.html">fsync(2)</a>. 16234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1635d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void fsync(FileDescriptor fd) throws ErrnoException { Libcore.os.fsync(fd); } 16434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 16534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 16634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/ftruncate.2.html">ftruncate(2)</a>. 16734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1685d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void ftruncate(FileDescriptor fd, long length) throws ErrnoException { Libcore.os.ftruncate(fd, length); } 16934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 17034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 17134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/gai_strerror.3.html">gai_strerror(3)</a>. 17234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1735d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static String gai_strerror(int error) { return Libcore.os.gai_strerror(error); } 17434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 17534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 17634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/getegid.2.html">getegid(2)</a>. 17734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1785d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int getegid() { return Libcore.os.getegid(); } 17934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 18034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 18134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/geteuid.2.html">geteuid(2)</a>. 18234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1835d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int geteuid() { return Libcore.os.geteuid(); } 18434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 18534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 18634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/getgid.2.html">getgid(2)</a>. 18734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1885d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int getgid() { return Libcore.os.getgid(); } 18934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 19034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 19134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/getenv.3.html">getenv(3)</a>. 19234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 1935d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static String getenv(String name) { return Libcore.os.getenv(name); } 19434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 1956d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong /** 1966d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong * See <a href="http://man7.org/linux/man-pages/man3/getifaddrs.3.html">getifaddrs(3)</a>. 1976d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong */ 1986d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong /** @hide */ public static StructIfaddrs[] getifaddrs() throws ErrnoException { return Libcore.os.getifaddrs(); } 1996d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong 20034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static String getnameinfo(InetAddress address, int flags) throws GaiException { return Libcore.os.getnameinfo(address, flags); } 20134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 20234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 20334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/getpeername.2.html">getpeername(2)</a>. 20434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2055d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static SocketAddress getpeername(FileDescriptor fd) throws ErrnoException { return Libcore.os.getpeername(fd); } 20634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 20734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 2088f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/getpgid.2.html">getpgid(2)</a>. 2098f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes */ 2108f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes /** @hide */ public static int getpgid(int pid) throws ErrnoException { return Libcore.os.getpgid(pid); } 2118f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes 2128f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes /** 21334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/getpid.2.html">getpid(2)</a>. 21434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2155d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int getpid() { return Libcore.os.getpid(); } 21634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 21734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 21834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/getppid.2.html">getppid(2)</a>. 21934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2205d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int getppid() { return Libcore.os.getppid(); } 22134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 22234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static StructPasswd getpwnam(String name) throws ErrnoException { return Libcore.os.getpwnam(name); } 22334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 22434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static StructPasswd getpwuid(int uid) throws ErrnoException { return Libcore.os.getpwuid(uid); } 22534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 22634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 22734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/getsockname.2.html">getsockname(2)</a>. 22834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2295d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static SocketAddress getsockname(FileDescriptor fd) throws ErrnoException { return Libcore.os.getsockname(fd); } 23034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 23134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static int getsockoptByte(FileDescriptor fd, int level, int option) throws ErrnoException { return Libcore.os.getsockoptByte(fd, level, option); } 23234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static InetAddress getsockoptInAddr(FileDescriptor fd, int level, int option) throws ErrnoException { return Libcore.os.getsockoptInAddr(fd, level, option); } 23334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static int getsockoptInt(FileDescriptor fd, int level, int option) throws ErrnoException { return Libcore.os.getsockoptInt(fd, level, option); } 23434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static StructLinger getsockoptLinger(FileDescriptor fd, int level, int option) throws ErrnoException { return Libcore.os.getsockoptLinger(fd, level, option); } 23534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static StructTimeval getsockoptTimeval(FileDescriptor fd, int level, int option) throws ErrnoException { return Libcore.os.getsockoptTimeval(fd, level, option); } 23634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static StructUcred getsockoptUcred(FileDescriptor fd, int level, int option) throws ErrnoException { return Libcore.os.getsockoptUcred(fd, level, option); } 23734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 23834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 23934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/gettid.2.html">gettid(2)</a>. 24034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2415d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int gettid() { return Libcore.os.gettid(); } 24234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 24334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 24434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/getuid.2.html">getuid(2)</a>. 24534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2465d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int getuid() { return Libcore.os.getuid(); } 24734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 24840afa6bcd4652a16fe461a59f205dd0d65652118Yi Kong /** 24940afa6bcd4652a16fe461a59f205dd0d65652118Yi Kong * See <a href="http://man7.org/linux/man-pages/man2/getxattr.2.html">getxattr(2)</a> 25040afa6bcd4652a16fe461a59f205dd0d65652118Yi Kong */ 25140afa6bcd4652a16fe461a59f205dd0d65652118Yi Kong public static byte[] getxattr(String path, String name) throws ErrnoException { return Libcore.os.getxattr(path, name); } 25290246a0ae7117d780e077c9e84cdb73ff5b44af7Jeff Sharkey 25334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 25434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/if_indextoname.3.html">if_indextoname(3)</a>. 25534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2565d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static String if_indextoname(int index) { return Libcore.os.if_indextoname(index); } 25734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 25834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 2596d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong * See <a href="http://man7.org/linux/man-pages/man3/if_nametoindex.3.html">if_nametoindex(3)</a>. 2606d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong */ 261ee24b6322448ac919231a668e308ebd719aa52d7Yi Kong public static int if_nametoindex(String name) { return Libcore.os.if_nametoindex(name); } 2626d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong 2636d1649c5b37b21ef2b690bc0f86306e19a32db02Yi Kong /** 26434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/inet_pton.3.html">inet_pton(3)</a>. 26534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2665d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static InetAddress inet_pton(int family, String address) { return Libcore.os.inet_pton(family, address); } 26734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 26834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static InetAddress ioctlInetAddress(FileDescriptor fd, int cmd, String interfaceName) throws ErrnoException { return Libcore.os.ioctlInetAddress(fd, cmd, interfaceName); } 26934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static int ioctlInt(FileDescriptor fd, int cmd, MutableInt arg) throws ErrnoException { return Libcore.os.ioctlInt(fd, cmd, arg); } 27034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 27134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 27234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/isatty.3.html">isatty(3)</a>. 27334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2745d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static boolean isatty(FileDescriptor fd) { return Libcore.os.isatty(fd); } 27534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 27634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 27734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/kill.2.html">kill(2)</a>. 27834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2795d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void kill(int pid, int signal) throws ErrnoException { Libcore.os.kill(pid, signal); } 28034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 28134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 28234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/lchown.2.html">lchown(2)</a>. 28334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2845d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void lchown(String path, int uid, int gid) throws ErrnoException { Libcore.os.lchown(path, uid, gid); } 28534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 28634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 28704428d61d7000e17ab21d08a1d672c34eb68f6e2Elliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/link.2.html">link(2)</a>. 28804428d61d7000e17ab21d08a1d672c34eb68f6e2Elliott Hughes */ 28904428d61d7000e17ab21d08a1d672c34eb68f6e2Elliott Hughes public static void link(String oldPath, String newPath) throws ErrnoException { Libcore.os.link(oldPath, newPath); } 29004428d61d7000e17ab21d08a1d672c34eb68f6e2Elliott Hughes 29104428d61d7000e17ab21d08a1d672c34eb68f6e2Elliott Hughes /** 29234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/listen.2.html">listen(2)</a>. 29334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 2945d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void listen(FileDescriptor fd, int backlog) throws ErrnoException { Libcore.os.listen(fd, backlog); } 29534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 29634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 29755dd377d62cf780df94d8e0198b66e99456b6f50Yi Kong * See <a href="http://man7.org/linux/man-pages/man2/listxattr.2.html">listxattr(2)</a> 29855dd377d62cf780df94d8e0198b66e99456b6f50Yi Kong */ 29955dd377d62cf780df94d8e0198b66e99456b6f50Yi Kong public static String[] listxattr(String path) throws ErrnoException { return Libcore.os.listxattr(path); } 30055dd377d62cf780df94d8e0198b66e99456b6f50Yi Kong 30155dd377d62cf780df94d8e0198b66e99456b6f50Yi Kong /** 30234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/lseek.2.html">lseek(2)</a>. 30334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3045d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static long lseek(FileDescriptor fd, long offset, int whence) throws ErrnoException { return Libcore.os.lseek(fd, offset, whence); } 30534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 30634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 30734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/lstat.2.html">lstat(2)</a>. 30834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3095d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static StructStat lstat(String path) throws ErrnoException { return Libcore.os.lstat(path); } 31034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 31134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 31234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/mincore.2.html">mincore(2)</a>. 31334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3145d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void mincore(long address, long byteCount, byte[] vector) throws ErrnoException { Libcore.os.mincore(address, byteCount, vector); } 31534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 31634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 31734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/mkdir.2.html">mkdir(2)</a>. 31834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3195d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void mkdir(String path, int mode) throws ErrnoException { Libcore.os.mkdir(path, mode); } 32034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 32134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 32234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/mkfifo.3.html">mkfifo(3)</a>. 32334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3245d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void mkfifo(String path, int mode) throws ErrnoException { Libcore.os.mkfifo(path, mode); } 32534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 32634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 32734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/mlock.2.html">mlock(2)</a>. 32834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3295d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void mlock(long address, long byteCount) throws ErrnoException { Libcore.os.mlock(address, byteCount); } 33034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 33134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 33234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/mmap.2.html">mmap(2)</a>. 33334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3345d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static long mmap(long address, long byteCount, int prot, int flags, FileDescriptor fd, long offset) throws ErrnoException { return Libcore.os.mmap(address, byteCount, prot, flags, fd, offset); } 33534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 33634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 33734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/msync.2.html">msync(2)</a>. 33834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3395d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void msync(long address, long byteCount, int flags) throws ErrnoException { Libcore.os.msync(address, byteCount, flags); } 34034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 34134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 34234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/munlock.2.html">munlock(2)</a>. 34334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3445d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void munlock(long address, long byteCount) throws ErrnoException { Libcore.os.munlock(address, byteCount); } 34534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 34634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 34734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/munmap.2.html">munmap(2)</a>. 34834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3495d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void munmap(long address, long byteCount) throws ErrnoException { Libcore.os.munmap(address, byteCount); } 35034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 35134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 35234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>. 35334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3545d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static FileDescriptor open(String path, int flags, int mode) throws ErrnoException { return Libcore.os.open(path, flags, mode); } 35534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 35634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 35734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/pipe.2.html">pipe(2)</a>. 35834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3590d8b5c3692c36837d22c4e7d9c4d7d95f6a10235Elliott Hughes public static FileDescriptor[] pipe() throws ErrnoException { return Libcore.os.pipe2(0); } 3600d8b5c3692c36837d22c4e7d9c4d7d95f6a10235Elliott Hughes 3610d8b5c3692c36837d22c4e7d9c4d7d95f6a10235Elliott Hughes /** @hide */ public static FileDescriptor[] pipe2(int flags) throws ErrnoException { return Libcore.os.pipe2(flags); } 36234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 36334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 36434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/poll.2.html">poll(2)</a>. 365fa542091e45db699a937c5ac0191194405107827Elliott Hughes * 366fa542091e45db699a937c5ac0191194405107827Elliott Hughes * <p>Note that in Lollipop this could throw an {@code ErrnoException} with {@code EINTR}. 367fa542091e45db699a937c5ac0191194405107827Elliott Hughes * In later releases, the implementation will automatically just restart the system call with 368fa542091e45db699a937c5ac0191194405107827Elliott Hughes * an appropriately reduced timeout. 36934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3705d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int poll(StructPollfd[] fds, int timeoutMs) throws ErrnoException { return Libcore.os.poll(fds, timeoutMs); } 37134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 37234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 373117a57a24651e820543cc7c5323f333a9c71b182Yi Kong * See <a href="http://man7.org/linux/man-pages/man3/posix_fallocate.3.html">posix_fallocate(3)</a>. 37434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3755d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void posix_fallocate(FileDescriptor fd, long offset, long length) throws ErrnoException { Libcore.os.posix_fallocate(fd, offset, length); } 37634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 37734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 37834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/prctl.2.html">prctl(2)</a>. 37934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3805215e4c0db7530519981f1e505e6db82401802f2Nick Kralevich public static int prctl(int option, long arg2, long arg3, long arg4, long arg5) throws ErrnoException { return Libcore.os.prctl(option, arg2, arg3, arg4, arg5); }; 38134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 38234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 38334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/pread.2.html">pread(2)</a>. 38434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3855d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int pread(FileDescriptor fd, ByteBuffer buffer, long offset) throws ErrnoException, InterruptedIOException { return Libcore.os.pread(fd, buffer, offset); } 38634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 38734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 38834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/pread.2.html">pread(2)</a>. 38934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3905d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int pread(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset) throws ErrnoException, InterruptedIOException { return Libcore.os.pread(fd, bytes, byteOffset, byteCount, offset); } 39134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 39234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 39334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/pwrite.2.html">pwrite(2)</a>. 39434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 3955d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int pwrite(FileDescriptor fd, ByteBuffer buffer, long offset) throws ErrnoException, InterruptedIOException { return Libcore.os.pwrite(fd, buffer, offset); } 39634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 39734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 39834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/pwrite.2.html">pwrite(2)</a>. 39934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4005d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int pwrite(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset) throws ErrnoException, InterruptedIOException { return Libcore.os.pwrite(fd, bytes, byteOffset, byteCount, offset); } 40134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 40234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 40334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/read.2.html">read(2)</a>. 40434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4055d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int read(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException, InterruptedIOException { return Libcore.os.read(fd, buffer); } 40634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 40734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 40834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/read.2.html">read(2)</a>. 40934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4105d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws ErrnoException, InterruptedIOException { return Libcore.os.read(fd, bytes, byteOffset, byteCount); } 41134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 41234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 41334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/readlink.2.html">readlink(2)</a>. 41434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4155d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static String readlink(String path) throws ErrnoException { return Libcore.os.readlink(path); } 41634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 41734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 41834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/readv.2.html">readv(2)</a>. 41934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4205d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int readv(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts) throws ErrnoException, InterruptedIOException { return Libcore.os.readv(fd, buffers, offsets, byteCounts); } 42134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 42234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 42334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/recvfrom.2.html">recvfrom(2)</a>. 42434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4255d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int recvfrom(FileDescriptor fd, ByteBuffer buffer, int flags, InetSocketAddress srcAddress) throws ErrnoException, SocketException { return Libcore.os.recvfrom(fd, buffer, flags, srcAddress); } 42634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 42734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 42834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/recvfrom.2.html">recvfrom(2)</a>. 42934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4305d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int recvfrom(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetSocketAddress srcAddress) throws ErrnoException, SocketException { return Libcore.os.recvfrom(fd, bytes, byteOffset, byteCount, flags, srcAddress); } 43134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 43234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 43334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/remove.3.html">remove(3)</a>. 43434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4355d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void remove(String path) throws ErrnoException { Libcore.os.remove(path); } 43634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 43776fa41aa4ac891670446592243b654fac7deb53fYi Kong /** 43876fa41aa4ac891670446592243b654fac7deb53fYi Kong * See <a href="http://man7.org/linux/man-pages/man2/removexattr.2.html">removexattr(2)</a>. 43976fa41aa4ac891670446592243b654fac7deb53fYi Kong */ 44076fa41aa4ac891670446592243b654fac7deb53fYi Kong public static void removexattr(String path, String name) throws ErrnoException { Libcore.os.removexattr(path, name); } 44190246a0ae7117d780e077c9e84cdb73ff5b44af7Jeff Sharkey 44234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 44334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/rename.2.html">rename(2)</a>. 44434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4455d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void rename(String oldPath, String newPath) throws ErrnoException { Libcore.os.rename(oldPath, newPath); } 44634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 44734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 44834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/sendfile.2.html">sendfile(2)</a>. 44934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4505d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static long sendfile(FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount) throws ErrnoException { return Libcore.os.sendfile(outFd, inFd, inOffset, byteCount); } 45134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 45234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 45334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/sendto.2.html">sendto(2)</a>. 45434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4555d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException { return Libcore.os.sendto(fd, buffer, flags, inetAddress, port); } 45634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 45734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 45834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/sendto.2.html">sendto(2)</a>. 45934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4605d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException { return Libcore.os.sendto(fd, bytes, byteOffset, byteCount, flags, inetAddress, port); } 46134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 46234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 46336f73b3bd9014eaf47663b85fb185b95fbf7a3a6Lorenzo Colitti * See <a href="http://man7.org/linux/man-pages/man2/sendto.2.html">sendto(2)</a>. 46436f73b3bd9014eaf47663b85fb185b95fbf7a3a6Lorenzo Colitti */ 46536f73b3bd9014eaf47663b85fb185b95fbf7a3a6Lorenzo Colitti /** @hide */ public static int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, SocketAddress address) throws ErrnoException, SocketException { return Libcore.os.sendto(fd, bytes, byteOffset, byteCount, flags, address); } 46636f73b3bd9014eaf47663b85fb185b95fbf7a3a6Lorenzo Colitti 46736f73b3bd9014eaf47663b85fb185b95fbf7a3a6Lorenzo Colitti /** 46834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/setegid.2.html">setegid(2)</a>. 46934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4705d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void setegid(int egid) throws ErrnoException { Libcore.os.setegid(egid); } 47134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 47234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 47334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/setenv.3.html">setenv(3)</a>. 47434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4755d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void setenv(String name, String value, boolean overwrite) throws ErrnoException { Libcore.os.setenv(name, value, overwrite); } 47634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 47734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 47834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/seteuid.2.html">seteuid(2)</a>. 47934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4805d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void seteuid(int euid) throws ErrnoException { Libcore.os.seteuid(euid); } 48134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 48234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 48334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/setgid.2.html">setgid(2)</a>. 48434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 4855d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void setgid(int gid) throws ErrnoException { Libcore.os.setgid(gid); } 48634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 48734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 4888f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/setpgid.2.html">setpgid(2)</a>. 4898f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes */ 4908f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes /** @hide */ public static void setpgid(int pid, int pgid) throws ErrnoException { Libcore.os.setpgid(pid, pgid); } 4918f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes 4928f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes /** 4938f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/setregid.2.html">setregid(2)</a>. 4948f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes */ 4958f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes /** @hide */ public static void setregid(int rgid, int egid) throws ErrnoException { Libcore.os.setregid(rgid, egid); } 4968f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes 4978f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes /** 4988f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/setreuid.2.html">setreuid(2)</a>. 4998f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes */ 5008f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes /** @hide */ public static void setreuid(int ruid, int euid) throws ErrnoException { Libcore.os.setreuid(ruid, euid); } 5018f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes 5028f0f2ac7fcd8f366a78cc51181d065ab93385e46Elliott Hughes /** 50334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/setsid.2.html">setsid(2)</a>. 50434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5055d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int setsid() throws ErrnoException { return Libcore.os.setsid(); } 50634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 50734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static void setsockoptByte(FileDescriptor fd, int level, int option, int value) throws ErrnoException { Libcore.os.setsockoptByte(fd, level, option, value); } 50834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static void setsockoptIfreq(FileDescriptor fd, int level, int option, String value) throws ErrnoException { Libcore.os.setsockoptIfreq(fd, level, option, value); } 509ea47d5d712edcaef726a3e12065729be21699afeTobias Thierer 510ea47d5d712edcaef726a3e12065729be21699afeTobias Thierer /** 511ea47d5d712edcaef726a3e12065729be21699afeTobias Thierer * See <a href="http://man7.org/linux/man-pages/man2/setsockopt.2.html">setsockopt(2)</a>. 512ea47d5d712edcaef726a3e12065729be21699afeTobias Thierer */ 513ea47d5d712edcaef726a3e12065729be21699afeTobias Thierer public static void setsockoptInt(FileDescriptor fd, int level, int option, int value) throws ErrnoException { Libcore.os.setsockoptInt(fd, level, option, value); } 514ea47d5d712edcaef726a3e12065729be21699afeTobias Thierer 51534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static void setsockoptIpMreqn(FileDescriptor fd, int level, int option, int value) throws ErrnoException { Libcore.os.setsockoptIpMreqn(fd, level, option, value); } 51634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static void setsockoptGroupReq(FileDescriptor fd, int level, int option, StructGroupReq value) throws ErrnoException { Libcore.os.setsockoptGroupReq(fd, level, option, value); } 51734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static void setsockoptGroupSourceReq(FileDescriptor fd, int level, int option, StructGroupSourceReq value) throws ErrnoException { Libcore.os.setsockoptGroupSourceReq(fd, level, option, value); } 51834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static void setsockoptLinger(FileDescriptor fd, int level, int option, StructLinger value) throws ErrnoException { Libcore.os.setsockoptLinger(fd, level, option, value); } 51934721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** @hide */ public static void setsockoptTimeval(FileDescriptor fd, int level, int option, StructTimeval value) throws ErrnoException { Libcore.os.setsockoptTimeval(fd, level, option, value); } 52034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 52134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 52234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/setuid.2.html">setuid(2)</a>. 52334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5245d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void setuid(int uid) throws ErrnoException { Libcore.os.setuid(uid); } 52534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 52640afa6bcd4652a16fe461a59f205dd0d65652118Yi Kong /** 52740afa6bcd4652a16fe461a59f205dd0d65652118Yi Kong * See <a href="http://man7.org/linux/man-pages/man2/setxattr.2.html">setxattr(2)</a> 52840afa6bcd4652a16fe461a59f205dd0d65652118Yi Kong */ 52940afa6bcd4652a16fe461a59f205dd0d65652118Yi Kong public static void setxattr(String path, String name, byte[] value, int flags) throws ErrnoException { Libcore.os.setxattr(path, name, value, flags); }; 53090246a0ae7117d780e077c9e84cdb73ff5b44af7Jeff Sharkey 53134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 53234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/shutdown.2.html">shutdown(2)</a>. 53334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5345d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void shutdown(FileDescriptor fd, int how) throws ErrnoException { Libcore.os.shutdown(fd, how); } 53534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 53634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 53734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/socket.2.html">socket(2)</a>. 53834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5395d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static FileDescriptor socket(int domain, int type, int protocol) throws ErrnoException { return Libcore.os.socket(domain, type, protocol); } 54034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 54134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 54234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/socketpair.2.html">socketpair(2)</a>. 54334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5445d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void socketpair(int domain, int type, int protocol, FileDescriptor fd1, FileDescriptor fd2) throws ErrnoException { Libcore.os.socketpair(domain, type, protocol, fd1, fd2); } 54534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 54634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 54734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/stat.2.html">stat(2)</a>. 54834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5495d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static StructStat stat(String path) throws ErrnoException { return Libcore.os.stat(path); } 55034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 55134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 55234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/statvfs.2.html">statvfs(2)</a>. 55334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5545d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static StructStatVfs statvfs(String path) throws ErrnoException { return Libcore.os.statvfs(path); } 55534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 55634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 55734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/strerror.3.html">strerror(2)</a>. 55834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5595d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static String strerror(int errno) { return Libcore.os.strerror(errno); } 56034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 56134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 56234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/strsignal.3.html">strsignal(3)</a>. 56334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5645d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static String strsignal(int signal) { return Libcore.os.strsignal(signal); } 56534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 56634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 56734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/symlink.2.html">symlink(2)</a>. 56834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5695d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void symlink(String oldPath, String newPath) throws ErrnoException { Libcore.os.symlink(oldPath, newPath); } 57034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 57134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 57234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/sysconf.3.html">sysconf(3)</a>. 57334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5745d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static long sysconf(int name) { return Libcore.os.sysconf(name); } 57534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 57634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 57734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/tcdrain.3.html">tcdrain(3)</a>. 57834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5795d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void tcdrain(FileDescriptor fd) throws ErrnoException { Libcore.os.tcdrain(fd); } 58034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 58134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 58234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/tcsendbreak.3.html">tcsendbreak(3)</a>. 58334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5845d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void tcsendbreak(FileDescriptor fd, int duration) throws ErrnoException { Libcore.os.tcsendbreak(fd, duration); } 58534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 58634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 58734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/umask.2.html">umask(2)</a>. 58834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5895d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int umask(int mask) { return Libcore.os.umask(mask); } 59034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 59134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 59234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/uname.2.html">uname(2)</a>. 59334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 5945d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static StructUtsname uname() { return Libcore.os.uname(); } 59534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 59634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 5975e8f82f2592498e75ac4685ccd0d31d601d37bdcNeil Fuller * @hide See <a href="http://man7.org/linux/man-pages/man2/unlink.2.html">unlink(2)</a>. 5985e8f82f2592498e75ac4685ccd0d31d601d37bdcNeil Fuller */ 5995e8f82f2592498e75ac4685ccd0d31d601d37bdcNeil Fuller public static void unlink(String pathname) throws ErrnoException { Libcore.os.unlink(pathname); } 6005e8f82f2592498e75ac4685ccd0d31d601d37bdcNeil Fuller 6015e8f82f2592498e75ac4685ccd0d31d601d37bdcNeil Fuller /** 60234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man3/unsetenv.3.html">unsetenv(3)</a>. 60334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 6045d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static void unsetenv(String name) throws ErrnoException { Libcore.os.unsetenv(name); } 60534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 60634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 60734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/waitpid.2.html">waitpid(2)</a>. 60834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 6095d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int waitpid(int pid, MutableInt status, int options) throws ErrnoException { return Libcore.os.waitpid(pid, status, options); } 61034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 61134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 61234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/write.2.html">write(2)</a>. 61334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 6145d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int write(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException, InterruptedIOException { return Libcore.os.write(fd, buffer); } 61534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 61634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 61734721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/write.2.html">write(2)</a>. 61834721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 6195d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws ErrnoException, InterruptedIOException { return Libcore.os.write(fd, bytes, byteOffset, byteCount); } 62034721e8e0051258e87848bae25baf50722b4c76aElliott Hughes 62134721e8e0051258e87848bae25baf50722b4c76aElliott Hughes /** 62234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * See <a href="http://man7.org/linux/man-pages/man2/writev.2.html">writev(2)</a>. 62334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes */ 6245d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes public static int writev(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts) throws ErrnoException, InterruptedIOException { return Libcore.os.writev(fd, buffers, offsets, byteCounts); } 6255d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes} 626