OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
| 6 #include <sys/types.h> // Include something that will define __GLIBC__. |
| 7 |
| 8 // The entire file is wrapped in this #if. We do this so this .cc file can be |
| 9 // compiled, even on a non-glibc build. |
| 10 #if defined(__native_client__) && defined(__GLIBC__) |
| 11 |
6 #include "nacl_mounts/kernel_wrap.h" | 12 #include "nacl_mounts/kernel_wrap.h" |
7 #include <alloca.h> | 13 #include <alloca.h> |
8 #include <dirent.h> | 14 #include <dirent.h> |
9 #include <errno.h> | 15 #include <errno.h> |
10 #include <irt.h> | 16 #include <irt.h> |
11 #include <irt_syscalls.h> | 17 #include <irt_syscalls.h> |
12 #include <nacl_stat.h> | 18 #include <nacl_stat.h> |
13 #include <string.h> | 19 #include <string.h> |
14 #include <sys/stat.h> | 20 #include <sys/stat.h> |
15 #include "nacl_mounts/kernel_intercept.h" | 21 #include "nacl_mounts/kernel_intercept.h" |
16 | 22 |
| 23 |
17 namespace { | 24 namespace { |
18 | 25 |
19 void stat_to_nacl_stat(const struct stat* buf, nacl_abi_stat* nacl_buf) { | 26 void stat_to_nacl_stat(const struct stat* buf, nacl_abi_stat* nacl_buf) { |
20 memset(nacl_buf, 0, sizeof(struct nacl_abi_stat)); | 27 memset(nacl_buf, 0, sizeof(struct nacl_abi_stat)); |
21 nacl_buf->nacl_abi_st_dev = buf->st_dev; | 28 nacl_buf->nacl_abi_st_dev = buf->st_dev; |
22 nacl_buf->nacl_abi_st_ino = buf->st_ino; | 29 nacl_buf->nacl_abi_st_ino = buf->st_ino; |
23 nacl_buf->nacl_abi_st_mode = buf->st_mode; | 30 nacl_buf->nacl_abi_st_mode = buf->st_mode; |
24 nacl_buf->nacl_abi_st_nlink = buf->st_nlink; | 31 nacl_buf->nacl_abi_st_nlink = buf->st_nlink; |
25 nacl_buf->nacl_abi_st_uid = buf->st_uid; | 32 nacl_buf->nacl_abi_st_uid = buf->st_uid; |
26 nacl_buf->nacl_abi_st_gid = buf->st_gid; | 33 nacl_buf->nacl_abi_st_gid = buf->st_gid; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 DO_WRAP(getdents); | 275 DO_WRAP(getdents); |
269 DO_WRAP(mkdir); | 276 DO_WRAP(mkdir); |
270 DO_WRAP(open); | 277 DO_WRAP(open); |
271 DO_WRAP(read); | 278 DO_WRAP(read); |
272 DO_WRAP(rmdir); | 279 DO_WRAP(rmdir); |
273 DO_WRAP(seek); | 280 DO_WRAP(seek); |
274 DO_WRAP(stat); | 281 DO_WRAP(stat); |
275 DO_WRAP(write); | 282 DO_WRAP(write); |
276 } | 283 } |
277 } nacl_mounts_static_initializer; | 284 } nacl_mounts_static_initializer; |
| 285 |
| 286 #endif // defined(__native_client__) && defined(__GLIBC__) |
OLD | NEW |