1 /* 2 * Copyright 2012, 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 <stat_portable.h> 18 19 /* Note: The Portable Header will define stat to stat_portable */ 20 int stat_portable(const char *path, struct stat_portable *s) 21 { 22 struct stat mips_stat; 23 int ret = stat(path, &mips_stat); 24 stat_ntop(&mips_stat, s); 25 return ret; 26 } 27 28 int fstat_portable(int fd, struct stat_portable *s) 29 { 30 struct stat mips_stat; 31 int ret = fstat(fd, &mips_stat); 32 stat_ntop(&mips_stat, s); 33 return ret; 34 } 35 36 int lstat_portable(const char *path, struct stat_portable *s) 37 { 38 struct stat mips_stat; 39 int ret = lstat(path, &mips_stat); 40 stat_ntop(&mips_stat, s); 41 return ret; 42 } 43 44 int fstatat_portable(int dirfd, const char *path, struct stat_portable *s, int flags) 45 { 46 struct stat mips_stat; 47 int ret = fstatat(dirfd, path, &mips_stat, flags); 48 stat_ntop(&mips_stat, s); 49 return ret; 50 } 51