Skip to content

Instantly share code, notes, and snippets.

@ketotek
ketotek / libproc_example.swift
Created May 31, 2019 14:51 — forked from kainjow/libproc_example.swift
Swift example of C libproc API
import Darwin
// Call proc_listallpids once with nil/0 args to get the current number of pids
let initialNumPids = proc_listallpids(nil, 0)
// Allocate a buffer of these number of pids.
// Make sure to deallocate it as this class does not manage memory for us.
let buffer = UnsafeMutablePointer<pid_t>.allocate(capacity: Int(initialNumPids))
defer {
buffer.deallocate()

Keybase proof

I hereby claim:

  • I am ketotek on github.
  • I am acopot (https://keybase.io/acopot) on keybase.
  • I have a public key whose fingerprint is 8EA7 B1EC 2F34 BA2E 4259 AD10 6A79 B676 A951 1D45

To claim this, I am signing this object: