Changeset d9fae235 in mainline for uspace/srv/ns/ns.c


Ignore:
Timestamp:
2010-04-17T01:28:38Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9d6bfa5
Parents:
9256ad29
Message:

sysinfo overhaul

  • cleanup (nicer data structures, use of SLAB allocator)
  • add support for storing arbitrary binary data
  • properly reimplement non-constant values (generated by functions)
  • add support for non-constant subtrees (generated by functions)
  • syscall ABI change, libc API change
  • reflect changes in user code

libc: task_spawn() can now return error code

  • reflect change in user code, print error strings after failed task_spawn()

uspace cleanup

  • more use of string and other constants
  • more use of str_error()
  • unify error reporting in init
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/ns/ns.c

    r9256ad29 rd9fae235  
    5555static void *klogaddr = NULL;
    5656
    57 static void get_as_area(ipc_callid_t callid, ipc_call_t *call, void *ph_addr,
     57static void get_as_area(ipc_callid_t callid, ipc_call_t *call, void *faddr,
    5858    size_t pages, void **addr)
    5959{
    60         if (ph_addr == NULL) {
     60        if ((faddr == NULL) || (pages == 0)) {
    6161                ipc_answer_0(callid, ENOENT);
    6262                return;
     
    7171                }
    7272               
    73                 if (physmem_map(ph_addr, *addr, pages,
     73                if (physmem_map(faddr, *addr, pages,
    7474                    AS_AREA_READ | AS_AREA_CACHEABLE) != 0) {
    7575                        ipc_answer_0(callid, ENOENT);
     
    8181}
    8282
     83static void setup_clock_area(ipc_callid_t callid, ipc_call_t *call, void **addr)
     84{
     85        uintptr_t faddr;
     86        int err = sysinfo_get_value("clock.faddr", &faddr);
     87       
     88        if (err != EOK)
     89                ipc_answer_0(callid, err);
     90       
     91        get_as_area(callid, call, (void *) faddr, 1, addr);
     92}
     93
     94static void setup_klog_area(ipc_callid_t callid, ipc_call_t *call, void **addr)
     95{
     96        uintptr_t faddr;
     97        int err = sysinfo_get_value("klog.faddr", &faddr);
     98       
     99        if (err != EOK)
     100                ipc_answer_0(callid, err);
     101       
     102        size_t pages;
     103        err = sysinfo_get_value("klog.pages", &pages);
     104       
     105        if (err != EOK)
     106                ipc_answer_0(callid, err);
     107       
     108        get_as_area(callid, call, (void *) faddr, pages, addr);
     109}
     110
    83111int main(int argc, char **argv)
    84112{
     
    97125                return rc;
    98126       
    99         printf(NAME ": Accepting connections\n");
     127        printf("%s: Accepting connections\n", NAME);
    100128       
    101129        while (true) {
     
    113141                        switch (IPC_GET_ARG3(call)) {
    114142                        case SERVICE_MEM_REALTIME:
    115                                 get_as_area(callid, &call,
    116                                     (void *) sysinfo_value("clock.faddr"),
    117                                     1, &clockaddr);
     143                                setup_clock_area(callid, &call, &clockaddr);
    118144                                break;
    119145                        case SERVICE_MEM_KLOG:
    120                                 get_as_area(callid, &call,
    121                                     (void *) sysinfo_value("klog.faddr"),
    122                                     sysinfo_value("klog.pages"), &klogaddr);
     146                                setup_klog_area(callid, &call, &klogaddr);
    123147                                break;
    124148                        default:
Note: See TracChangeset for help on using the changeset viewer.