Changes in uspace/srv/ns/ns.c [0315679:6119f24] in mainline


Ignore:
File:
1 edited

Legend:

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

    r0315679 r6119f24  
    3737
    3838#include <ipc/ipc.h>
    39 #include <ipc/services.h>
    4039#include <ipc/ns.h>
    41 #include <unistd.h>
    4240#include <stdio.h>
    4341#include <errno.h>
    44 #include <as.h>
    45 #include <ddi.h>
    46 #include <event.h>
    4742#include <macros.h>
    48 #include <sysinfo.h>
    4943#include "ns.h"
    5044#include "service.h"
    5145#include "clonable.h"
    5246#include "task.h"
    53 
    54 static void *clockaddr = NULL;
    55 static void *klogaddr = NULL;
    56 
    57 static void get_as_area(ipc_callid_t callid, ipc_call_t *call, void *ph_addr,
    58     size_t pages, void **addr)
    59 {
    60         if (ph_addr == NULL) {
    61                 ipc_answer_0(callid, ENOENT);
    62                 return;
    63         }
    64        
    65         if (*addr == NULL) {
    66                 *addr = as_get_mappable_page(pages * PAGE_SIZE);
    67                
    68                 if (*addr == NULL) {
    69                         ipc_answer_0(callid, ENOENT);
    70                         return;
    71                 }
    72                
    73                 if (physmem_map(ph_addr, *addr, pages,
    74                     AS_AREA_READ | AS_AREA_CACHEABLE) != 0) {
    75                         ipc_answer_0(callid, ENOENT);
    76                         return;
    77                 }
    78         }
    79        
    80         ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ);
    81 }
    8247
    8348int main(int argc, char **argv)
     
    9762                return rc;
    9863       
    99         printf(NAME ": Accepting connections\n");
     64        printf("%s: Accepting connections\n", NAME);
    10065       
    10166        while (true) {
     
    10772               
    10873                task_id_t id;
    109                 ipcarg_t retval;
     74                sysarg_t retval;
    11075               
    111                 switch (IPC_GET_METHOD(call)) {
    112                 case IPC_M_SHARE_IN:
    113                         switch (IPC_GET_ARG3(call)) {
    114                         case SERVICE_MEM_REALTIME:
    115                                 get_as_area(callid, &call,
    116                                     (void *) sysinfo_value("clock.faddr"),
    117                                     1, &clockaddr);
    118                                 break;
    119                         case SERVICE_MEM_KLOG:
    120                                 get_as_area(callid, &call,
    121                                     (void *) sysinfo_value("klog.faddr"),
    122                                     sysinfo_value("klog.pages"), &klogaddr);
    123                                 break;
    124                         default:
    125                                 ipc_answer_0(callid, ENOENT);
    126                         }
    127                         continue;
     76                switch (IPC_GET_IMETHOD(call)) {
    12877                case IPC_M_PHONE_HUNGUP:
    12978                        retval = ns_task_disconnect(&call);
Note: See TracChangeset for help on using the changeset viewer.