| 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 #ifndef LIBRARIES_NACL_IO_KERNEL_PROXY_H_ | 5 #ifndef LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| 6 #define LIBRARIES_NACL_IO_KERNEL_PROXY_H_ | 6 #define LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 const char* target, | 82 const char* target, |
| 83 const char* filesystemtype, | 83 const char* filesystemtype, |
| 84 unsigned long mountflags, | 84 unsigned long mountflags, |
| 85 const void* data); | 85 const void* data); |
| 86 virtual int umount(const char* path); | 86 virtual int umount(const char* path); |
| 87 | 87 |
| 88 // Stub system calls that don't do anything (yet), handled by KernelProxy. | 88 // Stub system calls that don't do anything (yet), handled by KernelProxy. |
| 89 virtual int chown(const char* path, uid_t owner, gid_t group); | 89 virtual int chown(const char* path, uid_t owner, gid_t group); |
| 90 virtual int fchown(int fd, uid_t owner, gid_t group); | 90 virtual int fchown(int fd, uid_t owner, gid_t group); |
| 91 virtual int lchown(const char* path, uid_t owner, gid_t group); | 91 virtual int lchown(const char* path, uid_t owner, gid_t group); |
| 92 virtual int utime(const char* filename, const struct utimbuf* times); | |
| 93 | 92 |
| 94 // System calls that take a path as an argument: The kernel proxy will look | 93 // System calls that take a path as an argument: The kernel proxy will look |
| 95 // for the Node associated to the path. To find the node, the kernel proxy | 94 // for the Node associated to the path. To find the node, the kernel proxy |
| 96 // calls the corresponding filesystem's GetNode() method. The corresponding | 95 // calls the corresponding filesystem's GetNode() method. The corresponding |
| 97 // method will be called. If the node cannot be found, errno is set and -1 is | 96 // method will be called. If the node cannot be found, errno is set and -1 is |
| 98 // returned. | 97 // returned. |
| 99 virtual int chmod(const char* path, mode_t mode); | 98 virtual int chmod(const char* path, mode_t mode); |
| 100 virtual int mkdir(const char* path, mode_t mode); | 99 virtual int mkdir(const char* path, mode_t mode); |
| 101 virtual int rmdir(const char* path); | 100 virtual int rmdir(const char* path); |
| 102 virtual int stat(const char* path, struct stat* buf); | 101 virtual int stat(const char* path, struct stat* buf); |
| 103 | 102 |
| 104 // System calls that take a file descriptor as an argument: | 103 // System calls that take a file descriptor as an argument: |
| 105 // The kernel proxy will determine to which filesystem the file | 104 // The kernel proxy will determine to which filesystem the file |
| 106 // descriptor's corresponding file handle belongs. The | 105 // descriptor's corresponding file handle belongs. The |
| 107 // associated filesystem's function will be called. | 106 // associated filesystem's function will be called. |
| 108 virtual ssize_t read(int fd, void* buf, size_t nbyte); | 107 virtual ssize_t read(int fd, void* buf, size_t nbyte); |
| 109 virtual ssize_t write(int fd, const void* buf, size_t nbyte); | 108 virtual ssize_t write(int fd, const void* buf, size_t nbyte); |
| 110 | 109 |
| 111 virtual int fchmod(int fd, int prot); | 110 virtual int fchmod(int fd, int prot); |
| 112 virtual int fcntl(int fd, int request, va_list args); | 111 virtual int fcntl(int fd, int request, va_list args); |
| 113 virtual int fstat(int fd, struct stat* buf); | 112 virtual int fstat(int fd, struct stat* buf); |
| 114 virtual int getdents(int fd, void* buf, unsigned int count); | 113 virtual int getdents(int fd, void* buf, unsigned int count); |
| 115 virtual int fchdir(int fd); | 114 virtual int fchdir(int fd); |
| 116 virtual int ftruncate(int fd, off_t length); | 115 virtual int ftruncate(int fd, off_t length); |
| 117 virtual int fsync(int fd); | 116 virtual int fsync(int fd); |
| 118 virtual int fdatasync(int fd); | 117 virtual int fdatasync(int fd); |
| 119 virtual int isatty(int fd); | 118 virtual int isatty(int fd); |
| 120 virtual int ioctl(int fd, int request, va_list args); | 119 virtual int ioctl(int fd, int request, va_list args); |
| 120 virtual int futimens(int fd, const struct timespec times[2]); |
| 121 | 121 |
| 122 // lseek() relies on the filesystem's Stat() to determine whether or not the | 122 // lseek() relies on the filesystem's Stat() to determine whether or not the |
| 123 // file handle corresponding to fd is a directory | 123 // file handle corresponding to fd is a directory |
| 124 virtual off_t lseek(int fd, off_t offset, int whence); | 124 virtual off_t lseek(int fd, off_t offset, int whence); |
| 125 | 125 |
| 126 // remove() uses the filesystem's GetNode() and Stat() to determine whether | 126 // remove() uses the filesystem's GetNode() and Stat() to determine whether |
| 127 // or not the path corresponds to a directory or a file. The filesystem's | 127 // or not the path corresponds to a directory or a file. The filesystem's |
| 128 // Rmdir() or Unlink() is called accordingly. | 128 // Rmdir() or Unlink() is called accordingly. |
| 129 virtual int remove(const char* path); | 129 virtual int remove(const char* path); |
| 130 // unlink() is a simple wrapper around the filesystem's Unlink function. | 130 // unlink() is a simple wrapper around the filesystem's Unlink function. |
| 131 virtual int unlink(const char* path); | 131 virtual int unlink(const char* path); |
| 132 virtual int truncate(const char* path, off_t len); | 132 virtual int truncate(const char* path, off_t len); |
| 133 virtual int lstat(const char* path, struct stat* buf); | 133 virtual int lstat(const char* path, struct stat* buf); |
| 134 virtual int rename(const char* path, const char* newpath); | 134 virtual int rename(const char* path, const char* newpath); |
| 135 // access() uses the Filesystem's Stat(). | 135 // access() uses the Filesystem's Stat(). |
| 136 virtual int access(const char* path, int amode); | 136 virtual int access(const char* path, int amode); |
| 137 virtual int readlink(const char* path, char* buf, size_t count); | 137 virtual int readlink(const char* path, char* buf, size_t count); |
| 138 virtual int utimes(const char* filename, const struct timeval times[2]); | 138 virtual int utimens(const char* path, const struct timespec times[2]); |
| 139 | 139 |
| 140 virtual int link(const char* oldpath, const char* newpath); | 140 virtual int link(const char* oldpath, const char* newpath); |
| 141 virtual int symlink(const char* oldpath, const char* newpath); | 141 virtual int symlink(const char* oldpath, const char* newpath); |
| 142 | 142 |
| 143 virtual void* mmap(void* addr, | 143 virtual void* mmap(void* addr, |
| 144 size_t length, | 144 size_t length, |
| 145 int prot, | 145 int prot, |
| 146 int flags, | 146 int flags, |
| 147 int fd, | 147 int fd, |
| 148 size_t offset); | 148 size_t offset); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 virtual int AcquireSocketHandle(int fd, ScopedKernelHandle* handle); | 249 virtual int AcquireSocketHandle(int fd, ScopedKernelHandle* handle); |
| 250 #endif | 250 #endif |
| 251 | 251 |
| 252 ScopedEventEmitter signal_emitter_; | 252 ScopedEventEmitter signal_emitter_; |
| 253 DISALLOW_COPY_AND_ASSIGN(KernelProxy); | 253 DISALLOW_COPY_AND_ASSIGN(KernelProxy); |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 } // namespace nacl_io | 256 } // namespace nacl_io |
| 257 | 257 |
| 258 #endif // LIBRARIES_NACL_IO_KERNEL_PROXY_H_ | 258 #endif // LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| OLD | NEW |