[erlang-questions] erlang:process_info for global processes
Sat Sep 19 18:49:15 CEST 2015
On Sat, Sep 19, 2015 at 11:01 AM, Adam Kövári <> wrote:
> I noticed erlang:process_info(<PID of a global process>, registered_name)
> returns . Is this expected? What is the reason this doesn’t work for
> globally registered processes?
The process_info call returns local process information. The global process
support is entirely separate.
> Is there a built in function which would work with global processes?
> 6> global:registered_names().
> 7> Pid = global:whereis_name(test_dumb1).
> 8> erlang:process_info(Pid, registered_name).
I don't see an API function for what you want, but here's a hack to get it:
9> ets:lookup(global_pid_names, Pid).
But this reaches into the internals of the global module and so isn't the
best thing to do. Perhaps the global module needs a new lookup-by-pid or
process_info exported function. Or then again, maybe there's a good reason
it's not provided.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions