| Index: native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
|
| diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h b/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
|
| index 6211e8cca44bbaf5a932070ece6c3293bd252394..d290da25bc46e40e2c39206f124aeba0f6518e02 100644
|
| --- a/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
|
| +++ b/native_client_sdk/src/libraries/nacl_io/kernel_wrap.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef LIBRARIES_NACL_IO_KERNEL_WRAP_H_
|
| #define LIBRARIES_NACL_IO_KERNEL_WRAP_H_
|
|
|
| +#include <assert.h>
|
| #include <signal.h>
|
| #include <stdint.h>
|
| #include <stdlib.h>
|
| @@ -24,6 +25,20 @@
|
| #define NOTHROW
|
| #endif
|
|
|
| +// Most kernel intercept functions (ki_*) return -1 and set the global errno.
|
| +// However, the IRT wrappers are expected to return errno on failure. These
|
| +// macros are used in the wrappers to check that the ki_ function actually
|
| +// set errno and to its value.
|
| +#define RTN_ERRNO_IF(cond) \
|
| + if (cond) { \
|
| + assert(errno != 0); \
|
| + return errno; \
|
| + }
|
| +
|
| +#define ERRNO_RTN(cond) \
|
| + RTN_ERRNO_IF(cond < 0); \
|
| + return 0;
|
| +
|
| #if defined(WIN32)
|
| typedef int chmod_mode_t;
|
| typedef int getcwd_size_t;
|
|
|