Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_wrap_dummy.cc

Issue 73083005: [NaCl SDK] Enable linux host build for nacl_io and nacl_io_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #if defined(WIN32) || defined(__linux__)
6
7 #include <errno.h>
8
9 #include "nacl_io/kernel_wrap.h"
10 #include "nacl_io/kernel_wrap_real.h"
11
12 // "real" functions, i.e. the unwrapped original functions. For Windows/Linux
13 // host builds we don't wrap, so the real functions aren't accessible. In most
14 // cases, we just fail.
15
16 int _real_close(int fd) {
17 return ENOSYS;
18 }
19
20 int _real_fstat(int fd, struct stat *buf) {
21 return 0;
22 }
23
24 int _real_getdents(int fd, void* nacl_buf, size_t nacl_count, size_t *nread) {
25 return ENOSYS;
26 }
27
28 int _real_lseek(int fd, off_t offset, int whence, off_t* new_offset) {
29 return ENOSYS;
30 }
31
32 int _real_mkdir(const char* pathname, mode_t mode) {
33 return ENOSYS;
34 }
35
36 int _real_mmap(void** addr, size_t length, int prot, int flags, int fd,
37 off_t offset) {
38 return ENOSYS;
39 }
40
41 int _real_munmap(void* addr, size_t length) {
42 return ENOSYS;
43 }
44
45 int _real_open(const char* pathname, int oflag, mode_t cmode, int* newfd) {
46 return ENOSYS;
47 }
48
49 int _real_open_resource(const char* file, int* fd) {
50 return ENOSYS;
51 }
52
53 int _real_read(int fd, void *buf, size_t count, size_t *nread) {
54 *nread = count;
55 return 0;
56 }
57
58 int _real_rmdir(const char* pathname) {
59 return ENOSYS;
60 }
61
62 int _real_write(int fd, const void *buf, size_t count, size_t *nwrote) {
63 int rtn = write(fd, buf, count);
64 if (rtn < 0)
65 return -1;
66
67 *nwrote = rtn;
68 return 0;
69 }
70
71 #endif
72
73 #if defined(__linux__)
74
75 void kernel_wrap_init() {
76 }
77
78 void kernel_wrap_uninit() {
79 }
80
81 #endif
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/kernel_wrap.h ('k') | native_client_sdk/src/libraries/nacl_io/kernel_wrap_glibc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698