alexchandel / procfs

/proc for macOS/OS X 64-bit
GNU General Public License v2.0
68 stars 11 forks source link

More features from Plan 9 and Linux #5

Open alexchandel opened 8 years ago

alexchandel commented 8 years ago

As of 48023bbfb8e439fd5d6a194d4562b7a6a7f13ec9, where PID, CPUID, and DISPID are numbers, PNAME is the process name, and WID is the window id, the current layout is something like this:

/proc/PID
/proc/PID/carbon/
/proc/PID/carbon/name
/proc/PID/carbon/psn
/proc/PID/cmdline
/proc/PID/jobc
/proc/PID/paddr
/proc/PID/pcred/
/proc/PID/pcred/rgid
/proc/PID/pcred/ruid
/proc/PID/pcred/svgid
/proc/PID/pcred/svgid
/proc/PID/pgid
/proc/PID/ppid
/proc/PID/task/  # lots of subfiles
/proc/PID/tdev
/proc/PID/tpgid
/proc/PID/ucred/
/proc/PID/ucred/groups
/proc/PID/ucred/uid
/proc/PID/wchan
/proc/PID/windows/
/proc/PID/windows/all
/proc/PID/windows/identify
/proc/PID/windows/onscreen
/proc/PID/windows/screenshots/
/proc/PID/windows/screenshots/WID.png
/proc/byname/
/proc/byname/PNAME
/proc/system/
/proc/system/firmware/
/proc/system/firmware/variables
/proc/system/hardware/
/proc/system/hardware/camera/screenshot.tiff
/proc/system/hardware/cpus/CPUID/data
/proc/system/hardware/displays/DISPID/info
/proc/system/hardware/displays/DISPID/screenshot.png
/proc/system/hardware/lightsensor/data
/proc/system/hardware/motionsensor/data
/proc/system/hardware/mouse/data

We have unique things, but we're also missing lots of stuff, like from Linux

/proc/PID/cmdline
/proc/PID/cwd
/proc/PID/environ
/proc/PID/exe
/proc/PID/fd/
/proc/PID/fdinfo/
/proc/PID/maps
/proc/PID/mem
/proc/PID/root
/proc/PID/status

which let you access the process's environment variables and file descriptors.

There's also cooler stuff from Plan 9, like

/proc/trace
/proc/PID/ctl
/proc/PID/note
/proc/PID/noteid
/proc/PID/notepg
/proc/PID/ns
/proc/PID/regs
/proc/PID/segment
/proc/PID/status
/proc/PID/wait

which allow sending control messages to the process (like start, stop, trace), sending notes (i.e. arbitrary string signals that Plan 9 replaced the BSD signals like SIGINT with), tracing any process that has had trace written to its ctl, accessing the register values of a process, and other things.

All of this (except maybe notes, which are even too cool for Linux) should be implementable on OS X.

There's also our /proc/system/, which should have more in common with sysfs and Plan 9's /dev.