Ignore:
File:
1 edited

Legend:

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

    r5a6cc679 ra35b458  
    9595        task_id_t task_id;
    9696        size_t len;
    97        
     97
    9898        task_id = task_get_id();
    99        
     99
    100100        if (!async_data_read_receive(&callid, &len)) {
    101101                async_answer_0(callid, EINVAL);
     
    103103                return;
    104104        }
    105        
     105
    106106        if (len > sizeof(task_id))
    107107                len = sizeof(task_id);
    108        
     108
    109109        async_data_read_finalize(callid, &task_id, len);
    110110        async_answer_0(rid, EOK);
     
    120120        char *buf;
    121121        errno_t rc = async_data_write_accept((void **) &buf, true, 0, 0, 0, NULL);
    122        
     122
    123123        if (rc == EOK) {
    124124                if (cwd != NULL)
    125125                        free(cwd);
    126                
     126
    127127                cwd = buf;
    128128        }
    129        
     129
    130130        async_answer_0(rid, rc);
    131131}
     
    158158                return;
    159159        }
    160        
     160
    161161        progname = name;
    162162        program_fd = file;
     
    174174        size_t buf_size;
    175175        errno_t rc = async_data_write_accept((void **) &buf, true, 0, 0, 0, &buf_size);
    176        
     176
    177177        if (rc == EOK) {
    178178                /*
     
    181181                char *cur = buf;
    182182                int count = 0;
    183                
     183
    184184                while (cur < buf + buf_size) {
    185185                        size_t arg_size = str_size(cur);
     
    187187                        count++;
    188188                }
    189                
     189
    190190                /*
    191191                 * Allocate new argv
     
    197197                        return;
    198198                }
    199                
     199
    200200                /*
    201201                 * Fill the new argv with argument pointers
     
    205205                while (cur < buf + buf_size) {
    206206                        _argv[count] = cur;
    207                        
     207
    208208                        size_t arg_size = str_size(cur);
    209209                        cur += arg_size + 1;
     
    211211                }
    212212                _argv[count] = NULL;
    213                
     213
    214214                /*
    215215                 * Copy temporary data to global variables
     
    217217                if (arg_buf != NULL)
    218218                        free(arg_buf);
    219                
     219
    220220                if (argv != NULL)
    221221                        free(argv);
    222                
     222
    223223                argc = count;
    224224                arg_buf = buf;
    225225                argv = _argv;
    226226        }
    227        
     227
    228228        async_answer_0(rid, rc);
    229229}
     
    289289                return 1;
    290290        }
    291        
     291
    292292        elf_set_pcb(&prog_info, &pcb);
    293        
     293
    294294        pcb.cwd = cwd;
    295        
     295
    296296        pcb.argc = argc;
    297297        pcb.argv = argv;
    298        
     298
    299299        pcb.inbox = inbox;
    300300        pcb.inbox_entries = inbox_entries;
    301        
     301
    302302        async_answer_0(rid, EOK);
    303303        return 0;
     
    317317        /* Set the task name. */
    318318        task_set_name(progname);
    319        
     319
    320320        /* Run program */
    321321        DPRINTF("Reply OK\n");
     
    323323        DPRINTF("Jump to entry point at %p\n", pcb.entry);
    324324        entry_point_jmp(prog_info.finfo.entry, &pcb);
    325        
     325
    326326        /* Not reached */
    327327}
     
    339339                return;
    340340        }
    341        
     341
    342342        connected = true;
    343        
     343
    344344        /* Accept the connection */
    345345        async_answer_0(iid, EOK);
    346        
     346
    347347        /* Ignore parameters, the connection is already open */
    348348        (void) icall;
    349        
     349
    350350        while (true) {
    351351                errno_t retval;
    352352                ipc_call_t call;
    353353                ipc_callid_t callid = async_get_call(&call);
    354                
     354
    355355                if (!IPC_GET_IMETHOD(call))
    356356                        exit(0);
    357                
     357
    358358                switch (IPC_GET_IMETHOD(call)) {
    359359                case LOADER_GET_TASKID:
     
    382382                        break;
    383383                }
    384                
     384
    385385                async_answer_0(callid, retval);
    386386        }
     
    392392{
    393393        async_set_fallback_port_handler(ldr_connection, NULL);
    394        
     394
    395395        /* Introduce this task to the NS (give it our task ID). */
    396396        task_id_t id = task_get_id();
     
    398398        if (rc != EOK)
    399399                return rc;
    400        
     400
    401401        /* Create port */
    402402        port_id_t port;
     
    404404        if (rc != EOK)
    405405                return rc;
    406        
     406
    407407        /* Register at naming service. */
    408408        rc = service_register(SERVICE_LOADER);
    409409        if (rc != EOK)
    410410                return rc;
    411        
     411
    412412        async_manager();
    413        
     413
    414414        /* Never reached */
    415415        return 0;
Note: See TracChangeset for help on using the changeset viewer.