Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 9a2eb14 in mainline for uspace/lib/c/generic/irc.c


Ignore:
Timestamp:
2017-10-15T15:04:15Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial
Children:
1974f56a
Parents:
75911d24
Message:

As a temporary measure, let IRC servers use the location service for DDF-compatible naming. This is needed until all interrupt controller drivers are in DDF and we can switch to DDF-based naming.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/irc.c

    r75911d24 r9a2eb14  
    3535#include <assert.h>
    3636#include <errno.h>
     37#include <fibril_synch.h>
    3738#include <ipc/irc.h>
    3839#include <ipc/services.h>
    3940#include <irc.h>
    40 #include <ns.h>
     41#include <loc.h>
     42#include <stdlib.h>
    4143#include <sysinfo.h>
    4244
     
    4951static int irc_init(void)
    5052{
     53        category_id_t irc_cat;
     54        service_id_t *svcs;
     55        size_t count;
     56        int rc;
     57
    5158        assert(irc_sess == NULL);
     59        rc = loc_category_get_id("irc", &irc_cat, IPC_FLAG_BLOCKING);
     60        if (rc != EOK)
     61                return EIO;
    5262
    53         irc_sess = service_connect_blocking(SERVICE_IRC, INTERFACE_IRC, 0);
     63        while (true) {
     64                rc = loc_category_get_svcs(irc_cat, &svcs, &count);
     65                if (rc != EOK)
     66                        return EIO;
     67
     68                if (count > 0)
     69                        break;
     70
     71                free(svcs);
     72
     73                // XXX This is just a temporary hack
     74                fibril_usleep(500 * 1000);
     75        }
     76
     77        irc_sess = loc_service_connect(svcs[0], INTERFACE_IRC,
     78            IPC_FLAG_BLOCKING);
     79        free(svcs);
    5480
    5581        if (irc_sess == NULL)
Note: See TracChangeset for help on using the changeset viewer.