github.com/go-darwin/sys@v0.0.0-20220510002607-68fd01f054ca/types_darwin_amd64.go (about)

     1  // Copyright 2021 The Go Darwin Authors
     2  // SPDX-License-Identifier: BSD-3-Clause
     3  
     4  //go:build darwin
     5  // +build darwin
     6  
     7  package sys
     8  
     9  import "unsafe"
    10  
    11  // list of common C types.
    12  type (
    13  	C_short    = c_short
    14  	C_int      = c_int
    15  	C_int8     = c_int8
    16  	C_int16    = c_int16
    17  	C_int32    = c_int32
    18  	C_int64    = c_int64
    19  	C_long     = c_long
    20  	C_longLong = c_longLong
    21  	C_uint     = c_uint
    22  	C_uint8    = c_uint8
    23  	C_uint16   = c_uint16
    24  	C_uint32   = c_uint32
    25  	C_uint64   = c_uint64
    26  	C_char     = c_char
    27  	C_float    = c_float
    28  	C_double   = c_double
    29  	C_size_t   = c_size_t
    30  )
    31  
    32  // list of common C types size.
    33  const (
    34  	Sizeof_C_short    = unsafe.Sizeof(new(c_short))
    35  	Sizeof_C_int      = unsafe.Sizeof(new(c_int))
    36  	Sizeof_C_int8     = unsafe.Sizeof(new(c_int8))
    37  	Sizeof_C_int16    = unsafe.Sizeof(new(c_int16))
    38  	Sizeof_C_int32    = unsafe.Sizeof(new(c_int32))
    39  	Sizeof_C_int64    = unsafe.Sizeof(new(c_int64))
    40  	Sizeof_C_long     = unsafe.Sizeof(new(c_long))
    41  	Sizeof_C_longLong = unsafe.Sizeof(new(c_longLong))
    42  	Sizeof_C_uint     = unsafe.Sizeof(new(c_uint))
    43  	Sizeof_C_uint8    = unsafe.Sizeof(new(c_uint8))
    44  	Sizeof_C_uint16   = unsafe.Sizeof(new(c_uint16))
    45  	Sizeof_C_uint32   = unsafe.Sizeof(new(c_uint32))
    46  	Sizeof_C_uint64   = unsafe.Sizeof(new(c_uint64))
    47  	Sizeof_C_char     = unsafe.Sizeof(new(c_char))
    48  	Sizeof_C_float    = unsafe.Sizeof(new(c_float))
    49  	Sizeof_C_double   = unsafe.Sizeof(new(c_double))
    50  )
    51  
    52  // KernReturn represents a kern_return_t.
    53  type KernReturn = kernReturn
    54  
    55  // list of KernReturn errors.
    56  const (
    57  	KernSuccess KernReturn = kernSuccess
    58  
    59  	// KernInvalidAddress specified address is not currently valid.
    60  	KernInvalidAddress KernReturn = kernInvalidAddress
    61  
    62  	// KernProtectionFailure specified memory is valid, but does not permit therequired forms of access.
    63  	KernProtectionFailure KernReturn = kernProtectionFailure
    64  
    65  	// KernNoSpace is the address range specified is already in use, or
    66  	// no address range of the size specified could be
    67  	// found.
    68  	KernNoSpace KernReturn = kernNoSpace
    69  
    70  	// KernInvalidArgument is the function requested was not applicable to this
    71  	// type of argument, or an argument is invalid.
    72  	KernInvalidArgument KernReturn = kernInvalidArgument
    73  
    74  	// KernFailure is the function could not be performed. A catch-all.
    75  	KernFailure KernReturn = kernFailure
    76  
    77  	// KernResourceShortage a system resource could not be allocated to fulfill
    78  	// this request.
    79  	// This failure may not be permanent.
    80  	KernResourceShortage KernReturn = kernResourceShortage
    81  
    82  	// KernNoAccess bogus access restriction.
    83  	KernNoAccess KernReturn = kernNoAccess
    84  
    85  	// KernNotReceiver is the task in question does not hold receive rights for the port argument.
    86  	KernNotReceiver KernReturn = kernNotReceiver
    87  
    88  	// KernMemoryFailure during a page fault, the target address refers to a memory object that has been destroyed.
    89  	// This failure is permanent.
    90  	KernMemoryFailure KernReturn = kernMemoryFailure
    91  
    92  	// kernMemoryError during a page fault, the memory object indicated
    93  	// that the data could not be returned.
    94  	// This failure may be temporary; future attempts to access this
    95  	// same data may succeed, as defined by the memory
    96  	// object.
    97  	kernMemoryError KernReturn = KernMemoryError
    98  
    99  	// KernAlreadyInSet is the receive right is already a member of the portset.
   100  	KernAlreadyInSet KernReturn = kernAlreadyInSet
   101  
   102  	// KernNotInSet is the receive right is not a member of a port set.
   103  	KernNotInSet KernReturn = kernNotInSet
   104  
   105  	// KernNameExists is the name already denotes a right in the task.
   106  	KernNameExists KernReturn = kernNameExists
   107  
   108  	// KernAborted is the operation was aborted.
   109  	// Ipc code will catch this and reflect it as a message error.
   110  	KernAborted KernReturn = kernAborted
   111  
   112  	// KernInvalidNames is the name doesn't denote a right in the task.
   113  	KernInvalidName KernReturn = kernInvalidName
   114  
   115  	// KernInvalidTask target task isn't an active task.
   116  	KernInvalidTask KernReturn = kernInvalidTask
   117  
   118  	// kernInvalidRight is the name denotes a right, but not an appropriate right.
   119  	KernInvalidRight KernReturn = kernInvalidRight
   120  
   121  	// KernInvalidValue a blatant range error.
   122  	KernInvalidValue KernReturn = kernInvalidValue
   123  
   124  	// KernUrefsOverflow operation would overflow limit on user-references.
   125  	KernUrefsOverflow KernReturn = kernUrefsOverflow
   126  
   127  	// KernInvalidCapability is the supplied (port) capability is improper.
   128  	KernInvalidCapability KernReturn = kernInvalidCapability
   129  
   130  	// KernRightExists is the task already has send or receive rights for the port under another name.
   131  	KernRightExists KernReturn = kernRightExists
   132  
   133  	// KernInvalidHost target host isn't actually a host.
   134  	KernInvalidHost KernReturn = kernInvalidHost
   135  
   136  	// KernMemoryPresent an attempt was made to supply "precious" data
   137  	// for memory that is already present in a
   138  	// memory object.
   139  	KernMemoryPresent KernReturn = kernMemoryPresent
   140  
   141  	// KernMemoryDataMoved a page was requested of a memory manager via
   142  	// memory_object_data_request for an object using
   143  	// a MEMORY_OBJECT_COPY_CALL strategy, with the
   144  	// VM_PROT_WANTS_COPY flag being used to specify
   145  	// that the page desired is for a copy of the
   146  	// object, and the memory manager has detected
   147  	// the page was pushed into a copy of the object
   148  	// while the kernel was walking the shadow chain
   149  	// from the copy to the object. This error code
   150  	// is delivered via memory_object_data_error
   151  	// and is handled by the kernel (it forces the
   152  	// kernel to restart the fault). It will not be
   153  	// seen by users.
   154  	KernMemoryDataMoved KernReturn = kernMemoryDataMoved
   155  
   156  	// KernMemoryRestartCopy a strategic copy was attempted of an object
   157  	// upon which a quicker copy is now possible.
   158  	// The caller should retry the copy using
   159  	// vm_object_copy_quickly.
   160  	//
   161  	// This error code is seen only by the kernel.
   162  	KernMemoryRestartCopy KernReturn = kernMemoryRestartCopy
   163  
   164  	// KernInvalidProcessorSet an argument applied to assert processor set privilege
   165  	// was not a processor set control port.
   166  	KernInvalidProcessorSet KernReturn = kernInvalidProcessorSet
   167  
   168  	// KernPolicyLimit is the specified scheduling attributes exceed the thread's
   169  	// limits.
   170  	KernPolicyLimit KernReturn = kernPolicyLimit
   171  
   172  	// KernInvalidPolicy is the specified scheduling policy is not currently
   173  	// enabled for the processor set.
   174  	KernInvalidPolicy KernReturn = kernInvalidPolicy
   175  
   176  	// KernInvalidObject is the external memory manager failed to initialize the
   177  	// memory object.
   178  	KernInvalidObject KernReturn = kernInvalidObject
   179  
   180  	// KernAlreadyWaiting a thread is attempting to wait for an event for which
   181  	// there is already a waiting thread.
   182  	KernAlreadyWaiting KernReturn = kernAlreadyWaiting
   183  
   184  	// KernDefaultSet an attempt was made to destroy the default processor
   185  	// set.
   186  	KernDefaultSet KernReturn = kernDefaultSet
   187  
   188  	// KernExceptionProtected an attempt was made to fetch an exception port that is
   189  	// protected, or to abort a thread while processing a
   190  	// protected exception.
   191  	KernExceptionProtected KernReturn = kernExceptionProtected
   192  
   193  	// KernInvalidLedger a ledger was required but not supplied.
   194  	KernInvalidLedger KernReturn = kernInvalidLedger
   195  
   196  	// KernInvalidMemoryControl is the port was not a memory cache control port.
   197  	KernInvalidMemoryControl KernReturn = kernInvalidMemoryControl
   198  
   199  	// KernInvalidSecurity an argument supplied to assert security privilege
   200  	// was not a host security port.
   201  	KernInvalidSecurity KernReturn = kernInvalidSecurity
   202  
   203  	// KernNotDepressed thread_depress_abort was called on a thread which
   204  	// was not currently depressed.
   205  	KernNotDepressed KernReturn = kernNotDepressed
   206  
   207  	// KernTerminated object has been terminated and is no longer available.
   208  	KernTerminated KernReturn = kernTerminated
   209  
   210  	// KernLockSetDestroyed lock set has been destroyed and is no longer available.
   211  	KernLockSetDestroyed KernReturn = kernLockSetDestroyed
   212  
   213  	// KernLockUnstable is the thread holding the lock terminated before releasing
   214  	// the lock.
   215  	KernLockUnstable KernReturn = kernLockUnstable
   216  
   217  	// KernLockOwned is the lock is already owned by another thread.
   218  	KernLockOwned KernReturn = kernLockUnstable
   219  
   220  	// KernLockOwnedSelf is the lock is already owned by the calling thread.
   221  	KernLockOwnedSelf KernReturn = kernLockOwnedSelf
   222  
   223  	// KernSemaphoreDestroyed semaphore has been destroyed and is no longer available.
   224  	KernSemaphoreDestroyed KernReturn = kernSemaphoreDestroyed
   225  
   226  	// KernRPCServerTerminated return from RPC indicating the target server was
   227  	// terminated before it successfully replied.
   228  	KernRPCServerTerminated KernReturn = kernRPCServerTerminated
   229  
   230  	// KernRPCTerminateOrphan terminate an orphaned activation.
   231  	KernRPCTerminateOrphan KernReturn = kernRPCTerminateOrphan
   232  
   233  	// KernRPCContinueOrphan allow an orphaned activation to continue executing.
   234  	KernRPCContinueOrphan KernReturn = kernRPCContinueOrphan
   235  
   236  	// KernNotSupported empty thread activation (No thread linked to it).
   237  	KernNotSupported KernReturn = kernRPCContinueOrphan
   238  
   239  	// KernNodeDown remote node down or inaccessible.
   240  	KernNodeDown KernReturn = kernNodeDown
   241  
   242  	// KernNotWaiting a signalled thread was not actually waiting.
   243  	KernNotWaiting KernReturn = kernNotWaiting
   244  
   245  	// KernOperationTimedOut some thread-oriented operation (semaphore_wait) timed out.
   246  	KernOperationTimedOut KernReturn = kernOperationTimedOut
   247  
   248  	// KernCodesignError during a page fault, indicates that the page was rejected
   249  	// as a result of a signature check.
   250  	KernCodesignError KernReturn = kernCodesignError
   251  
   252  	// KernPolicyStatic is the requested property cannot be changed at this time.
   253  	KernPolicyStatic KernReturn = kernPolicyStatic
   254  
   255  	// KernInsufficientBufferSize is the provided buffer is of insufficient size for the requested data.
   256  	KernInsufficientBufferSize KernReturn = kernInsufficientBufferSize
   257  
   258  	// KernDenied denied by security policy.
   259  	KernDenied KernReturn = kernDenied
   260  
   261  	// KernMissingKC is the KC on which the function is operating is missing.
   262  	KernMissingKC KernReturn = kernMissingKC
   263  
   264  	// KernInvalidKC is the KC on which the function is operating is invalid.
   265  	KernInvalidKC KernReturn = kernInvalidKC
   266  
   267  	// KernReturnMax maximum return value allowable.
   268  	KernReturnMax KernReturn = kernReturnMax
   269  )