[erlang-questions] How to get a supervisor to tell me a child's startfunc?

Torben Hoffmann torben.lehoff@REDACTED
Mon Nov 2 21:43:02 CET 2009


Since this seems to receive little attention and I kind of wanted to know
this too, I digged around a bit...

I have not tried this out with dynamically created children, but for
standard children something along the lines of:

supervisor:which_children(SupRef) to get the list of children of a
supervisor. The first element of the tuples in the list is the name of the
sys:get_status(ChildName) will then give you details about the child.

1> application:start(sasl).
.... loads of things
2> supervisor:which_children(sasl_safe_sup).
3> sys:get_status(overload).

The '$initial_call' tag seems to provide at least which function was called.

But it turns out that calling this on the supervisor is the solution!

11> sys:get_status(sasl_safe_sup).


Fouth element of the child tagged tuples reveals how he children were

Sorry about dragging you through the whole investigation, but I think it
holds some value... at least as to how I think ;-)


On Fri, Oct 30, 2009 at 17:45, Jim McCoy <jim.mccoy@REDACTED> wrote:

> I need to discover the startfunc being used by a variety of processes
> started dynamically by a supervisor and I am having a hard time
> figuring out how to dig this information out of the system.  Process A
> starts a bunch of children for supervisor S over its lifetime, process
> B needs to do some maintenance or checking of which of these children
> are running at various points in time, to do this B needs to
> specifically know the start function that A used when it passed the
> child spec for any particular child process in to S.  This information
> does not seem to be available directly from the supervisor, so I am
> guessing that there is some other place I need to look but my various
> search queries seem to be missing the magic keyword that will not lead
> me back to the standard supervisor docs...
> Any hints?
> Thanks,
> jim
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org


More information about the erlang-questions mailing list