Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Compile on MacOSX systems without mach_task_self function

On Snow Leopard mach/mach_init.h has a function decl for mach_task_self,
yet later redefines as a macro to return the mach_task_self_ variable.

Newer systems have removed the function and since cgo doesn't handle macros,
compile fails: "error: 'mach_task_self' undeclared ..."

Change-Id: I8d28a9c7609656f2cbdee5588e6a4c337599ac2c
  • Loading branch information...
commit 95cbeda03a6dd5339030585805e928009834e073 1 parent 34b9338
@dougm dougm authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  sigar_darwin.go
2  sigar_darwin.go
@@ -126,7 +126,7 @@ func (self *CpuList) Get() error {
// jump through some cgo casting hoops and ensure we properly free
// the memory that cpuload points to
- target := C.vm_map_t(C.mach_task_self())
+ target := C.vm_map_t(C.mach_task_self_)
address := C.vm_address_t(uintptr(unsafe.Pointer(cpuload)))
defer C.vm_deallocate(target, address, C.vm_size_t(ncpu))

0 comments on commit 95cbeda

Please sign in to comment.
Something went wrong with that request. Please try again.