xtc_reg(3)

---

xtc_reg(3)

named process registry

XTC_REG(3) Library Functions Manual XTC_REG(3)

xtc_reg_create, xtc_reg_destroy, xtc_reg_register, xtc_reg_unregister, xtc_reg_lookup, xtc_reg_whereis, xtc_reg_countnamed process registry

#include <xtc.h>
#include <xtc_reg.h>

int
xtc_reg_create(xtc_reg_t **out);

void
xtc_reg_destroy(xtc_reg_t *r);

int
xtc_reg_register(xtc_reg_t *r, const char *name, xtc_pid_t pid);

int
xtc_reg_unregister(xtc_reg_t *r, const char *name);

int
xtc_reg_lookup(xtc_reg_t *r, const char *name, xtc_pid_t *out);

int
xtc_reg_whereis(xtc_reg_t *r, const char *name, xtc_pid_t *out_pid);

int
xtc_reg_count(const xtc_reg_t *r);

xtc_reg is a name-to-pid registry. Modeled on Erlang's ‘register/2’ process registration. Lets a process find a peer by canonical name without sharing pid pointers ahead of time.

Names are short strings (up to 64 bytes); re-registering the same name with a different pid replaces the prior binding atomically.

xtc_app owns a registry per app (xtc_app_registry(3)). Multiple registries are permitted for sharded namespaces.

() looks up the pid bound to name, writing it to out_pid (the Erlang ‘whereis spelling of ()’). () returns the number of live registrations in r.

xtc_reg_t *r = xtc_app_registry(app);
xtc_pid_t pid;

/* Bind a name to my process. */
xtc_reg_register(r, "metrics_proc", xtc_self());

/* From elsewhere: */
if (xtc_reg_lookup(r, "metrics_proc", &pid) == XTC_OK)
    xtc_send(pid, msg, sz);

xtc_app(3), xtc_proc(3), xtc(7)

Appeared in xtc 0.1.

May 28, 2026 Debian

View the mdoc source