{
     File:       CarbonCore/MultiprocessingInfo.h
 
     Contains:   Multiprocessing Information interfaces
                 The contents of this header file are deprecated.
 
     Copyright:  © 1995-2011 DayStar Digital, Inc.
}
{
    Modified for use with Free Pascal
    Version 308
    Please report any bugs to <gpc@microbizz.nl>
}

{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
{$mode macpas}
{$modeswitch cblocks}
{$packenum 1}
{$macro on}
{$inline on}
{$calling mwpascal}

unit MultiProcessingInfo;
interface
{$setc UNIVERSAL_INTERFACES_VERSION := $0400}
{$setc GAP_INTERFACES_VERSION := $0308}

{$ifc not defined USE_CFSTR_CONSTANT_MACROS}
    {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
{$endc}

{$ifc defined CPUPOWERPC and defined CPUI386}
	{$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
{$endc}
{$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
	{$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
{$endc}

{$ifc not defined __ppc__ and defined CPUPOWERPC32}
	{$setc __ppc__ := 1}
{$elsec}
	{$setc __ppc__ := 0}
{$endc}
{$ifc not defined __ppc64__ and defined CPUPOWERPC64}
	{$setc __ppc64__ := 1}
{$elsec}
	{$setc __ppc64__ := 0}
{$endc}
{$ifc not defined __i386__ and defined CPUI386}
	{$setc __i386__ := 1}
{$elsec}
	{$setc __i386__ := 0}
{$endc}
{$ifc not defined __x86_64__ and defined CPUX86_64}
	{$setc __x86_64__ := 1}
{$elsec}
	{$setc __x86_64__ := 0}
{$endc}
{$ifc not defined __arm__ and defined CPUARM}
	{$setc __arm__ := 1}
{$elsec}
	{$setc __arm__ := 0}
{$endc}
{$ifc not defined __arm64__ and defined CPUAARCH64}
  {$setc __arm64__ := 1}
{$elsec}
  {$setc __arm64__ := 0}
{$endc}

{$ifc defined cpu64}
  {$setc __LP64__ := 1}
{$elsec}
  {$setc __LP64__ := 0}
{$endc}


{$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
	{$error Conflicting definitions for __ppc__ and __i386__}
{$endc}

{$ifc defined __ppc__ and __ppc__}
	{$setc TARGET_CPU_PPC := TRUE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := FALSE}
	{$setc TARGET_CPU_ARM64 := FALSE}
	{$setc TARGET_OS_MAC := TRUE}
	{$setc TARGET_OS_IPHONE := FALSE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
	{$setc TARGET_OS_EMBEDDED := FALSE}
{$elifc defined __ppc64__ and __ppc64__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := TRUE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := FALSE}
	{$setc TARGET_CPU_ARM64 := FALSE}
	{$setc TARGET_OS_MAC := TRUE}
	{$setc TARGET_OS_IPHONE := FALSE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
	{$setc TARGET_OS_EMBEDDED := FALSE}
{$elifc defined __i386__ and __i386__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := TRUE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := FALSE}
	{$setc TARGET_CPU_ARM64 := FALSE}
{$ifc defined(iphonesim)}
 	{$setc TARGET_OS_MAC := FALSE}
	{$setc TARGET_OS_IPHONE := TRUE}
	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
{$elsec}
	{$setc TARGET_OS_MAC := TRUE}
	{$setc TARGET_OS_IPHONE := FALSE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$endc}
	{$setc TARGET_OS_EMBEDDED := FALSE}
{$elifc defined __x86_64__ and __x86_64__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := TRUE}
	{$setc TARGET_CPU_ARM := FALSE}
	{$setc TARGET_CPU_ARM64 := FALSE}
{$ifc defined(iphonesim)}
 	{$setc TARGET_OS_MAC := FALSE}
	{$setc TARGET_OS_IPHONE := TRUE}
	{$setc TARGET_IPHONE_SIMULATOR := TRUE}
{$elsec}
	{$setc TARGET_OS_MAC := TRUE}
	{$setc TARGET_OS_IPHONE := FALSE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
{$endc}
	{$setc TARGET_OS_EMBEDDED := FALSE}
{$elifc defined __arm__ and __arm__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := TRUE}
	{$setc TARGET_CPU_ARM64 := FALSE}
	{ will require compiler define when/if other Apple devices with ARM cpus ship }
	{$setc TARGET_OS_MAC := FALSE}
	{$setc TARGET_OS_IPHONE := TRUE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
	{$setc TARGET_OS_EMBEDDED := TRUE}
{$elifc defined __arm64__ and __arm64__}
	{$setc TARGET_CPU_PPC := FALSE}
	{$setc TARGET_CPU_PPC64 := FALSE}
	{$setc TARGET_CPU_X86 := FALSE}
	{$setc TARGET_CPU_X86_64 := FALSE}
	{$setc TARGET_CPU_ARM := FALSE}
	{$setc TARGET_CPU_ARM64 := TRUE}
	{ will require compiler define when/if other Apple devices with ARM cpus ship }
	{$setc TARGET_OS_MAC := FALSE}
	{$setc TARGET_OS_IPHONE := TRUE}
	{$setc TARGET_IPHONE_SIMULATOR := FALSE}
	{$setc TARGET_OS_EMBEDDED := TRUE}
{$elsec}
	{$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
{$endc}

{$ifc defined __LP64__ and __LP64__ }
  {$setc TARGET_CPU_64 := TRUE}
{$elsec}
  {$setc TARGET_CPU_64 := FALSE}
{$endc}

{$ifc defined FPC_BIG_ENDIAN}
	{$setc TARGET_RT_BIG_ENDIAN := TRUE}
	{$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
{$elifc defined FPC_LITTLE_ENDIAN}
	{$setc TARGET_RT_BIG_ENDIAN := FALSE}
	{$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
{$elsec}
	{$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
{$endc}
{$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
{$setc CALL_NOT_IN_CARBON := FALSE}
{$setc OLDROUTINENAMES := FALSE}
{$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
{$setc OPAQUE_UPP_TYPES := TRUE}
{$setc OTCARBONAPPLICATION := TRUE}
{$setc OTKERNEL := FALSE}
{$setc PM_USE_SESSION_APIS := TRUE}
{$setc TARGET_API_MAC_CARBON := TRUE}
{$setc TARGET_API_MAC_OS8 := FALSE}
{$setc TARGET_API_MAC_OSX := TRUE}
{$setc TARGET_CARBON := TRUE}
{$setc TARGET_CPU_68K := FALSE}
{$setc TARGET_CPU_MIPS := FALSE}
{$setc TARGET_CPU_SPARC := FALSE}
{$setc TARGET_OS_UNIX := FALSE}
{$setc TARGET_OS_WIN32 := FALSE}
{$setc TARGET_RT_MAC_68881 := FALSE}
{$setc TARGET_RT_MAC_CFM := FALSE}
{$setc TARGET_RT_MAC_MACHO := TRUE}
{$setc TYPED_FUNCTION_POINTERS := TRUE}
{$setc TYPE_BOOL := FALSE}
{$setc TYPE_EXTENDED := FALSE}
{$setc TYPE_LONGLONG := TRUE}
uses MacTypes,Multiprocessing;
{$endc} {not MACOSALLINCLUDE}


{$ifc TARGET_OS_MAC}

{********************************************************************************************
 
 The Multiprocessing Utilites are deprecated.  Callers should use blocks, libDispatch, or pthreads.
  
********************************************************************************************}
{
   ==========================================================================================================================
   *** WARNING: You must properly check the availability of MP services before calling them!
   See the section titled "Checking API Availability".
   ==========================================================================================================================
}


{$ALIGN POWER}

{
   ======================================= NOTICE ============================================
   As of Mac OS X v10.6, the APIs in this header file are discouraged. These APIs are slated
   for deprecation in the next major release of OS X. The new dispatch APIs (see dispatch(3))
   replace the Multiprocessing APIs and the pthread threading APIs.
   ===========================================================================================
}

{
   ==========================================================================================================================
   This is the header file for version 2.3 of the Mac OS multiprocessing information support. 
   ==========================================================================================================================
}


{
   ==========================================================================================================================
   The following services are new in version 2.1:
    MPGetNextTaskID
    MPGetNextCpuID
   ==========================================================================================================================
}

{
   ==========================================================================================================================
   The following services are new in version 2.2:
    MPGetPageSizeClasses
    MPGetPageSize
    MPGetNextAreaID
   ==========================================================================================================================
}

{
   ==========================================================================================================================
   The following services are new in version 2.3:
    MPGetNextCoherenceID
    MPGetNextProcessID
    MPGetNextAddressSpaceID
    MPGetNextQueueID
    MPGetNextSemaphoreID
    MPGetNextCriticalRegionID
    MPGetNextTimerID
    MPGetNextEventID
    MPGetNextNotificationID
    MPGetNextConsoleID
   ==========================================================================================================================
}


{
   ¤
   ==========================================================================================================================
   Page size Services
   ==================
}

{
 *  MPGetPageSizeClasses()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{ The number of page size classes, 1 to n.}
{ -------------------------------------------------------------------------------------------}
{
 *  MPGetPageSize()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{ The page size in bytes.}

{
   ¤
   ==========================================================================================================================
   ID Iterator Services
   ==========================
}

{
 *  MPGetNextCoherenceID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextCpuID()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in CoreServices.framework but deprecated in 10.7
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }
function MPGetNextCpuID( owningCoherenceID: MPCoherenceID; var cpuID: MPCpuID ): OSStatus; external name '_MPGetNextCpuID';
(* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)


{
 *  MPGetNextProcessID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextAddressSpaceID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextTaskID()   *** DEPRECATED ***
 *  
 *  Availability:
 *    Mac OS X:         in version 10.4 and later in CoreServices.framework but deprecated in 10.7
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }
function MPGetNextTaskID( owningProcessID: MPProcessID; var taskID: MPTaskID ): OSStatus; external name '_MPGetNextTaskID';
(* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)


{
 *  MPGetNextQueueID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextSemaphoreID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextCriticalRegionID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextTimerID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextEventID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextNotificationID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextAreaID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNextConsoleID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{ -------------------------------------------------------------------------------------------}


{
 *  MPGetNextID()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
   ¤
   ==========================================================================================================================
   Object Information Services
   ===========================
}


{
   ----------------------------------------------------------------------------------------------
   ! The implementation of MPGetObjectInfo assumes that all info records are in 4 byte multiples.
}


const
{ The version of the MPAreaInfo structure requested.}
	kMPQueueInfoVersion = 1 or (kOpaqueQueueID shl 16);
	kMPSemaphoreInfoVersion = 1 or (kOpaqueSemaphoreID shl 16);
	kMPEventInfoVersion = 1 or (kOpaqueEventID shl 16);
	kMPCriticalRegionInfoVersion = 1 or (kOpaqueCriticalRegionID shl 16);
	kMPNotificationInfoVersion = 1 or (kOpaqueNotificationID shl 16);
	kMPAddressSpaceInfoVersion = 1 or (kOpaqueAddressSpaceID shl 16);


type
	MPQueueInfoPtr = ^MPQueueInfo;
	MPQueueInfo = record
		version: PBVersion;                { Version of the data structure requested}

		processID: MPProcessID;              { Owning process ID}
		queueName: OSType;              { Queue name}

		nWaiting: ItemCount;
		waitingTaskID: MPTaskID;          { First waiting task.}

		nMessages: ItemCount;
		nReserved: ItemCount;

		p1: UnivPtr;                     { First message parameters...}
		p2: UnivPtr;
		p3: UnivPtr;
	end;
type
	MPSemaphoreInfoPtr = ^MPSemaphoreInfo;
	MPSemaphoreInfo = record
		version: PBVersion;                { Version of the data structure requested}

		processID: MPProcessID;              { Owning process ID}
		semaphoreName: OSType;          { Semaphore name}

		nWaiting: ItemCount;
		waitingTaskID: MPTaskID;          { First waiting task.}

		maximum: ItemCount;
		count: ItemCount;
	end;
type
	MPEventInfoPtr = ^MPEventInfo;
	MPEventInfo = record
		version: PBVersion;                { Version of the data structure requested}

		processID: MPProcessID;              { Owning process ID}
		eventName: OSType;              { Event name}

		nWaiting: ItemCount;
		waitingTaskID: MPTaskID;          { First waiting task.}

		events: MPEventFlags;
	end;
type
	MPCriticalRegionInfoPtr = ^MPCriticalRegionInfo;
	MPCriticalRegionInfo = record
		version: PBVersion;                { Version of the data structure requested}

		processID: MPProcessID;              { Owning process ID}
		regionName: OSType;             { Critical region name}

		nWaiting: ItemCount;
		waitingTaskID: MPTaskID;          { First waiting task.}

		owningTask: MPTaskID;
		count: ItemCount;
	end;
type
	MPNotificationInfoPtr = ^MPNotificationInfo;
	MPNotificationInfo = record
		version: PBVersion;                { Version of the data structure requested}

		processID: MPProcessID;              { Owning process ID}
		notificationName: OSType;       { Notification name}

		queueID: MPQueueID;                { Queue to notify.}
		p1: UnivPtr;
		p2: UnivPtr;
		p3: UnivPtr;

		eventID: MPEventID;                { Event to set.}
		events: MPEventFlags;

		semaphoreID: MPSemaphoreID;            { Sempahore to signal.   }
	end;
type
	MPAddressSpaceInfoPtr = ^MPAddressSpaceInfo;
	MPAddressSpaceInfo = record
		version: PBVersion;                { Version of the data structure requested}

		processID: MPProcessID;              { Owning process ID}
		groupID: MPCoherenceID;                { Related coherence group.}
		nTasks: ItemCount;                 { Number of tasks in this space.}
    vsid: array [0..15] of UInt32;               { Segment register VSIDs.}
	end;
{ *** We should put the task info call here instead of in MPExtractTaskState.}


{
 *  MPGetQueueInfo()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetSemaphoreInfo()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetEventInfo()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetCriticalRegionInfo()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetNotificationInfo()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{
 *  MPGetAddressSpaceInfo()
 *  
 *  Availability:
 *    Mac OS X:         not available
 *    CarbonLib:        not available
 *    Non-Carbon CFM:   in MPDiagnostics 2.3 and later
 }


{ ==========================================================================================================================}


{$endc} {TARGET_OS_MAC}

{$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}

end.
{$endc} {not MACOSALLINCLUDE}
