Changeset 9b1baac in mainline for uspace/srv/logger/main.c


Ignore:
Timestamp:
2018-07-18T08:35:42Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b05082
Parents:
edc64c0
Message:

ns: register service interfaces individually

Each service interface is now registered individually with the naming
service. This adds a degree of type safety, potentially allows the
individual interfaces to be implemented by independent tasks and moves
the code slightly closer to the full-fledged ports design.

Broker services (e.g. the location service) can still register a
fallback port for receiving connections to all interface types
explicitly using service_register_broker().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/logger/main.c

    redc64c0 r9b1baac  
    6767        }
    6868
    69         port_id_t port;
    70         errno_t rc = async_create_port(INTERFACE_LOGGER_CONTROL,
    71             connection_handler_control, NULL, &port);
     69        errno_t rc = service_register(SERVICE_LOGGER, INTERFACE_LOGGER_CONTROL,
     70            connection_handler_control, NULL);
    7271        if (rc != EOK) {
    73                 printf("%s: Error while creating control port: %s\n", NAME, str_error(rc));
    74                 return rc;
    75         }
    76 
    77         rc = async_create_port(INTERFACE_LOGGER_WRITER,
    78             connection_handler_writer, NULL, &port);
    79         if (rc != EOK) {
    80                 printf("%s: Error while creating writer port: %s\n", NAME, str_error(rc));
    81                 return rc;
    82         }
    83 
    84         rc = service_register(SERVICE_LOGGER);
    85         if (rc != EOK) {
    86                 printf(NAME ": failed to register: %s.\n", str_error(rc));
     72                printf("%s: Failed to register control port: %s.\n", NAME,
     73                    str_error(rc));
    8774                return -1;
    8875        }
    8976
    90         printf(NAME ": Accepting connections\n");
     77        rc = service_register(SERVICE_LOGGER, INTERFACE_LOGGER_WRITER,
     78            connection_handler_writer, NULL);
     79        if (rc != EOK) {
     80                printf("%s: Failed to register writer port: %s.\n", NAME,
     81                    str_error(rc));
     82                return -1;
     83        }
     84
     85        printf("%s: Accepting connections\n", NAME);
    9186        async_manager();
    9287
Note: See TracChangeset for help on using the changeset viewer.