Posix.java revision 41f0605d2c809bd9bc1c0fb68d86b49a0f59b6c5
1ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes/* 2ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * Copyright (C) 2011 The Android Open Source Project 3ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * 4ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * Licensed under the Apache License, Version 2.0 (the "License"); 5ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * you may not use this file except in compliance with the License. 6ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * You may obtain a copy of the License at 7ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * 8ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * http://www.apache.org/licenses/LICENSE-2.0 9ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * 10ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * Unless required by applicable law or agreed to in writing, software 11ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS, 12ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * See the License for the specific language governing permissions and 14ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes * limitations under the License. 15ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes */ 16ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes 17ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughespackage libcore.io; 18ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes 1952724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughesimport java.io.FileDescriptor; 2052724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes 21ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughespublic final class Posix implements Os { 22ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes Posix() { } 23ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes 24ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes public native boolean access(String path, int mode) throws ErrnoException; 25b7190190e0ef8de883c952efb319ce7748831faaElliott Hughes public native void chmod(String path, int mode) throws ErrnoException; 26ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes public native String[] environ(); 2752724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes public native void fdatasync(FileDescriptor fd) throws ErrnoException; 2847cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes public native StructStat fstat(FileDescriptor fd) throws ErrnoException; 2959fa7163774d6930a174bc038414a4b780581957Elliott Hughes public native StructStatFs fstatfs(FileDescriptor fd) throws ErrnoException; 3052724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes public native void fsync(FileDescriptor fd) throws ErrnoException; 31f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes public native void ftruncate(FileDescriptor fd, long length) throws ErrnoException; 32ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes public native String getenv(String name); 339a3f363523000704205df288f8b6f2f48c0d8563Elliott Hughes public native boolean isatty(FileDescriptor fd); 34dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes public native long lseek(FileDescriptor fd, long offset, int whence) throws ErrnoException; 350f746ff511162add42eeabaf14ba70ace874c6f4Elliott Hughes public native void mincore(long address, long byteCount, byte[] vector) throws ErrnoException; 36c7fa20701d5e9398c38f4615ed293acfce1c0cf6Elliott Hughes public native void mkdir(String path, int mode) throws ErrnoException; 377e13c0f05ac9e7c55682d10e953dd4cbd5e6107cElliott Hughes public native void mlock(long address, long byteCount) throws ErrnoException; 387e25eff38a191d9c19e45093f4fde5102fb09d78Elliott Hughes public native long mmap(long address, long byteCount, int prot, int flags, FileDescriptor fd, long offset) throws ErrnoException; 397e25eff38a191d9c19e45093f4fde5102fb09d78Elliott Hughes public native void msync(long address, long byteCount, int flags) throws ErrnoException; 407e13c0f05ac9e7c55682d10e953dd4cbd5e6107cElliott Hughes public native void munlock(long address, long byteCount) throws ErrnoException; 417e25eff38a191d9c19e45093f4fde5102fb09d78Elliott Hughes public native void munmap(long address, long byteCount) throws ErrnoException; 420ac77ac8e915bff1a863e371f9b363033f9cf759Elliott Hughes public native FileDescriptor open(String path, int flags, int mode) throws ErrnoException; 4341f0605d2c809bd9bc1c0fb68d86b49a0f59b6c5Elliott Hughes public native FileDescriptor[] pipe() throws ErrnoException; 4447cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes public native StructStat lstat(String path) throws ErrnoException; 45c7fa20701d5e9398c38f4615ed293acfce1c0cf6Elliott Hughes public native void remove(String path) throws ErrnoException; 46a20cc6fca30d18e05db67ceeb0403b7b58ffd364Elliott Hughes public native void rename(String oldPath, String newPath) throws ErrnoException; 4747cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes public native StructStat stat(String path) throws ErrnoException; 4859fa7163774d6930a174bc038414a4b780581957Elliott Hughes public native StructStatFs statfs(String path) throws ErrnoException; 49ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes public native String strerror(int errno); 50a20cc6fca30d18e05db67ceeb0403b7b58ffd364Elliott Hughes public native void symlink(String oldPath, String newPath) throws ErrnoException; 516fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes public native long sysconf(int name); 52ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes} 53