OLD | NEW |
| (Empty) |
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 | |
3 * found in the LICENSE file. | |
4 */ | |
5 #ifndef LIBRARIES_NACL_MOUNTS_KERNEL_WRAP_H_ | |
6 #define LIBRARIES_NACL_MOUNTS_KERNEL_WRAP_H_ | |
7 | |
8 #include <sys/types.h> | |
9 #include <stdlib.h> | |
10 #include "utils/macros.h" | |
11 | |
12 #if defined(__GLIBC__) | |
13 #include <sys/cdefs.h> | |
14 #define NOTHROW __THROW | |
15 #else | |
16 #define NOTHROW | |
17 #endif | |
18 | |
19 #if defined(WIN32) | |
20 typedef int chmod_mode_t; | |
21 typedef int getcwd_size_t; | |
22 typedef int read_ssize_t; | |
23 typedef int write_ssize_t; | |
24 #define NAME(x) _##x | |
25 #else | |
26 typedef mode_t chmod_mode_t; | |
27 typedef size_t getcwd_size_t; | |
28 typedef ssize_t read_ssize_t; | |
29 typedef ssize_t write_ssize_t; | |
30 #define NAME(x) x | |
31 #endif | |
32 | |
33 EXTERN_C_BEGIN | |
34 | |
35 void kernel_wrap_init(); | |
36 | |
37 int NAME(access)(const char* path, int amode) NOTHROW; | |
38 int NAME(chdir)(const char* path) NOTHROW; | |
39 int NAME(chmod)(const char* path, chmod_mode_t mode) NOTHROW; | |
40 int NAME(close)(int fd); | |
41 int NAME(dup)(int oldfd) NOTHROW; | |
42 int NAME(dup2)(int oldfd, int newfd) NOTHROW; | |
43 #if defined(WIN32) | |
44 int _fstat32(int fd, struct _stat32* buf); | |
45 int _fstat64(int fd, struct _stat64* buf); | |
46 int _fstat32i64(int fd, struct _stat32i64* buf); | |
47 int _fstat64i32(int fd, struct _stat64i32* buf); | |
48 #else | |
49 struct stat; | |
50 int fstat(int fd, struct stat* buf) NOTHROW; | |
51 #endif | |
52 int fsync(int fd); | |
53 char* NAME(getcwd)(char* buf, getcwd_size_t size) NOTHROW; | |
54 char* getwd(char* buf) NOTHROW; | |
55 int getdents(int fd, void* buf, unsigned int count) NOTHROW; | |
56 int NAME(isatty)(int fd) NOTHROW; | |
57 int link(const char* oldpath, const char* newpath) NOTHROW; | |
58 off_t NAME(lseek)(int fd, off_t offset, int whence) NOTHROW; | |
59 #if defined(WIN32) | |
60 int _mkdir(const char* path); | |
61 #else | |
62 int mkdir(const char* path, mode_t mode) NOTHROW; | |
63 #endif | |
64 int mount(const char* source, const char* target, const char* filesystemtype, | |
65 unsigned long mountflags, const void* data) NOTHROW; | |
66 int NAME(open)(const char* path, int oflag, ...); | |
67 read_ssize_t NAME(read)(int fd, void* buf, size_t nbyte); | |
68 int remove(const char* path) NOTHROW; | |
69 int NAME(rmdir)(const char* path) NOTHROW; | |
70 #if defined(WIN32) | |
71 int _stat32(const char* path, struct _stat32* buf); | |
72 int _stat64(const char* path, struct _stat64* buf); | |
73 int _stat32i64(const char* path, struct _stat32i64* buf); | |
74 int _stat64i32(const char* path, struct _stat64i32* buf); | |
75 #else | |
76 int stat(const char* path, struct stat* buf) NOTHROW; | |
77 #endif | |
78 int symlink(const char* oldpath, const char* newpath) NOTHROW; | |
79 int umount(const char* path) NOTHROW; | |
80 int NAME(unlink)(const char* path) NOTHROW; | |
81 read_ssize_t NAME(write)(int fd, const void* buf, size_t nbyte); | |
82 | |
83 EXTERN_C_END | |
84 | |
85 #endif // LIBRARIES_NACL_MOUNTS_KERNEL_WRAP_H_ | |
OLD | NEW |