GETINFO Expansion
Hi. I've made the changes for some of the low hanging fruit for proposal 173 (getinfo-option-expansion). These are platform specific changes and mostly just concern the handling on *nix platforms (tested under 32bit Ubuntu 9.10). The one exception is the pid, where I'm fetching it via the same method as what we do for the PidFile.
Implemented: "process/pid" -- Process id belonging to the main tor process. "process/uid" -- User id running the tor process, -1 if unknown. "process/user" -- Username under which the tor process is running, providing an empty string if none exists. "process/descriptor-limit" -- File descriptor limit, -1 if unknown.
A few others from the proposal would be nice, but look more involved. If these are trivial then please give me a hint and I'll include them too: "relay/read-total" -- Total bytes relayed (download). "relay/write-total" -- Total bytes relayed (upload). "process/descriptors-used" -- Count of file descriptors used. "ns/authority" -- Router status info (v2 directory style) for all recognized directory authorities, joined by newlines.
Most of the other can be inferred from controllers so I'm not as interested in them. Providing the pid via the control port will also resolve: https://trac.torproject.org/projects/tor/ticket/1388
Cheers! -Damian
PS. I'm using the PidFile as my example for cross-platform support, which might be unwise (it just splits between Windows/Non-Windows use cases). I'm not spotting anything that looks like an "#ifdef UNIX" in the tor code - is this the proper approach for cross-platform functionality?