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.
8 * NaCl service runtime syscall inline header file.
11 #ifndef NATIVE_CLIENT_SERVICE_RUNTIME_WIN_NACL_SYSCALL_INL_H_
12 #define NATIVE_CLIENT_SERVICE_RUNTIME_WIN_NACL_SYSCALL_INL_H_
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
23 static INLINE intptr_t NaClXlateSysRet(intptr_t rv) {
24 return (rv != -1) ? rv : -NaClXlateErrno(errno);