mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
kern return as an enum
This commit is contained in:
+227
-225
@@ -31,18 +31,18 @@ mach_port_name_t :: distinct c.uint
|
|||||||
foreign mach {
|
foreign mach {
|
||||||
mach_task_self :: proc() -> mach_port_t ---
|
mach_task_self :: proc() -> mach_port_t ---
|
||||||
|
|
||||||
semaphore_create :: proc(task: task_t, semaphore: ^semaphore_t, policy, value: c.int) -> kern_return_t ---
|
semaphore_create :: proc(task: task_t, semaphore: ^semaphore_t, policy, value: c.int) -> Kern_Return ---
|
||||||
semaphore_destroy :: proc(task: task_t, semaphore: semaphore_t) -> kern_return_t ---
|
semaphore_destroy :: proc(task: task_t, semaphore: semaphore_t) -> Kern_Return ---
|
||||||
|
|
||||||
semaphore_signal :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
semaphore_signal :: proc(semaphore: semaphore_t) -> Kern_Return ---
|
||||||
semaphore_signal_all :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
semaphore_signal_all :: proc(semaphore: semaphore_t) -> Kern_Return ---
|
||||||
semaphore_signal_thread :: proc(semaphore: semaphore_t, thread: thread_t) -> kern_return_t ---
|
semaphore_signal_thread :: proc(semaphore: semaphore_t, thread: thread_t) -> Kern_Return ---
|
||||||
|
|
||||||
semaphore_wait :: proc(semaphore: semaphore_t) -> kern_return_t ---
|
semaphore_wait :: proc(semaphore: semaphore_t) -> Kern_Return ---
|
||||||
|
|
||||||
vm_allocate :: proc (target_task : vm_map_t, address: ^vm_address_t, size: vm_size_t, flags: c.int,) -> kern_return_t ---
|
vm_allocate :: proc (target_task : vm_map_t, address: ^vm_address_t, size: vm_size_t, flags: c.int,) -> Kern_Return ---
|
||||||
|
|
||||||
vm_deallocate :: proc(target_task: vm_map_t, address: vm_address_t, size: vm_size_t) -> kern_return_t---
|
vm_deallocate :: proc(target_task: vm_map_t, address: vm_address_t, size: vm_size_t) -> Kern_Return ---
|
||||||
|
|
||||||
vm_map :: proc (
|
vm_map :: proc (
|
||||||
target_task : vm_map_t,
|
target_task : vm_map_t,
|
||||||
@@ -56,7 +56,7 @@ foreign mach {
|
|||||||
cur_protection,
|
cur_protection,
|
||||||
max_protection : vm_prot_t,
|
max_protection : vm_prot_t,
|
||||||
inheritance : vm_inherit_t,
|
inheritance : vm_inherit_t,
|
||||||
) -> kern_return_t ---
|
) -> Kern_Return ---
|
||||||
|
|
||||||
mach_make_memory_entry :: proc (
|
mach_make_memory_entry :: proc (
|
||||||
target_task : vm_map_t,
|
target_task : vm_map_t,
|
||||||
@@ -65,287 +65,289 @@ foreign mach {
|
|||||||
permission : vm_prot_t,
|
permission : vm_prot_t,
|
||||||
object_handle : ^mem_entry_name_port_t,
|
object_handle : ^mem_entry_name_port_t,
|
||||||
parent_entry : mem_entry_name_port_t,
|
parent_entry : mem_entry_name_port_t,
|
||||||
) -> kern_return_t ---
|
) -> Kern_Return ---
|
||||||
|
|
||||||
mach_port_deallocate :: proc (
|
mach_port_deallocate :: proc (
|
||||||
task: ipc_space_t,
|
task: ipc_space_t,
|
||||||
name: mach_port_name_t,
|
name: mach_port_name_t,
|
||||||
) -> kern_return_t ---
|
) -> Kern_Return ---
|
||||||
|
|
||||||
vm_page_size : vm_size_t
|
vm_page_size : vm_size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
KERN_SUCCESS : kern_return_t : 0
|
Kern_Return :: enum kern_return_t {
|
||||||
|
Success,
|
||||||
|
|
||||||
KERN_INVALID_ADDRESS : kern_return_t : 1
|
Invalid_Address,
|
||||||
/* Specified address is not currently valid.
|
/* Specified address is not currently valid.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_PROTECTION_FAILURE : kern_return_t : 2
|
Protection_Failure,
|
||||||
/* Specified memory is valid, but does not permit the
|
/* Specified memory is valid, but does not permit the
|
||||||
* required forms of access.
|
* required forms of access.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NO_SPACE : kern_return_t : 3
|
No_Space,
|
||||||
/* The address range specified is already in use, or
|
/* The address range specified is already in use, or
|
||||||
* no address range of the size specified could be
|
* no address range of the size specified could be
|
||||||
* found.
|
* found.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_ARGUMENT : kern_return_t : 4
|
Invalid_Argument,
|
||||||
/* The function requested was not applicable to this
|
/* The function requested was not applicable to this
|
||||||
* type of argument, or an argument is invalid
|
* type of argument, or an argument is invalid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_FAILURE : kern_return_t : 5
|
Failure,
|
||||||
/* The function could not be performed. A catch-all.
|
/* The function could not be performed. A catch-all.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_RESOURCE_SHORTAGE : kern_return_t : 6
|
Resource_Shortage,
|
||||||
/* A system resource could not be allocated to fulfill
|
/* A system resource could not be allocated to fulfill
|
||||||
* this request. This failure may not be permanent.
|
* this request. This failure may not be permanent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NOT_RECEIVER : kern_return_t : 7
|
Not_Receiver,
|
||||||
/* The task in question does not hold receive rights
|
/* The task in question does not hold receive rights
|
||||||
* for the port argument.
|
* for the port argument.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NO_ACCESS : kern_return_t : 8
|
No_Access,
|
||||||
/* Bogus access restriction.
|
/* Bogus access restriction.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_MEMORY_FAILURE : kern_return_t : 9
|
Memory_Failure,
|
||||||
/* During a page fault, the target address refers to a
|
/* During a page fault, the target address refers to a
|
||||||
* memory object that has been destroyed. This
|
* memory object that has been destroyed. This
|
||||||
* failure is permanent.
|
* failure is permanent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_MEMORY_ERROR : kern_return_t : 10
|
Memory_Error,
|
||||||
/* During a page fault, the memory object indicated
|
/* During a page fault, the memory object indicated
|
||||||
* that the data could not be returned. This failure
|
* that the data could not be returned. This failure
|
||||||
* may be temporary; future attempts to access this
|
* may be temporary; future attempts to access this
|
||||||
* same data may succeed, as defined by the memory
|
* same data may succeed, as defined by the memory
|
||||||
* object.
|
* object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_ALREADY_IN_SET : kern_return_t : 11
|
Already_In_Set,
|
||||||
/* The receive right is already a member of the portset.
|
/* The receive right is already a member of the portset.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NOT_IN_SET : kern_return_t : 12
|
Not_In_Set,
|
||||||
/* The receive right is not a member of a port set.
|
/* The receive right is not a member of a port set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NAME_EXISTS : kern_return_t : 13
|
Name_Exists,
|
||||||
/* The name already denotes a right in the task.
|
/* The name already denotes a right in the task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_ABORTED : kern_return_t : 14
|
Aborted,
|
||||||
/* The operation was aborted. Ipc code will
|
/* The operation was aborted. Ipc code will
|
||||||
* catch this and reflect it as a message error.
|
* catch this and reflect it as a message error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_NAME : kern_return_t : 15
|
Invalid_Name,
|
||||||
/* The name doesn't denote a right in the task.
|
/* The name doesn't denote a right in the task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_TASK : kern_return_t : 16
|
Invalid_Task,
|
||||||
/* Target task isn't an active task.
|
/* Target task isn't an active task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_RIGHT : kern_return_t : 17
|
Invalid_Right,
|
||||||
/* The name denotes a right, but not an appropriate right.
|
/* The name denotes a right, but not an appropriate right.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_VALUE : kern_return_t : 18
|
Invalid_Value,
|
||||||
/* A blatant range error.
|
/* A blatant range error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_UREFS_OVERFLOW : kern_return_t : 19
|
URefs_Overflow,
|
||||||
/* Operation would overflow limit on user-references.
|
/* Operation would overflow limit on user-references.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_CAPABILITY : kern_return_t : 20
|
Invalid_Capability,
|
||||||
/* The supplied (port) capability is improper.
|
/* The supplied (port) capability is improper.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_RIGHT_EXISTS : kern_return_t : 21
|
Right_Exists,
|
||||||
/* The task already has send or receive rights
|
/* The task already has send or receive rights
|
||||||
* for the port under another name.
|
* for the port under another name.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_HOST : kern_return_t : 22
|
Invalid_Host,
|
||||||
/* Target host isn't actually a host.
|
/* Target host isn't actually a host.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_MEMORY_PRESENT : kern_return_t : 23
|
Memory_Present,
|
||||||
/* An attempt was made to supply "precious" data
|
/* An attempt was made to supply "precious" data
|
||||||
* for memory that is already present in a
|
* for memory that is already present in a
|
||||||
* memory object.
|
* memory object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_MEMORY_DATA_MOVED : kern_return_t : 24
|
Memory_Data_Moved,
|
||||||
/* A page was requested of a memory manager via
|
/* A page was requested of a memory manager via
|
||||||
* memory_object_data_request for an object using
|
* memory_object_data_request for an object using
|
||||||
* a MEMORY_OBJECT_COPY_CALL strategy, with the
|
* a MEMORY_OBJECT_COPY_CALL strategy, with the
|
||||||
* VM_PROT_WANTS_COPY flag being used to specify
|
* VM_PROT_WANTS_COPY flag being used to specify
|
||||||
* that the page desired is for a copy of the
|
* that the page desired is for a copy of the
|
||||||
* object, and the memory manager has detected
|
* object, and the memory manager has detected
|
||||||
* the page was pushed into a copy of the object
|
* the page was pushed into a copy of the object
|
||||||
* while the kernel was walking the shadow chain
|
* while the kernel was walking the shadow chain
|
||||||
* from the copy to the object. This error code
|
* from the copy to the object. This error code
|
||||||
* is delivered via memory_object_data_error
|
* is delivered via memory_object_data_error
|
||||||
* and is handled by the kernel (it forces the
|
* and is handled by the kernel (it forces the
|
||||||
* kernel to restart the fault). It will not be
|
* kernel to restart the fault). It will not be
|
||||||
* seen by users.
|
* seen by users.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_MEMORY_RESTART_COPY : kern_return_t : 25
|
Memory_Restart_Copy,
|
||||||
/* A strategic copy was attempted of an object
|
/* A strategic copy was attempted of an object
|
||||||
* upon which a quicker copy is now possible.
|
* upon which a quicker copy is now possible.
|
||||||
* The caller should retry the copy using
|
* The caller should retry the copy using
|
||||||
* vm_object_copy_quickly. This error code
|
* vm_object_copy_quickly. This error code
|
||||||
* is seen only by the kernel.
|
* is seen only by the kernel.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_PROCESSOR_SET : kern_return_t : 26
|
Invalid_Processor_Set,
|
||||||
/* An argument applied to assert processor set privilege
|
/* An argument applied to assert processor set privilege
|
||||||
* was not a processor set control port.
|
* was not a processor set control port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_POLICY_LIMIT : kern_return_t : 27
|
Policy_Limit,
|
||||||
/* The specified scheduling attributes exceed the thread's
|
/* The specified scheduling attributes exceed the thread's
|
||||||
* limits.
|
* limits.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_POLICY : kern_return_t : 28
|
Invalid_Policy,
|
||||||
/* The specified scheduling policy is not currently
|
/* The specified scheduling policy is not currently
|
||||||
* enabled for the processor set.
|
* enabled for the processor set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_OBJECT : kern_return_t : 29
|
Invalid_Object,
|
||||||
/* The external memory manager failed to initialize the
|
/* The external memory manager failed to initialize the
|
||||||
* memory object.
|
* memory object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_ALREADY_WAITING : kern_return_t : 30
|
Already_Waiting,
|
||||||
/* A thread is attempting to wait for an event for which
|
/* A thread is attempting to wait for an event for which
|
||||||
* there is already a waiting thread.
|
* there is already a waiting thread.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_DEFAULT_SET : kern_return_t : 31
|
Default_Set,
|
||||||
/* An attempt was made to destroy the default processor
|
/* An attempt was made to destroy the default processor
|
||||||
* set.
|
* set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_EXCEPTION_PROTECTED : kern_return_t : 32
|
Exception_Protected,
|
||||||
/* An attempt was made to fetch an exception port that is
|
/* An attempt was made to fetch an exception port that is
|
||||||
* protected, or to abort a thread while processing a
|
* protected, or to abort a thread while processing a
|
||||||
* protected exception.
|
* protected exception.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_LEDGER : kern_return_t : 33
|
Invalid_Ledger,
|
||||||
/* A ledger was required but not supplied.
|
/* A ledger was required but not supplied.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_MEMORY_CONTROL : kern_return_t : 34
|
Invalid_Memory_Control,
|
||||||
/* The port was not a memory cache control port.
|
/* The port was not a memory cache control port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_SECURITY : kern_return_t : 35
|
Invalid_Security,
|
||||||
/* An argument supplied to assert security privilege
|
/* An argument supplied to assert security privilege
|
||||||
* was not a host security port.
|
* was not a host security port.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NOT_DEPRESSED : kern_return_t : 36
|
Not_Depressed,
|
||||||
/* thread_depress_abort was called on a thread which
|
/* thread_depress_abort was called on a thread which
|
||||||
* was not currently depressed.
|
* was not currently depressed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_TERMINATED : kern_return_t : 37
|
Terminated,
|
||||||
/* Object has been terminated and is no longer available
|
/* Object has been terminated and is no longer available
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_LOCK_SET_DESTROYED : kern_return_t : 38
|
Lock_Set_Destroyed,
|
||||||
/* Lock set has been destroyed and is no longer available.
|
/* Lock set has been destroyed and is no longer available.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_LOCK_UNSTABLE : kern_return_t : 39
|
Lock_Unstable,
|
||||||
/* The thread holding the lock terminated before releasing
|
/* The thread holding the lock terminated before releasing
|
||||||
* the lock
|
* the lock
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_LOCK_OWNED : kern_return_t : 40
|
Lock_Owned,
|
||||||
/* The lock is already owned by another thread
|
/* The lock is already owned by another thread
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_LOCK_OWNED_SELF : kern_return_t : 41
|
Lock_Owned_Self,
|
||||||
/* The lock is already owned by the calling thread
|
/* The lock is already owned by the calling thread
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_SEMAPHORE_DESTROYED : kern_return_t : 42
|
Semaphore_Destroyed,
|
||||||
/* Semaphore has been destroyed and is no longer available.
|
/* Semaphore has been destroyed and is no longer available.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_RPC_SERVER_TERMINATED : kern_return_t : 43
|
Rpc_Server_Terminated,
|
||||||
/* Return from RPC indicating the target server was
|
/* Return from RPC indicating the target server was
|
||||||
* terminated before it successfully replied
|
* terminated before it successfully replied
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_RPC_TERMINATE_ORPHAN : kern_return_t : 44
|
RPC_Terminate_Orphan,
|
||||||
/* Terminate an orphaned activation.
|
/* Terminate an orphaned activation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_RPC_CONTINUE_ORPHAN : kern_return_t : 45
|
RPC_Continue_Orphan,
|
||||||
/* Allow an orphaned activation to continue executing.
|
/* Allow an orphaned activation to continue executing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NOT_SUPPORTED : kern_return_t : 46
|
Not_Supported,
|
||||||
/* Empty thread activation (No thread linked to it)
|
/* Empty thread activation (No thread linked to it)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NODE_DOWN : kern_return_t : 47
|
Node_Down,
|
||||||
/* Remote node down or inaccessible.
|
/* Remote node down or inaccessible.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NOT_WAITING : kern_return_t : 48
|
Not_Waiting,
|
||||||
/* A signalled thread was not actually waiting. */
|
/* A signalled thread was not actually waiting. */
|
||||||
|
|
||||||
KERN_OPERATION_TIMED_OUT : kern_return_t : 49
|
Operation_Timed_Out,
|
||||||
/* Some thread-oriented operation (semaphore_wait) timed out
|
/* Some thread-oriented operation (semaphore_wait) timed out
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_CODESIGN_ERROR : kern_return_t : 50
|
Codesign_Error,
|
||||||
/* During a page fault, indicates that the page was rejected
|
/* During a page fault, indicates that the page was rejected
|
||||||
* as a result of a signature check.
|
* as a result of a signature check.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_POLICY_STATIC : kern_return_t : 51
|
Policy_Static,
|
||||||
/* The requested property cannot be changed at this time.
|
/* The requested property cannot be changed at this time.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INSUFFICIENT_BUFFER_SIZE : kern_return_t : 52
|
Insufficient_Buffer_Size,
|
||||||
/* The provided buffer is of insufficient size for the requested data.
|
/* The provided buffer is of insufficient size for the requested data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_DENIED : kern_return_t : 53
|
Denied,
|
||||||
/* Denied by security policy
|
/* Denied by security policy
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_MISSING_KC : kern_return_t : 54
|
Missing_KC,
|
||||||
/* The KC on which the function is operating is missing
|
/* The KC on which the function is operating is missing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_INVALID_KC : kern_return_t : 55
|
Invalid_KC,
|
||||||
/* The KC on which the function is operating is invalid
|
/* The KC on which the function is operating is invalid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_NOT_FOUND : kern_return_t : 56
|
Not_Found,
|
||||||
/* A search or query operation did not return a result
|
/* A search or query operation did not return a result
|
||||||
*/
|
*/
|
||||||
|
|
||||||
KERN_RETURN_MAX : kern_return_t : 0x100
|
Return_Max = 0x100,
|
||||||
|
}
|
||||||
|
|
||||||
/* Maximum return value allowable
|
/* Maximum return value allowable
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user