[erlang-questions] How do I get the atom under which a process is registered?

Håkan Mattsson <>
Tue Dec 15 11:39:52 CET 2009


3> Pid = whereis(user).
<0.25.0>
4>  process_info(Pid, registered_name).
{registered_name,user}

/Håkan


On Tue, Dec 15, 2009 at 11:33 AM, Michael Turner <> wrote:
>
> You can register processes under atoms, which I like very much.  (Maybe
> too much: it's a little like having global variables.) But I haven't
> found a function like "registered_under/1" that, given a pid, returns
> an atom if the process is registered with one.  (It can throw an
> exception or return false, if it's not registered.  I don't really
> care which.)
>
> I can see how to write a function like that, if necessary.  I'm just
> wondering if such a function already exists.  Maybe I'm looking in the
> wrong place, or maybe it's undocumented.
>
> -michael turner


More information about the erlang-questions mailing list