Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / native_client / src / trusted / service_runtime / win / nacl_syscall_inl.h
1 /*
2  * Copyright (c) 2012 The Native Client Authors. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6
7 /*
8  * NaCl service runtime syscall inline header file.
9  */
10
11 #ifndef NATIVE_CLIENT_SERVICE_RUNTIME_WIN_NACL_SYSCALL_INL_H_
12 #define NATIVE_CLIENT_SERVICE_RUNTIME_WIN_NACL_SYSCALL_INL_H_
13
14 /*
15  * Syscall return value mapper.  The posix wrappers in windows return
16  * -1 on error, store the error code in the thread-specific errno
17  * variable, and return -1 instead.  Since we are using these
18  * wrappers, we merely detect when any host OS syscall returned -1,
19  * and pass -errno back to the NaCl app.  (The syscall wrappers on the
20  * NaCl app side will similarly follow the negative-values-are-errors
21  * convention).
22  */
23 static INLINE intptr_t NaClXlateSysRet(intptr_t rv) {
24   return (rv != -1) ? rv : -NaClXlateErrno(errno);
25 }
26
27 #endif