Changeset a35b458 in mainline for uspace/lib/c/generic/task.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/lib/c/generic/task.c

    r3061bc1 ra35b458  
    5555        task_id_t task_id;
    5656        (void) __SYSCALL1(SYS_TASK_GET_ID, (sysarg_t) &task_id);
    57        
     57
    5858        return task_id;
    5959#endif  /* __32_BITS__ */
    60        
     60
    6161#ifdef __64_BITS__
    6262        return (task_id_t) __SYSCALL0(SYS_TASK_GET_ID);
     
    7474{
    7575        assert(name);
    76        
     76
    7777        return (errno_t) __SYSCALL2(SYS_TASK_SET_NAME, (sysarg_t) name, str_size(name));
    7878}
     
    108108{
    109109        /* Send default files */
    110        
     110
    111111        int fd_stdin = -1;
    112112        int fd_stdout = -1;
    113113        int fd_stderr = -1;
    114        
     114
    115115        if (stdin != NULL) {
    116116                (void) vfs_fhandle(stdin, &fd_stdin);
    117117        }
    118        
     118
    119119        if (stdout != NULL) {
    120120                (void) vfs_fhandle(stdout, &fd_stdout);
     
    124124                (void) vfs_fhandle(stderr, &fd_stderr);
    125125        }
    126        
     126
    127127        return task_spawnvf(id, wait, path, args, fd_stdin, fd_stdout,
    128128            fd_stderr);
     
    153153        if (ldr == NULL)
    154154                return EREFUSED;
    155        
     155
    156156        bool wait_initialized = false;
    157        
     157
    158158        /* Get task ID. */
    159159        task_id_t task_id;
     
    161161        if (rc != EOK)
    162162                goto error;
    163        
     163
    164164        /* Send spawner's current working directory. */
    165165        rc = loader_set_cwd(ldr);
    166166        if (rc != EOK)
    167167                goto error;
    168        
     168
    169169        /* Send program binary. */
    170170        rc = loader_set_program_path(ldr, path);
    171171        if (rc != EOK)
    172172                goto error;
    173        
     173
    174174        /* Send arguments. */
    175175        rc = loader_set_args(ldr, args);
    176176        if (rc != EOK)
    177177                goto error;
    178        
     178
    179179        /* Send files */
    180180        int root = vfs_root();
     
    185185                        goto error;
    186186        }
    187        
     187
    188188        if (fd_stdin >= 0) {
    189189                rc = loader_add_inbox(ldr, "stdin", fd_stdin);
     
    191191                        goto error;
    192192        }
    193        
     193
    194194        if (fd_stdout >= 0) {
    195195                rc = loader_add_inbox(ldr, "stdout", fd_stdout);
     
    197197                        goto error;
    198198        }
    199        
     199
    200200        if (fd_stderr >= 0) {
    201201                rc = loader_add_inbox(ldr, "stderr", fd_stderr);
     
    203203                        goto error;
    204204        }
    205        
     205
    206206        /* Load the program. */
    207207        rc = loader_load_program(ldr);
    208208        if (rc != EOK)
    209209                goto error;
    210        
     210
    211211        /* Setup waiting for return value if needed */
    212212        if (wait) {
     
    216216                wait_initialized = true;
    217217        }
    218        
     218
    219219        /* Run it. */
    220220        rc = loader_run(ldr);
    221221        if (rc != EOK)
    222222                goto error;
    223        
     223
    224224        /* Success */
    225225        if (id != NULL)
    226226                *id = task_id;
    227        
     227
    228228        return EOK;
    229        
     229
    230230error:
    231231        if (wait_initialized)
    232232                task_cancel_wait(wait);
    233        
     233
    234234        /* Error exit */
    235235        loader_abort(ldr);
     
    259259        if (arglist == NULL)
    260260                return ENOMEM;
    261        
     261
    262262        /* Fill in arguments. */
    263263        const char *arg;
     
    267267                arglist[cnt++] = arg;
    268268        } while (arg != NULL);
    269        
     269
    270270        /* Spawn task. */
    271271        errno_t rc = task_spawnv(task_id, wait, path, arglist);
    272        
     272
    273273        /* Free argument list. */
    274274        free(arglist);
     
    293293{
    294294        /* Count the number of arguments. */
    295        
     295
    296296        va_list ap;
    297297        const char *arg;
    298298        int cnt = 0;
    299        
     299
    300300        va_start(ap, path);
    301301        do {
     
    304304        } while (arg != NULL);
    305305        va_end(ap);
    306        
     306
    307307        va_start(ap, path);
    308308        errno_t rc = task_spawn(task_id, wait, path, cnt, ap);
    309309        va_end(ap);
    310        
     310
    311311        return rc;
    312312}
     
    400400        if (rc != EOK)
    401401                return rc;
    402        
     402
    403403        return task_wait(&wait, texit, retval);
    404404}
     
    413413        errno_t rc = (errno_t) async_req_1_0(exch, NS_RETVAL, val);
    414414        async_exchange_end(exch);
    415        
     415
    416416        return rc;
    417417}
Note: See TracChangeset for help on using the changeset viewer.