Changeset a35b458 in mainline for uspace/srv/loader/main.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

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

    r3061bc1 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.