• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <portability.h>
18 #include <stat_portable.h>
19 
20 /* Note: The Portable Header will define stat to stat_portable */
WRAP(stat)21 int WRAP(stat)(const char *path, struct stat_portable *s)
22 {
23     struct stat x86_stat;
24     int ret = REAL(stat)(path, &x86_stat);
25     stat_ntop(&x86_stat, s);
26     return ret;
27 }
28 
WRAP(fstat)29 int WRAP(fstat)(int fd, struct stat_portable *s)
30 {
31     struct stat x86_stat;
32     int ret = REAL(fstat)(fd, &x86_stat);
33     stat_ntop(&x86_stat, s);
34     return ret;
35 }
36 
WRAP(lstat)37 int WRAP(lstat)(const char *path, struct stat_portable *s)
38 {
39     struct stat x86_stat;
40     int ret = REAL(lstat)(path, &x86_stat);
41     stat_ntop(&x86_stat, s);
42     return ret;
43 }
44 
WRAP(fstatat)45 int WRAP(fstatat)(int dirfd, const char *path, struct stat_portable *s, int flags)
46 {
47     struct stat x86_stat;
48     int ret = REAL(fstatat)(dirfd, path, &x86_stat, flags);
49     stat_ntop(&x86_stat, s);
50     return ret;
51 }
52