What is the difference between mach_vm_allocate and vm_allocate?

I would like to know what is the difference between mach_vm_allocate and vm_allocate . I know that mach_vm_allocate is only available on OS X and not iOS, but I'm not sure why. A file that has all the function prototypes for the mach_vm_... functions (mach/mach_vm.h) has only #error mach_vm.h unsupported. in iOS.

+4
source share
3 answers

New Mach VM API introduced in Mac OS X 10.4. The new API is essentially the same as the old API from a programmer’s point of view, with the following key differences.

-Routine names are prefixed with mach_forfor, vm_allocate () becomes mach_vm_allocate ().

- The data types used in the routines have been updated to support both 64-bit and 32-bit tasks. Therefore, the new API can be used with any task.

New and old APIs are exported by various MIG subsystems: mach_vm and vm_map, respectively. The corresponding header files are <mach / mach_vm.h> and <mach / vm_map.h> respectively.

+3
source

New Mach VM API introduced in Mac OS X 10.4. The new API is essentially the same as the old API from a programmer’s point of view, with the following key differences:

  • The routine names have an example mach_ prefixfor , vm_allocate() becomes mach_vm_allocate() ;

  • The data types used in the routines have been updated to support both 64-bit and 32-bit tasks. Therefore, the new API can be used with any task.

New and old APIs are exported by various MIG subsystems: mach_vm and vm_map respectively. The corresponding header files are <mach/mach_vm.h> and <mach/vm_map.h> respectively.

Information obtained from the book OS X Internals System Approach.

+2
source

These will be / usr / include / mach / mach _vm.h and / usr / include / mach / vm_map.h. You can grep in / usr / include / mach to get them.

At the core, APIs basically use the same implementation. On iOS, you can make good use of the "old" APIs.

+1
source

All Articles