Home | History | Annotate | Download | only in arch-x86
      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 x86_stat;
     23     int ret = stat(path, &x86_stat);
     24     stat_ntop(&x86_stat, s);
     25     return ret;
     26 }
     27 
     28 int fstat_portable(int fd, struct stat_portable *s)
     29 {
     30     struct stat x86_stat;
     31     int ret = fstat(fd, &x86_stat);
     32     stat_ntop(&x86_stat, s);
     33     return ret;
     34 }
     35 
     36 int lstat_portable(const char *path, struct stat_portable *s)
     37 {
     38     struct stat x86_stat;
     39     int ret = lstat(path, &x86_stat);
     40     stat_ntop(&x86_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 x86_stat;
     47     int ret = fstatat(dirfd, path, &x86_stat, flags);
     48     stat_ntop(&x86_stat, s);
     49     return ret;
     50 }
     51