[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #3049 [Tor Client]: Allow a Tor process to be âownedâ by a controller process
#3049: Allow a Tor process to be âownedâ by a controller process
-------------------------+--------------------------------------------------
Reporter: rransom | Owner: rransom
Type: enhancement | Status: accepted
Priority: major | Milestone: Tor: 0.2.2.x-final
Component: Tor Client | Version:
Keywords: | Parent:
Points: | Actualpoints:
-------------------------+--------------------------------------------------
Comment(by rransom):
Replying to [comment:4 nickm]:
> I'm not sure how you go about implementing that feature, fwiw. Is there
a standard way to watch for a process with a particular pid to change its
status? waitpid() and friends seem to only be for child processes. You
can kill(0) the pid, but that doesn't tell you if *that* process is still
there: it only tells you if some process with that pid is still there.
Polling for whether some process has that PID is the best option available
in POSIX. That's part of the reason I want a `TAKEOWNERSHIP` control-port
command -- `__OwningControllerPID` is going to be racy on many systems.
> On BSDish systems, you can use kevent to wait for a process, but I don't
believe libevent exposes that atm. On linuxy systems, you could pull the
process's start time out of /proc/[pid]/stat and see whether it's changed
or somethign. On Windows, you can grab a handle to the process somehow
and poll it from time to time to see whether it's been signalled.... but
all of these approaches seem pretty heavyweight atm.
On Windows, it is possible to wait for the process handle (among others),
too. I don't know whether libevent allows us to wait for an arbitrary
handle (and I assume it doesn't).
I plan to poll for a PID's existence on all Unixoid systems, and poll a
process handle on Windows, for now. This is the other part of the reason
I want a `TAKEOWNERSHIP` control-port command -- the
`__OwningControllerPID` option will involve polling, and we don't want to
do that for any longer than necessary.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/3049#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs