1 /* 2 * Copyright 2014, The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include <portability.h> 18 #include <stat_portable.h> 19 #include <sys/stat.h> 20 21 22 int WRAP(fstat)(int fd, struct stat_portable *s) { 23 struct stat mips64_stat; 24 int ret = REAL(fstat)(fd, &mips64_stat); 25 stat_ntop(&mips64_stat, s); 26 return ret; 27 } 28 static inline int WRAP(fstat64)(int fd, struct stat64_portable *s) { 29 return WRAP(fstat)(fd, (struct stat_portable*)s); 30 } 31 32 33 int WRAP(fstatat)(int dirfd, const char *path, struct stat_portable *s, int flags) { 34 struct stat mips64_stat; 35 int ret = REAL(fstatat)(dirfd, path, &mips64_stat, flags); 36 stat_ntop(&mips64_stat, s); 37 return ret; 38 } 39 static inline int WRAP(fstatat64)(int dirfd, const char *path, 40 struct stat64_portable *s, int flags) { 41 return WRAP(fstatat)(dirfd, path, (struct stat_portable*)s, flags); 42 } 43 44 45 int WRAP(lstat)(const char *path, struct stat_portable *s) { 46 struct stat mips64_stat; 47 int ret = REAL(lstat)(path, &mips64_stat); 48 stat_ntop(&mips64_stat, s); 49 return ret; 50 } 51 static inline int WRAP(lstat64)(const char *path, struct stat64_portable *s) { 52 return WRAP(lstat)(path, (struct stat_portable*)s); 53 } 54 55 56 int WRAP(stat)(const char* path, struct stat_portable* s) { 57 struct stat mips64_stat; 58 int ret = REAL(stat)(path, &mips64_stat); 59 stat_ntop(&mips64_stat, s); 60 return ret; 61 } 62 static inline int WRAP(stat64)(const char* path, struct stat64_portable *s) { 63 return WRAP(stat)(path, (struct stat_portable*)s); 64 } 65 66