libcore_io_Linux.cpp revision 9a3f363523000704205df288f8b6f2f48c0d8563
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 Hughes#define LOG_TAG "Posix" 18ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes 19ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes#include "JNIHelp.h" 20ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes#include "JniConstants.h" 21ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes#include "JniException.h" 22ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes#include "ScopedUtfChars.h" 23ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes#include "toStringArray.h" 24ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes 25ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes#include <errno.h> 26ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes#include <stdlib.h> 2752724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes#include <unistd.h> 2847cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes#include <sys/stat.h> 29ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes 30dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughesstatic void throwErrnoException(JNIEnv* env, const char* name, int errnum) { 31ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes jthrowable cause = NULL; 32ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes if (env->ExceptionCheck()) { 33ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes cause = env->ExceptionOccurred(); 34ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes env->ExceptionClear(); 35ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes } 36ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes 37f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes ScopedLocalRef<jstring> javaName(env, env->NewStringUTF(name)); 38f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes if (javaName.get() == NULL) { 39f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes // Not really much we can do here. We're probably dead in the water, 40f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes // but let's try to stumble on... 41f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes env->ExceptionClear(); 42f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes } 43f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes 44ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes jobject exception; 45ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes if (cause != NULL) { 46f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes static jmethodID ctor = env->GetMethodID(JniConstants::errnoExceptionClass, "<init>", 47f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes "(Ljava/lang/String;ILjava/lang/Throwable;)V"); 48f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes exception = env->NewObject(JniConstants::errnoExceptionClass, ctor, 49f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes javaName.get(), errnum, cause); 50ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes } else { 51f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes static jmethodID ctor = env->GetMethodID(JniConstants::errnoExceptionClass, "<init>", 52f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes "(Ljava/lang/String;I)V"); 53f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes exception = env->NewObject(JniConstants::errnoExceptionClass, ctor, javaName.get(), errnum); 54ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes } 55ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes env->Throw(reinterpret_cast<jthrowable>(exception)); 56dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes} 57dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes 58dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughestemplate <typename rc_t> 59dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughesstatic rc_t throwIfMinusOne(JNIEnv* env, const char* name, int errnum, rc_t rc) { 60dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes if (rc == rc_t(-1)) { 61dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes throwErrnoException(env, name, errnum); 62dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes } 63dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes return rc; 6447cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes} 6547cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes 6647cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughesstatic jobject makeStructStat(JNIEnv* env, const struct stat& sb) { 6747cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes static jmethodID ctor = env->GetMethodID(JniConstants::structStatClass, "<init>", 6847cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes "(JJIJIIJJJJJJJ)V"); 6947cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes return env->NewObject(JniConstants::structStatClass, ctor, 7047cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes jlong(sb.st_dev), jlong(sb.st_ino), jint(sb.st_mode), jlong(sb.st_nlink), 7147cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes jint(sb.st_uid), jint(sb.st_gid), jlong(sb.st_rdev), jlong(sb.st_size), 7247cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes jlong(sb.st_atime), jlong(sb.st_mtime), jlong(sb.st_ctime), 7347cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes jlong(sb.st_blksize), jlong(sb.st_blocks)); 7447cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes} 7547cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes 7647cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughesstatic jobject doStat(JNIEnv* env, jstring javaPath, bool isLstat) { 7747cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes ScopedUtfChars path(env, javaPath); 7847cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes if (path.c_str() == NULL) { 7947cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes return NULL; 8047cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes } 8147cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes struct stat sb; 8247cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes int rc = isLstat ? TEMP_FAILURE_RETRY(lstat(path.c_str(), &sb)) 8347cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes : TEMP_FAILURE_RETRY(stat(path.c_str(), &sb)); 84dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes if (rc == -1) { 85dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes throwErrnoException(env, isLstat ? "lstat" : "stat", errno); 8647cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes return NULL; 8747cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes } 8847cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes return makeStructStat(env, sb); 89ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes} 90ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes 91ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughesstatic jboolean Posix_access(JNIEnv* env, jobject, jstring javaPath, jint mode) { 92ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes ScopedUtfChars path(env, javaPath); 93ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes if (path.c_str() == NULL) { 94ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes return JNI_FALSE; 95ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes } 9647cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes int rc = TEMP_FAILURE_RETRY(access(path.c_str(), mode)); 97dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes if (rc == -1) { 98dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes throwErrnoException(env, "access", errno); 99dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes } 100ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes return (rc == 0); 101ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes} 102ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes 103ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughesstatic jobjectArray Posix_environ(JNIEnv* env, jobject) { 104ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes extern char** environ; // Standard, but not in any header file. 105ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes return toStringArray(env, environ); 106ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes} 107ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes 10852724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughesstatic void Posix_fdatasync(JNIEnv* env, jobject, jobject javaFd) { 10952724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes int fd = jniGetFDFromFileDescriptor(env, javaFd); 110dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes throwIfMinusOne(env, "fdatasync", errno, TEMP_FAILURE_RETRY(fdatasync(fd))); 11152724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes} 11252724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes 11347cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughesstatic jobject Posix_fstat(JNIEnv* env, jobject, jobject javaFd) { 11447cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes int fd = jniGetFDFromFileDescriptor(env, javaFd); 11547cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes struct stat sb; 11647cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes int rc = TEMP_FAILURE_RETRY(fstat(fd, &sb)); 117dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes if (rc == -1) { 118dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes throwErrnoException(env, "fstat", errno); 11947cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes return NULL; 12047cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes } 12147cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes return makeStructStat(env, sb); 12247cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes} 12347cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes 12452724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughesstatic void Posix_fsync(JNIEnv* env, jobject, jobject javaFd) { 12552724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes int fd = jniGetFDFromFileDescriptor(env, javaFd); 126dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes throwIfMinusOne(env, "fsync", errno, TEMP_FAILURE_RETRY(fsync(fd))); 127f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes} 128f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes 129f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughesstatic void Posix_ftruncate(JNIEnv* env, jobject, jobject javaFd, jlong length) { 130f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes int fd = jniGetFDFromFileDescriptor(env, javaFd); 131dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes throwIfMinusOne(env, "ftruncate", errno, TEMP_FAILURE_RETRY(ftruncate64(fd, length))); 13252724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes} 13352724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes 134ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughesstatic jstring Posix_getenv(JNIEnv* env, jobject, jstring javaName) { 135ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes ScopedUtfChars name(env, javaName); 136ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes if (name.c_str() == NULL) { 137ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes return NULL; 138ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes } 139ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes return env->NewStringUTF(getenv(name.c_str())); 140ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes} 141ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes 1429a3f363523000704205df288f8b6f2f48c0d8563Elliott Hughesstatic jboolean Posix_isatty(JNIEnv* env, jobject, jobject javaFd) { 1439a3f363523000704205df288f8b6f2f48c0d8563Elliott Hughes int fd = jniGetFDFromFileDescriptor(env, javaFd); 1449a3f363523000704205df288f8b6f2f48c0d8563Elliott Hughes return TEMP_FAILURE_RETRY(isatty(fd)) == 0; 1459a3f363523000704205df288f8b6f2f48c0d8563Elliott Hughes} 1469a3f363523000704205df288f8b6f2f48c0d8563Elliott Hughes 147dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughesstatic jlong Posix_lseek(JNIEnv* env, jobject, jobject javaFd, jlong offset, jint whence) { 148dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes int fd = jniGetFDFromFileDescriptor(env, javaFd); 149dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes return throwIfMinusOne(env, "lseek", errno, TEMP_FAILURE_RETRY(lseek64(fd, offset, whence))); 150dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes} 151dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes 15247cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughesstatic jobject Posix_lstat(JNIEnv* env, jobject, jstring javaPath) { 15347cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes return doStat(env, javaPath, true); 15447cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes} 15547cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes 15647cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughesstatic jobject Posix_stat(JNIEnv* env, jobject, jstring javaPath) { 15747cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes return doStat(env, javaPath, false); 15847cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes} 15947cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes 160ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughesstatic jstring Posix_strerror(JNIEnv* env, jobject, jint errnum) { 16152724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes char buffer[BUFSIZ]; 162ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes const char* message = jniStrError(errnum, buffer, sizeof(buffer)); 163ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes return env->NewStringUTF(message); 164ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes} 165ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes 1666fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughesstatic jlong Posix_sysconf(JNIEnv* env, jobject, jint name) { 1676fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes // Since -1 is a valid result from sysconf(3), detecting failure is a little more awkward. 1686fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes errno = 0; 1696fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes long result = sysconf(name); 1706fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes if (result == -1L && errno == EINVAL) { 171dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes throwErrnoException(env, "sysconf", errno); 1726fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes } 1736fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes return result; 1746fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes} 1756fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes 176ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughesstatic JNINativeMethod gMethods[] = { 177ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes NATIVE_METHOD(Posix, access, "(Ljava/lang/String;I)Z"), 178ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes NATIVE_METHOD(Posix, environ, "()[Ljava/lang/String;"), 17952724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes NATIVE_METHOD(Posix, fdatasync, "(Ljava/io/FileDescriptor;)V"), 18047cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes NATIVE_METHOD(Posix, fstat, "(Ljava/io/FileDescriptor;)Llibcore/io/StructStat;"), 18152724d3ebd4ccaaa4b9f5576e329d4272cde8ea9Elliott Hughes NATIVE_METHOD(Posix, fsync, "(Ljava/io/FileDescriptor;)V"), 182f5333fd2094bdac4d6506177b1964b79afa64d77Elliott Hughes NATIVE_METHOD(Posix, ftruncate, "(Ljava/io/FileDescriptor;J)V"), 183ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes NATIVE_METHOD(Posix, getenv, "(Ljava/lang/String;)Ljava/lang/String;"), 1849a3f363523000704205df288f8b6f2f48c0d8563Elliott Hughes NATIVE_METHOD(Posix, isatty, "(Ljava/io/FileDescriptor;)Z"), 185dedaccdfa07c370a58cba08b096133ad9eec0ec3Elliott Hughes NATIVE_METHOD(Posix, lseek, "(Ljava/io/FileDescriptor;JI)J"), 18647cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes NATIVE_METHOD(Posix, lstat, "(Ljava/lang/String;)Llibcore/io/StructStat;"), 18747cb338d43f75dd998b29caaaa9446c5705217d1Elliott Hughes NATIVE_METHOD(Posix, stat, "(Ljava/lang/String;)Llibcore/io/StructStat;"), 188ddfdbb9d172fe9b72e08e8d7deab0aa3b8acf044Elliott Hughes NATIVE_METHOD(Posix, strerror, "(I)Ljava/lang/String;"), 1896fc1a0e1e68dc2e0d12341548e58fa7f1c5dafc4Elliott Hughes NATIVE_METHOD(Posix, sysconf, "(I)J"), 190ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes}; 191ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughesint register_libcore_io_Posix(JNIEnv* env) { 192ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes return jniRegisterNativeMethods(env, "libcore/io/Posix", gMethods, NELEM(gMethods)); 193ec617e2cb4a374f0fd8fbda4a633214cf23a59a9Elliott Hughes} 194