1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // The Chromium build system defines __linux__ even for native client builds,
6 // so guard against __native_client__ being defined as well.
7 #if defined(WIN32) || (defined(__linux__) && !defined(__native_client__))
11 #include "nacl_io/kernel_wrap.h"
12 #include "nacl_io/kernel_wrap_real.h"
14 // "real" functions, i.e. the unwrapped original functions. For Windows/Linux
15 // host builds we don't wrap, so the real functions aren't accessible. In most
16 // cases, we just fail.
18 int _real_close(int fd) {
22 int _real_fstat(int fd, struct stat *buf) {
26 int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t *nread) {
30 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) {
34 int _real_mkdir(const char* pathname, mode_t mode) {
38 int _real_mmap(void** addr, size_t length, int prot, int flags, int fd,
43 int _real_munmap(void* addr, size_t length) {
47 int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) {
51 int _real_open_resource(const char* file, int* fd) {
55 int _real_read(int fd, void *buf, size_t count, size_t *nread) {
60 int _real_rmdir(const char* pathname) {
64 int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) {
65 int rtn = write(fd, buf, count);
73 void _real_exit(int status) {
79 // The Chromium build system defines __linux__ even for native client builds,
80 // so guard against __native_client__ being defined as well.
81 #if defined(__linux__) && !defined(__native_client__)
83 void kernel_wrap_init() {
86 void kernel_wrap_uninit() {