VirtualBox

source: vbox/trunk/src/VBox/Runtime/darwin/RTErrConvertFromDarwinKern.cpp@ 5606

Last change on this file since 5606 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1/* $Id $ */
2/** @file
3 * innotek Portable Runtime - Convert Darwin Mach returns codes to iprt status codes.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#include <mach/kern_return.h>
22
23#include <iprt/err.h>
24#include <iprt/assert.h>
25
26
27RTDECL(int) RTErrConvertFromDarwinKern(int iNativeCode)
28{
29 /*
30 * 'optimzied' success case.
31 */
32 if (iNativeCode == KERN_SUCCESS)
33 return VINF_SUCCESS;
34
35 switch (iNativeCode)
36 {
37 case KERN_INVALID_ADDRESS: return VERR_INVALID_POINTER;
38 //case KERN_PROTECTION_FAILURE:
39 //case KERN_NO_SPACE:
40 case KERN_INVALID_ARGUMENT: return VERR_INVALID_PARAMETER;
41 //case KERN_FAILURE:
42 //case KERN_RESOURCE_SHORTAGE:
43 //case KERN_NOT_RECEIVER:
44 case KERN_NO_ACCESS: return VERR_ACCESS_DENIED;
45 //case KERN_MEMORY_FAILURE:
46 //case KERN_MEMORY_ERROR:
47 //case KERN_ALREADY_IN_SET:
48 //case KERN_NOT_IN_SET:
49 //case KERN_NAME_EXISTS:
50 //case KERN_ABORTED:
51 //case KERN_INVALID_NAME:
52 //case KERN_INVALID_TASK:
53 //case KERN_INVALID_RIGHT:
54 //case KERN_INVALID_VALUE:
55 //case KERN_UREFS_OVERFLOW:
56 //case KERN_INVALID_CAPABILITY:
57 //case KERN_RIGHT_EXISTS:
58 //case KERN_INVALID_HOST:
59 //case KERN_MEMORY_PRESENT:
60 //case KERN_MEMORY_DATA_MOVED:
61 //case KERN_MEMORY_RESTART_COPY:
62 //case KERN_INVALID_PROCESSOR_SET:
63 //case KERN_POLICY_LIMIT:
64 //case KERN_INVALID_POLICY:
65 //case KERN_INVALID_OBJECT:
66 //case KERN_ALREADY_WAITING:
67 //case KERN_DEFAULT_SET:
68 //case KERN_EXCEPTION_PROTECTED:
69 //case KERN_INVALID_LEDGER:
70 //case KERN_INVALID_MEMORY_CONTROL:
71 //case KERN_INVALID_SECURITY:
72 //case KERN_NOT_DEPRESSED:
73 //case KERN_TERMINATED:
74 //case KERN_LOCK_SET_DESTROYED:
75 //case KERN_LOCK_UNSTABLE:
76 case KERN_LOCK_OWNED: return VERR_SEM_BUSY;
77 //case KERN_LOCK_OWNED_SELF:
78 case KERN_SEMAPHORE_DESTROYED: return VERR_SEM_DESTROYED;
79 //case KERN_RPC_SERVER_TERMINATED:
80 //case KERN_RPC_TERMINATE_ORPHAN:
81 //case KERN_RPC_CONTINUE_ORPHAN:
82 case KERN_NOT_SUPPORTED: return VERR_NOT_SUPPORTED;
83 //case KERN_NODE_DOWN:
84 //case KERN_NOT_WAITING:
85 case KERN_OPERATION_TIMED_OUT: return VERR_TIMEOUT;
86 }
87
88 /* unknown error. */
89 AssertMsgFailed(("Unhandled error %#x\n", iNativeCode));
90 return VERR_UNRESOLVED_ERROR;
91}
92
93
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette