int __pmServiceAddPorts(const char *service, int **ports, int nports) { /* * The list of ports referenced by *ports may be (re)allocated * using calls to realloc(3) with a new size based on nports. * For an empty list, *ports must be NULL and nports must be 0. * It is the responsibility of the caller to free this memory. * * If -EOPNOTSUPP is not returned, then this function is * guaranteed to return a list containing at least 1 element. * * The service is a service name (e.g. pmcd). */ if (strcmp(service, PM_SERVER_SERVICE_SPEC) == 0) nports = __pmPMCDAddPorts(ports, nports); else if (strcmp(service, PM_SERVER_PROXY_SPEC) == 0) nports = __pmProxyAddPorts(ports, nports); else if (strcmp(service, PM_SERVER_WEBD_SPEC) == 0) nports = __pmWebdAddPorts(ports, nports); else nports = -EOPNOTSUPP; return nports; }
static void load_pmcd_ports(void) { if (global_portlist == NULL) { /* __pmPMCDAddPorts discovers at least one valid port, if it returns. */ global_nports = __pmPMCDAddPorts(&global_portlist, global_nports); } }