Chromium Code Reviews| 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_WRAP_H_ | 5 #ifndef LIBRARIES_NACL_IO_KERNEL_WRAP_H_ |
| 6 #define LIBRARIES_NACL_IO_KERNEL_WRAP_H_ | 6 #define LIBRARIES_NACL_IO_KERNEL_WRAP_H_ |
| 7 | 7 |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 #include <signal.h> | 9 #include <signal.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 #include <stdlib.h> | 11 #include <stdlib.h> |
| 12 #include <sys/fcntl.h> | 12 #include <sys/fcntl.h> |
| 13 #include <sys/ioctl.h> | 13 #include <sys/ioctl.h> |
| 14 #include <sys/types.h> | 14 #include <sys/types.h> |
| 15 | 15 |
| 16 #include "nacl_io/ossocket.h" | 16 #include "nacl_io/ossocket.h" |
| 17 #include "nacl_io/ostypes.h" | 17 #include "nacl_io/ostypes.h" |
| 18 #include "nacl_io/osutime.h" | 18 #include "nacl_io/osutime.h" |
| 19 #include "sdk_util/macros.h" | 19 #include "sdk_util/macros.h" |
| 20 | 20 |
| 21 // Curently enable NaCl IO IRT Extension when using newlib | |
| 22 #if defined(__native_client__) && !defined(__GLIBC__) && !defined(__BIONIC__) | |
|
Sam Clegg
2014/09/30 20:49:03
You can check for _NEWLIB_VERSION I think
David Yen
2014/09/30 21:37:36
Done.
| |
| 23 # define __NACL_IO_IRT_EXT__ 1 | |
|
Sam Clegg
2014/09/30 20:49:03
Done use __ prefix and suffix. IIUC such macros
David Yen
2014/09/30 21:37:36
Done.
| |
| 24 #endif | |
| 25 | |
| 21 #if defined(__GLIBC__) | 26 #if defined(__GLIBC__) |
| 22 #include <sys/cdefs.h> | 27 #include <sys/cdefs.h> |
| 23 #define NOTHROW __THROW | 28 #define NOTHROW __THROW |
| 24 #else | 29 #else |
| 25 #define NOTHROW | 30 #define NOTHROW |
| 26 #endif | 31 #endif |
| 27 | 32 |
| 28 // Most kernel intercept functions (ki_*) return -1 and set the global errno. | 33 // Most kernel intercept functions (ki_*) return -1 and set the global errno. |
| 29 // However, the IRT wrappers are expected to return errno on failure. These | 34 // However, the IRT wrappers are expected to return errno on failure. These |
| 30 // macros are used in the wrappers to check that the ki_ function actually | 35 // macros are used in the wrappers to check that the ki_ function actually |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 ssize_t sendmsg(int fd, const struct msghdr* msg, int flags); | 152 ssize_t sendmsg(int fd, const struct msghdr* msg, int flags); |
| 148 int setsockopt(int fd, int lvl, int optname, const void* optval, socklen_t len); | 153 int setsockopt(int fd, int lvl, int optname, const void* optval, socklen_t len); |
| 149 int shutdown(int fd, int how); | 154 int shutdown(int fd, int how); |
| 150 int socket(int domain, int type, int protocol); | 155 int socket(int domain, int type, int protocol); |
| 151 int socketpair(int domain, int type, int protocl, int* sv); | 156 int socketpair(int domain, int type, int protocl, int* sv); |
| 152 #endif // PROVIDES_SOCKET_API | 157 #endif // PROVIDES_SOCKET_API |
| 153 | 158 |
| 154 EXTERN_C_END | 159 EXTERN_C_END |
| 155 | 160 |
| 156 #endif // LIBRARIES_NACL_IO_KERNEL_WRAP_H_ | 161 #endif // LIBRARIES_NACL_IO_KERNEL_WRAP_H_ |
| OLD | NEW |