The machine port is not directly connected to the process, but instead to the task. Then the task is connected with the structure of the bsd process. To request the ports of a task, you can use the mach_port_names function. So that all open ports handle all tasks and use the above function.
Another approach is to use the procfs file system. The procfs file system is implemented on top of the fuse file system and must be manually installed on the system. This is an open source solution. After installing the procfs file system, you can request task ports by accessing the / proc / proc -id / task / ports file. Take a look at http://osxbook.com/book/bonus/chapter11/procfs/ .
steve source share