Changeset e28175d in mainline for uspace/app


Ignore:
Timestamp:
2020-03-15T10:44:02Z (6 years ago)
Author:
GitHub <noreply@…>
Parents:
b401b33 (diff), 44dde42 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
heiducteam <tristanided@…> (2020-03-15 10:44:02)
git-committer:
GitHub <noreply@…> (2020-03-15 10:44:02)
Message:

Merge pull request #1 from HelenOS/master

sync

Location:
uspace/app
Files:
49 added
29 deleted
25 edited
29 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/barber/barber.c

    rb401b33 re28175d  
    4545#include <window.h>
    4646#include <canvas.h>
    47 #include <surface.h>
    48 #include <codec/tga.gz.h>
     47#include <draw/surface.h>
     48#include <draw/codec.h>
    4949#include "images.h"
    5050
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    rb401b33 re28175d  
    4242#include <vfs/vfs.h>
    4343#include <str.h>
    44 #include <cap.h>
     44#include <capa.h>
    4545
    4646#include "ls.h"
     
    106106                }
    107107
    108                 cap_spec_t cap;
    109                 cap_from_blocks(de->s.size, 1, &cap);
    110                 cap_simplify(&cap);
     108                capa_spec_t capa;
     109                capa_from_blocks(de->s.size, 1, &capa);
     110                capa_simplify(&capa);
    111111
    112112                char *rptr;
    113                 errno_t rc = cap_format(&cap, &rptr);
     113                errno_t rc = capa_format(&capa, &rptr);
    114114                if (rc != EOK) {
    115115                        return rc;
  • uspace/app/bdsh/cmds/modules/modules.c

    rb401b33 re28175d  
    6363#include "echo/entry.h"
    6464#include "cmp/entry.h"
     65#include "alias/entry.h"
     66#include "unalias/entry.h"
    6567
    6668/*
     
    8890#include "echo/echo_def.inc"
    8991#include "cmp/cmp_def.inc"
     92#include "alias/alias_def.inc"
     93#include "unalias/unalias_def.inc"
    9094
    9195        { NULL, NULL, NULL, NULL }
  • uspace/app/bdsh/cmds/modules/modules.h

    rb401b33 re28175d  
    3131
    3232#include "../cmds.h"
    33 #include "modules.h"
    3433
    3534extern module_t modules[];
  • uspace/app/bdsh/compl.c

    rb401b33 re28175d  
    3535#include <vfs/vfs.h>
    3636#include <str.h>
    37 
     37#include <adt/odict.h>
     38
     39#include "scli.h"
    3840#include "cmds/cmds.h"
    3941#include "compl.h"
     
    6365        /** Length of string prefix (number of characters) */
    6466        size_t prefix_len;
     67
     68        /* Pointer to the current alias */
     69        odlink_t *alias_link;
    6570
    6671        /** Pointer inside list of modules */
     
    243248        } else if (cs->is_command) {
    244249                /* Command without path */
     250                cs->alias_link = odict_first(&alias_dict);
    245251                cs->module = modules;
    246252                cs->builtin = builtins;
     
    321327        }
    322328
     329        /* Alias */
     330        if (cs->alias_link != NULL) {
     331                while (*compl == NULL && cs->alias_link != NULL) {
     332                        alias_t *data = odict_get_instance(cs->alias_link, alias_t, odict);
     333                        if (compl_match_prefix(cs, data->name)) {
     334                                asprintf(compl, "%s ", data->name);
     335                                cs->last_compl = *compl;
     336                                if (*compl == NULL)
     337                                        return ENOMEM;
     338                        }
     339                        cs->alias_link = odict_next(cs->alias_link, &alias_dict);
     340                }
     341        }
     342
    323343        /* Modules */
    324344        if (cs->module != NULL) {
    325345                while (*compl == NULL && cs->module->name != NULL) {
     346                        /* prevents multiple listing of an overriden cmd */
    326347                        if (compl_match_prefix(cs, cs->module->name)) {
    327                                 asprintf(compl, "%s ", cs->module->name);
    328                                 cs->last_compl = *compl;
    329                                 if (*compl == NULL)
    330                                         return ENOMEM;
     348                                odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)cs->module->name, NULL);
     349                                if (alias_link == NULL) {
     350                                        asprintf(compl, "%s ", cs->module->name);
     351                                        cs->last_compl = *compl;
     352                                        if (*compl == NULL)
     353                                                return ENOMEM;
     354                                }
    331355                        }
    332356                        cs->module++;
     
    338362                while (*compl == NULL && cs->builtin->name != NULL) {
    339363                        if (compl_match_prefix(cs, cs->builtin->name)) {
    340                                 asprintf(compl, "%s ", cs->builtin->name);
    341                                 cs->last_compl = *compl;
    342                                 if (*compl == NULL)
    343                                         return ENOMEM;
     364                                /* prevents multiple listing of an overriden cmd */
     365                                odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)cs->module->name, NULL);
     366                                if (alias_link == NULL) {
     367                                        asprintf(compl, "%s ", cs->builtin->name);
     368                                        cs->last_compl = *compl;
     369                                        if (*compl == NULL)
     370                                                return ENOMEM;
     371                                }
    344372                        }
    345373                        cs->builtin++;
     
    389417                                free(ent_path);
    390418
     419                                /* prevents multiple listing of an overriden cmd */
     420                                if (cs->is_command && !ent_stat.is_directory) {
     421                                        odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)dent->d_name, NULL);
     422                                        if (alias_link != NULL) {
     423                                                continue;
     424                                        }
     425                                }
     426
    391427                                asprintf(compl, "%s%c", dent->d_name,
    392428                                    ent_stat.is_directory ? '/' : ' ');
  • uspace/app/bdsh/config.h

    rb401b33 re28175d  
    4242#endif
    4343
     44/* define maximal nested aliases */
     45#ifndef HUBS_MAX
     46#define HUBS_MAX 20
     47#endif
     48
    4449/* Used in many places */
    4550#define SMALL_BUFLEN 256
  • uspace/app/bdsh/input.c

    rb401b33 re28175d  
    33 * Copyright (c) 2011 Jiri Svoboda
    44 * Copyright (c) 2011 Martin Sucha
     5 * Copyright (c) 2018 Matthieu Riolo
    56 * All rights reserved.
    67 *
     
    4344#include <stdbool.h>
    4445#include <tinput.h>
     46#include <adt/odict.h>
     47#include <adt/list.h>
    4548
    4649#include "config.h"
     
    6265static void print_pipe_usage(void);
    6366
     67typedef struct {
     68        link_t alias_hup_link;
     69        alias_t *alias;
     70} alias_hup_t;
     71
     72static bool find_alias_hup(alias_t *alias, list_t *alias_hups)
     73{
     74        list_foreach(*alias_hups, alias_hup_link, alias_hup_t, link) {
     75                if (alias == link->alias) {
     76                        return true;
     77                }
     78        }
     79
     80        return false;
     81}
     82
    6483/*
    6584 * Tokenizes input from console, sees if the first word is a built-in, if so
     
    6786 * the handler
    6887 */
    69 errno_t process_input(cliuser_t *usr)
    70 {
     88static errno_t process_input_nohup(cliuser_t *usr, list_t *alias_hups, size_t count_executed_hups)
     89{
     90        if (count_executed_hups >= HUBS_MAX) {
     91                cli_error(CL_EFAIL, "%s: maximal alias hubs reached\n", PACKAGE_NAME);
     92                return ELIMIT;
     93        }
     94
    7195        token_t *tokens_buf = calloc(WORD_MAX, sizeof(token_t));
    7296        if (tokens_buf == NULL)
     
    171195        }
    172196
     197        /* test if the passed cmd is an alias */
     198        odlink_t *alias_link = odict_find_eq(&alias_dict, (void *)cmd[0], NULL);
     199        if (alias_link != NULL) {
     200                alias_t *data = odict_get_instance(alias_link, alias_t, odict);
     201                /* check if the alias already has been resolved once */
     202                if (!find_alias_hup(data, alias_hups)) {
     203                        alias_hup_t *hup = (alias_hup_t *)calloc(1, sizeof(alias_hup_t));
     204                        if (hup == NULL) {
     205                                cli_error(CL_EFAIL, "%s: cannot allocate alias structure\n", PACKAGE_NAME);
     206                                rc = ENOMEM;
     207                                goto finit;
     208                        }
     209
     210                        hup->alias = data;
     211                        list_append(&hup->alias_hup_link, alias_hups);
     212
     213                        char *oldLine = usr->line;
     214                        const size_t input_length = str_size(usr->line) - str_size(cmd[0]) + str_size(data->value) + 1;
     215                        usr->line = (char *)malloc(input_length);
     216                        if (usr->line == NULL) {
     217                                cli_error(CL_EFAIL, "%s: cannot allocate input structure\n", PACKAGE_NAME);
     218                                rc = ENOMEM;
     219                                goto finit;
     220                        }
     221
     222                        usr->line[0] = '\0';
     223
     224                        unsigned int cmd_replace_index = cmd_token_start;
     225                        for (i = 0; i < tokens_length; i++) {
     226                                if (i == cmd_replace_index) {
     227                                        /* if there is a pipe symbol than cmd_token_start will point at the SPACE after the pipe symbol */
     228                                        if (tokens[i].type == TOKTYPE_SPACE) {
     229                                                cmd_replace_index++;
     230                                                str_append(usr->line, input_length, tokens[i].text);
     231                                                continue;
     232                                        }
     233
     234                                        str_append(usr->line, input_length, data->value);
     235                                } else {
     236                                        str_append(usr->line, input_length, tokens[i].text);
     237                                }
     238                        }
     239
     240                        /* reprocess input after string replace */
     241                        rc = process_input_nohup(usr, alias_hups, count_executed_hups + 1);
     242                        usr->line = oldLine;
     243                        goto finit;
     244                }
     245        }
     246
    173247        iostate_t new_iostate = {
    174248                .stdin = stdin,
     
    225299}
    226300
     301errno_t process_input(cliuser_t *usr)
     302{
     303        list_t alias_hups;
     304        list_initialize(&alias_hups);
     305
     306        errno_t rc = process_input_nohup(usr, &alias_hups, 0);
     307
     308        list_foreach_safe(alias_hups, cur_link, next_link) {
     309                alias_hup_t *cur_item = list_get_instance(cur_link, alias_hup_t, alias_hup_link);
     310                free(cur_item);
     311        }
     312
     313        return rc;
     314}
     315
    227316void print_pipe_usage(void)
    228317{
  • uspace/app/bdsh/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 LIBS = clui fmtutil
    32 EXTRA_CFLAGS = -I. -Icmds/ -Icmds/builtins -Icmds/modules
    33 BINARY = bdsh
     30deps = [ 'clui', 'fmtutil' ]
     31includes += include_directories('.', 'cmds', 'cmds/builtins', 'cmds/modules')
     32src = files(
     33        'cmds/builtin_cmds.c',
     34        'cmds/builtins/batch/batch.c',
     35        'cmds/builtins/builtin_aliases.c',
     36        'cmds/builtins/builtins.c',
     37        'cmds/builtins/cd/cd.c',
     38        'cmds/builtins/exit/exit.c',
     39        'cmds/mod_cmds.c',
     40        'cmds/modules/alias/alias.c',
     41        'cmds/modules/cat/cat.c',
     42        'cmds/modules/cmp/cmp.c',
     43        'cmds/modules/cp/cp.c',
     44        'cmds/modules/echo/echo.c',
     45        'cmds/modules/help/help.c',
     46        'cmds/modules/kcon/kcon.c',
     47        'cmds/modules/ls/ls.c',
     48        'cmds/modules/mkdir/mkdir.c',
     49        'cmds/modules/mkfile/mkfile.c',
     50        'cmds/modules/module_aliases.c',
     51        'cmds/modules/modules.c',
     52        'cmds/modules/mount/mount.c',
     53        'cmds/modules/mv/mv.c',
     54        'cmds/modules/printf/printf.c',
     55        'cmds/modules/pwd/pwd.c',
     56        'cmds/modules/rm/rm.c',
     57        'cmds/modules/sleep/sleep.c',
     58        'cmds/modules/touch/touch.c',
     59        'cmds/modules/unalias/unalias.c',
     60        'cmds/modules/unmount/unmount.c',
     61        'compl.c',
     62        'errors.c',
     63        'exec.c',
     64        'input.c',
     65        'scli.c',
     66        'tok.c',
     67        'util.c',
     68)
    3469
    35 SOURCES = \
    36         cmds/modules/module_aliases.c \
    37         cmds/modules/modules.c \
    38         cmds/modules/help/help.c \
    39         cmds/modules/mkdir/mkdir.c \
    40         cmds/modules/mkfile/mkfile.c \
    41         cmds/modules/rm/rm.c \
    42         cmds/modules/cat/cat.c \
    43         cmds/modules/touch/touch.c \
    44         cmds/modules/ls/ls.c \
    45         cmds/modules/pwd/pwd.c \
    46         cmds/modules/sleep/sleep.c \
    47         cmds/modules/cp/cp.c \
    48         cmds/modules/mv/mv.c \
    49         cmds/modules/printf/printf.c \
    50         cmds/modules/echo/echo.c \
    51         cmds/modules/mount/mount.c \
    52         cmds/modules/unmount/unmount.c \
    53         cmds/modules/kcon/kcon.c \
    54         cmds/modules/cmp/cmp.c \
    55         cmds/builtins/builtin_aliases.c \
    56         cmds/builtins/builtins.c \
    57         cmds/builtins/batch/batch.c \
    58         cmds/builtins/exit/exit.c \
    59         cmds/builtins/cd/cd.c \
    60         cmds/mod_cmds.c \
    61         cmds/builtin_cmds.c \
    62         compl.c \
    63         errors.c \
    64         input.c \
    65         util.c \
    66         exec.c \
    67         scli.c \
    68         tok.c
     70test_src = files(
     71        'tok.c',
     72        'test/toktest.c',
     73)
    6974
    70 TEST_SOURCES = \
    71         tok.c \
    72         test/toktest.c
    73 
    74 include $(USPACE_PREFIX)/Makefile.common
     75# TODO: install this file somewhere sane
     76installed_data += { 'name': 'demo.txt', 'dir': '/' }
  • uspace/app/bdsh/scli.c

    rb401b33 re28175d  
    11/*
    22 * Copyright (c) 2008 Tim Post
     3 * Copyright (c) 2018 Matthieu Riolo
    34 * All rights reserved.
    45 *
     
    3132#include <stddef.h>
    3233#include <str.h>
     34#include <adt/odict.h>
    3335#include "config.h"
    3436#include "scli.h"
     
    4244static iostate_t *iostate;
    4345static iostate_t stdiostate;
     46
     47odict_t alias_dict;
    4448
    4549/*
     
    5559 */
    5660const char *progname = PACKAGE_NAME;
     61
     62static int alias_cmp(void *a, void *b)
     63{
     64        return str_cmp((char *)a, (char *)b);
     65}
     66
     67static void *alias_key(odlink_t *odlink)
     68{
     69        return (void *)odict_get_instance(odlink, alias_t, odict)->name;
     70}
    5771
    5872/* These are not exposed, even to builtins */
     
    108122        iostate = &stdiostate;
    109123
     124        odict_initialize(&alias_dict, alias_key, alias_cmp);
     125
    110126        if (cli_init(&usr))
    111127                exit(EXIT_FAILURE);
  • uspace/app/bdsh/scli.h

    rb401b33 re28175d  
    11/*
    22 * Copyright (c) 2008 Tim Post
     3 * Copyright (c) 2018 Matthieu Riolo
    34 * All rights reserved.
    45 *
     
    3435#include <stdint.h>
    3536#include <stdio.h>
     37#include <types/adt/odict.h>
    3638
    3739typedef struct {
     
    5456extern void set_iostate(iostate_t *);
    5557
     58extern odict_t alias_dict;
     59
     60typedef struct {
     61        odlink_t odict;
     62        char *name;
     63        char *value;
     64} alias_t;
     65
    5666#endif
  • uspace/app/blkdump/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 BINARY = klog
    32 
    33 SOURCES = \
    34         klog.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     30deps = [ 'block', 'scsi' ]
     31src = files('blkdump.c')
  • uspace/app/contacts/meson.build

    rb401b33 re28175d  
    11#
    2 # Copyright (c) 2010 Martin Decky
     2# Copyright (c) 2018 Jiri Svoboda
    33# All rights reserved.
    44#
     
    2727#
    2828
    29 BOOT_OUTPUT =
    30 RAW =
    31 JOB =
    32 MAP =
    33 PREBUILD =
    34 BUILD = Makefile.empty
     29deps = [ 'clui', 'sif' ]
     30src = files('contacts.c')
  • uspace/app/cpptest/main.cpp

    rb401b33 re28175d  
    121121    ts.add<std::test::functional_test>();
    122122    ts.add<std::test::algorithm_test>();
     123    ts.add<std::test::future_test>();
    123124
    124125    return ts.run(true) ? 0 : 1;
  • uspace/app/date/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = date
    31 
    32 SOURCES = \
    33         date.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29src = files('date.c')
  • uspace/app/devctl/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = loc
    31 
    32 SOURCES = \
    33         loc.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29src = files('devctl.c')
  • uspace/app/df/df.c

    rb401b33 re28175d  
    3535 */
    3636
    37 #include <cap.h>
     37#include <capa.h>
    3838#include <stdbool.h>
    3939#include <stdio.h>
     
    124124static errno_t size_to_human_readable(uint64_t nblocks, size_t block_size, char **rptr)
    125125{
    126         cap_spec_t cap;
    127 
    128         cap_from_blocks(nblocks, block_size, &cap);
    129         cap_simplify(&cap);
    130         return cap_format(&cap, rptr);
     126        capa_spec_t capa;
     127
     128        capa_from_blocks(nblocks, block_size, &capa);
     129        capa_simplify(&capa);
     130        return capa_format(&capa, rptr);
    131131}
    132132
  • uspace/app/df/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = df
    31 
    32 SOURCES = \
    33         df.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29src = files('df.c')
  • uspace/app/download/main.c

    rb401b33 re28175d  
    4949#define NAME "download"
    5050#ifdef TIMESTAMP_UNIX
    51 #define VERSION STRING(RELEASE) "-" STRING(TIMESTAMP_UNIX)
     51#define VERSION STRING(HELENOS_RELEASE) "-" STRING(TIMESTAMP_UNIX)
    5252#else
    53 #define VERSION STRING(RELEASE)
     53#define VERSION STRING(HELENOS_RELEASE)
    5454#endif
    5555#define USER_AGENT "HelenOS-" NAME "/" VERSION
  • uspace/app/download/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../../..
    30 LIBS = graph
    31 BINARY = rfb
    32 
    33 SOURCES = \
    34         main.c \
    35         rfb.c
    36 
    37 include $(USPACE_PREFIX)/Makefile.common
     29deps = [ 'http', 'uri' ]
     30c_args += ('-DRELEASE=' + HELENOS_RELEASE)
     31src = files('main.c')
  • uspace/app/edit/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 BINARY = redir
    32 
    33 SOURCES = \
    34         redir.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     30src = files(
     31        'edit.c',
     32        'search.c',
     33        'sheet.c',
     34)
  • uspace/app/fdisk/fdisk.c

    rb401b33 re28175d  
    3434 */
    3535
    36 #include <cap.h>
     36#include <capa.h>
    3737#include <errno.h>
    3838#include <fdisk.h>
     
    136136        nchoice_t *choice = NULL;
    137137        char *svcname = NULL;
    138         cap_spec_t cap;
     138        capa_spec_t capa;
    139139        fdisk_dev_info_t *sdev;
    140         char *scap = NULL;
     140        char *scapa = NULL;
    141141        char *dtext = NULL;
    142142        service_id_t svcid;
     
    177177                }
    178178
    179                 rc = fdisk_dev_info_capacity(info, &cap);
     179                rc = fdisk_dev_info_capacity(info, &capa);
    180180                if (rc != EOK) {
    181181                        printf("Error getting device capacity "
     
    185185                }
    186186
    187                 cap_simplify(&cap);
    188 
    189                 rc = cap_format(&cap, &scap);
     187                capa_simplify(&capa);
     188
     189                rc = capa_format(&capa, &scapa);
    190190                if (rc != EOK) {
    191191                        assert(rc == ENOMEM);
     
    194194                }
    195195
    196                 int ret = asprintf(&dtext, "%s (%s)", svcname, scap);
     196                int ret = asprintf(&dtext, "%s (%s)", svcname, scapa);
    197197                if (ret < 0) {
    198198                        rc = ENOMEM;
     
    203203                free(svcname);
    204204                svcname = NULL;
    205                 free(scap);
    206                 scap = NULL;
     205                free(scapa);
     206                scapa = NULL;
    207207
    208208                rc = nchoice_add(choice, dtext, info, 0);
     
    261261        free(dtext);
    262262        free(svcname);
    263         free(scap);
     263        free(scapa);
    264264        return rc;
    265265}
     
    432432        errno_t rc;
    433433        fdisk_part_spec_t pspec;
    434         cap_spec_t cap;
    435         cap_spec_t mcap;
     434        capa_spec_t capa;
     435        capa_spec_t mcapa;
    436436        vol_label_supp_t vlsupp;
    437437        vol_fstype_t fstype = 0;
    438438        tinput_t *tinput = NULL;
    439439        fdisk_spc_t spc;
    440         char *scap;
    441         char *smcap = NULL;
     440        char *scapa;
     441        char *smcapa = NULL;
    442442        char *label = NULL;
    443443        char *mountp = NULL;
     
    448448                spc = spc_pri;
    449449
    450         rc = fdisk_part_get_max_avail(dev, spc, &mcap);
     450        rc = fdisk_part_get_max_avail(dev, spc, &mcapa);
    451451        if (rc != EOK) {
    452452                rc = EIO;
     
    454454        }
    455455
    456         cap_simplify(&mcap);
    457 
    458         rc = cap_format(&mcap, &smcap);
     456        capa_simplify(&mcapa);
     457
     458        rc = capa_format(&mcapa, &smcapa);
    459459        if (rc != EOK) {
    460460                rc = ENOMEM;
     
    474474        while (true) {
    475475                printf("Enter capacity of new partition.\n");
    476                 rc = tinput_read_i(tinput, smcap, &scap);
     476                rc = tinput_read_i(tinput, smcapa, &scapa);
    477477                if (rc != EOK)
    478478                        goto error;
    479479
    480                 rc = cap_parse(scap, &cap);
     480                rc = capa_parse(scapa, &capa);
    481481                if (rc == EOK)
    482482                        break;
     
    485485        tinput_destroy(tinput);
    486486        tinput = NULL;
    487         free(smcap);
    488         smcap = NULL;
     487        free(smcapa);
     488        smcapa = NULL;
    489489
    490490        if (pkind != lpk_extended) {
     
    545545
    546546        fdisk_pspec_init(&pspec);
    547         pspec.capacity = cap;
     547        pspec.capacity = capa;
    548548        pspec.pkind = pkind;
    549549        pspec.fstype = fstype;
     
    561561        return EOK;
    562562error:
    563         free(smcap);
     563        free(smcapa);
    564564        free(label);
    565565        free(mountp);
     
    581581        fdisk_part_t *part;
    582582        fdisk_part_info_t pinfo;
    583         char *scap = NULL;
     583        char *scapa = NULL;
    584584        char *spkind = NULL;
    585585        char *sfstype = NULL;
     
    596596                }
    597597
    598                 cap_simplify(&pinfo.capacity);
    599 
    600                 rc = cap_format(&pinfo.capacity, &scap);
     598                capa_simplify(&pinfo.capacity);
     599
     600                rc = capa_format(&pinfo.capacity, &scapa);
    601601                if (rc != EOK) {
    602602                        printf("Out of memory.\n");
     
    623623
    624624                        int ret = asprintf(&sdesc, "%s %s, %s, %s", label,
    625                             scap, spkind, sfstype);
     625                            scapa, spkind, sfstype);
    626626                        if (ret < 0) {
    627627                                rc = ENOMEM;
     
    630630
    631631                } else {
    632                         int ret = asprintf(&sdesc, "%s, %s", scap, spkind);
     632                        int ret = asprintf(&sdesc, "%s, %s", scapa, spkind);
    633633                        if (ret < 0) {
    634634                                rc = ENOMEM;
     
    644644                }
    645645
    646                 free(scap);
    647                 scap = NULL;
     646                free(scapa);
     647                scapa = NULL;
    648648                free(spkind);
    649649                spkind = NULL;
     
    658658        return EOK;
    659659error:
    660         free(scap);
     660        free(scapa);
    661661        free(spkind);
    662662        free(sfstype);
     
    907907        fdisk_part_t *part;
    908908        fdisk_part_info_t pinfo;
    909         cap_spec_t cap;
    910         cap_spec_t mcap;
     909        capa_spec_t capa;
     910        capa_spec_t mcapa;
    911911        fdisk_dev_flags_t dflags;
    912912        char *sltype = NULL;
    913         char *sdcap = NULL;
    914         char *scap = NULL;
    915         char *smcap = NULL;
     913        char *sdcapa = NULL;
     914        char *scapa = NULL;
     915        char *smcapa = NULL;
    916916        char *sfstype = NULL;
    917917        char *svcname = NULL;
     
    936936        }
    937937
    938         rc = fdisk_dev_capacity(dev, &cap);
     938        rc = fdisk_dev_capacity(dev, &capa);
    939939        if (rc != EOK) {
    940940                printf("Error getting device capacity.\n");
     
    942942        }
    943943
    944         cap_simplify(&cap);
    945 
    946         rc = cap_format(&cap, &sdcap);
     944        capa_simplify(&capa);
     945
     946        rc = capa_format(&capa, &sdcapa);
    947947        if (rc != EOK) {
    948948                printf("Out of memory.\n");
     
    958958        fdisk_dev_get_flags(dev, &dflags);
    959959
    960         printf("Device: %s (%s)\n", svcname, sdcap);
    961         free(sdcap);
    962         sdcap = NULL;
     960        printf("Device: %s (%s)\n", svcname, sdcapa);
     961        free(sdcapa);
     962        sdcapa = NULL;
    963963
    964964        rc = fdisk_label_get_info(dev, &linfo);
     
    996996                }
    997997
    998                 cap_simplify(&pinfo.capacity);
    999 
    1000                 rc = cap_format(&pinfo.capacity, &scap);
     998                capa_simplify(&pinfo.capacity);
     999
     1000                rc = capa_format(&pinfo.capacity, &scapa);
    10011001                if (rc != EOK) {
    10021002                        printf("Out of memory.\n");
     
    10161016
    10171017                if (linfo.ltype == lt_none)
    1018                         printf("Entire disk: %s %s", label, scap);
     1018                        printf("Entire disk: %s %s", label, scapa);
    10191019                else
    1020                         printf("Partition %d: %s %s", npart, label, scap);
     1020                        printf("Partition %d: %s %s", npart, label, scapa);
    10211021
    10221022                if ((linfo.flags & lf_ext_supp) != 0) {
     
    10371037                printf("\n");
    10381038
    1039                 free(scap);
    1040                 scap = NULL;
     1039                free(scapa);
     1040                scapa = NULL;
    10411041                free(sfstype);
    10421042                sfstype = NULL;
     
    10471047        /* Display available space */
    10481048        if ((linfo.flags & lf_can_create_pri) != 0) {
    1049                 rc = fdisk_part_get_max_avail(dev, spc_pri, &mcap);
     1049                rc = fdisk_part_get_max_avail(dev, spc_pri, &mcapa);
    10501050                if (rc != EOK) {
    10511051                        rc = EIO;
     
    10531053                }
    10541054
    1055                 cap_simplify(&mcap);
    1056 
    1057                 rc = cap_format(&mcap, &smcap);
     1055                capa_simplify(&mcapa);
     1056
     1057                rc = capa_format(&mcapa, &smcapa);
    10581058                if (rc != EOK) {
    10591059                        rc = ENOMEM;
     
    10621062
    10631063                if ((linfo.flags & lf_ext_supp) != 0)
    1064                         printf("Maximum free primary block: %s\n", smcap);
     1064                        printf("Maximum free primary block: %s\n", smcapa);
    10651065                else
    1066                         printf("Maximum free block: %s\n", smcap);
    1067 
    1068                 free(smcap);
    1069                 smcap = NULL;
    1070 
    1071                 rc = fdisk_part_get_tot_avail(dev, spc_pri, &mcap);
     1066                        printf("Maximum free block: %s\n", smcapa);
     1067
     1068                free(smcapa);
     1069                smcapa = NULL;
     1070
     1071                rc = fdisk_part_get_tot_avail(dev, spc_pri, &mcapa);
    10721072                if (rc != EOK) {
    10731073                        rc = EIO;
     
    10751075                }
    10761076
    1077                 cap_simplify(&mcap);
    1078 
    1079                 rc = cap_format(&mcap, &smcap);
     1077                capa_simplify(&mcapa);
     1078
     1079                rc = capa_format(&mcapa, &smcapa);
    10801080                if (rc != EOK) {
    10811081                        rc = ENOMEM;
     
    10841084
    10851085                if ((linfo.flags & lf_ext_supp) != 0)
    1086                         printf("Total free primary space: %s\n", smcap);
     1086                        printf("Total free primary space: %s\n", smcapa);
    10871087                else
    1088                         printf("Total free space: %s\n", smcap);
    1089 
    1090                 free(smcap);
    1091                 smcap = NULL;
     1088                        printf("Total free space: %s\n", smcapa);
     1089
     1090                free(smcapa);
     1091                smcapa = NULL;
    10921092        }
    10931093
    10941094        /* Display available space */
    10951095        if ((linfo.flags & lf_can_create_log) != 0) {
    1096                 rc = fdisk_part_get_max_avail(dev, spc_log, &mcap);
     1096                rc = fdisk_part_get_max_avail(dev, spc_log, &mcapa);
    10971097                if (rc != EOK) {
    10981098                        rc = EIO;
     
    11001100                }
    11011101
    1102                 cap_simplify(&mcap);
    1103 
    1104                 rc = cap_format(&mcap, &smcap);
     1102                capa_simplify(&mcapa);
     1103
     1104                rc = capa_format(&mcapa, &smcapa);
    11051105                if (rc != EOK) {
    11061106                        rc = ENOMEM;
     
    11081108                }
    11091109
    1110                 printf("Maximum free logical block: %s\n", smcap);
    1111                 free(smcap);
    1112                 smcap = NULL;
    1113 
    1114                 rc = fdisk_part_get_tot_avail(dev, spc_log, &mcap);
     1110                printf("Maximum free logical block: %s\n", smcapa);
     1111                free(smcapa);
     1112                smcapa = NULL;
     1113
     1114                rc = fdisk_part_get_tot_avail(dev, spc_log, &mcapa);
    11151115                if (rc != EOK) {
    11161116                        rc = EIO;
     
    11181118                }
    11191119
    1120                 cap_simplify(&mcap);
    1121 
    1122                 rc = cap_format(&mcap, &smcap);
     1120                capa_simplify(&mcapa);
     1121
     1122                rc = capa_format(&mcapa, &smcapa);
    11231123                if (rc != EOK) {
    11241124                        rc = ENOMEM;
     
    11261126                }
    11271127
    1128                 printf("Total free logical space: %s\n", smcap);
    1129                 free(smcap);
    1130                 smcap = NULL;
     1128                printf("Total free logical space: %s\n", smcapa);
     1129                free(smcapa);
     1130                smcapa = NULL;
    11311131        }
    11321132
     
    12791279        return EOK;
    12801280error:
    1281         free(sdcap);
    1282         free(scap);
    1283         free(smcap);
     1281        free(sdcapa);
     1282        free(scapa);
     1283        free(smcapa);
    12841284        free(sfstype);
    12851285        free(svcname);
  • uspace/app/fontviewer/fontviewer.c

    rb401b33 re28175d  
    4141#include <window.h>
    4242#include <canvas.h>
    43 #include <surface.h>
    44 #include <codec/tga.h>
     43#include <draw/surface.h>
     44#include <draw/codec.h>
    4545#include <task.h>
    46 #include <drawctx.h>
    47 #include <font/embedded.h>
    48 #include <font/pcf.h>
     46#include <draw/drawctx.h>
     47#include <draw/font.h>
    4948#include <stdarg.h>
    5049#include <io/verify.h>
  • uspace/app/getterm/version.c

    rb401b33 re28175d  
    3939#include "version.h"
    4040
    41 static const char *copyright = STRING(COPYRIGHT);
    42 static const char *release = STRING(RELEASE);
    43 static const char *name = STRING(NAME);
     41static const char *copyright = STRING(HELENOS_COPYRIGHT);
     42static const char *release = STRING(HELENOS_RELEASE);
     43static const char *name = STRING(HELENOS_CODENAME);
    4444static const char *arch = STRING(UARCH);
    4545
  • uspace/app/gunzip/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = pkg
    31 
    32 SOURCES = \
    33         pkg.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29deps = [ 'compress' ]
     30src = files('gunzip.c')
  • uspace/app/hbench/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = contacts
    31 LIBS = clui sif
    32 
    33 SOURCES = \
    34         contacts.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     29deps = [ 'math' ]
     30src = files(
     31        'benchlist.c',
     32        'csv.c',
     33        'env.c',
     34        'main.c',
     35        'utils.c',
     36        'fs/dirread.c',
     37        'fs/fileread.c',
     38        'ipc/ns_ping.c',
     39        'ipc/ping_pong.c',
     40        'malloc/malloc1.c',
     41        'malloc/malloc2.c',
     42        'synch/fibril_mutex.c',
     43)
  • uspace/app/inet/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = inet
    31 
    32 SOURCES = \
    33         inet.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29src = files('inet.c')
  • uspace/app/init/init.c

    rb401b33 re28175d  
    5151#include "init.h"
    5252
     53#define BANNER_LEFT   "######> "
     54#define BANNER_RIGHT  " <######"
     55
    5356#define ROOT_DEVICE       "bd/initrd"
    5457#define ROOT_MOUNT_POINT  "/"
     
    8184{
    8285        printf("%s: HelenOS init\n", NAME);
     86}
     87
     88static void oom_check(errno_t rc, const char *path)
     89{
     90        if (rc == ENOMEM) {
     91                printf("%sOut-of-memory condition detected%s\n", BANNER_LEFT,
     92                    BANNER_RIGHT);
     93                printf("%sBailing out of the boot process after %s%s\n",
     94                    BANNER_LEFT, path, BANNER_RIGHT);
     95                printf("%sMore physical memory is required%s\n", BANNER_LEFT,
     96                    BANNER_RIGHT);
     97                exit(ENOMEM);
     98        }
    8399}
    84100
     
    199215
    200216        if (rc != EOK) {
     217                oom_check(rc, path);
    201218                printf("%s: Error spawning %s (%s)\n", NAME, path,
    202219                    str_error(rc));
     
    279296        errno_t rc = task_spawnl(&id, &wait, app, app, winreg, NULL);
    280297        if (rc != EOK) {
     298                oom_check(rc, app);
    281299                printf("%s: Error spawning %s %s (%s)\n", NAME, app,
    282300                    winreg, str_error(rc));
    283                 return -1;
     301                return rc;
    284302        }
    285303
     
    290308                printf("%s: Error retrieving retval from %s (%s)\n", NAME,
    291309                    app, str_error(rc));
    292                 return -1;
     310                return rc;
    293311        }
    294312
     
    304322                errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
    305323                    LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL);
    306                 if (rc != EOK)
     324                if (rc != EOK) {
     325                        oom_check(rc, APP_GETTERM);
    307326                        printf("%s: Error spawning %s %s %s --msg --wait -- %s\n",
    308327                            NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
     328                }
    309329        } else {
    310330                printf("%s: Spawning %s %s %s --wait -- %s\n", NAME,
     
    313333                errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
    314334                    LOCFS_MOUNT_POINT, "--wait", "--", app, NULL);
    315                 if (rc != EOK)
     335                if (rc != EOK) {
     336                        oom_check(rc, APP_GETTERM);
    316337                        printf("%s: Error spawning %s %s %s --wait -- %s\n",
    317338                            NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
     339                }
    318340        }
    319341}
  • uspace/app/init/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 BINARY = stats
    32 
    33 SOURCES = \
    34         stats.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     30deps = [ 'untar', 'block' ]
     31link_args += '-static'
     32src = files('init.c', 'untar.c')
  • uspace/app/killall/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 ENDIANESS = LE
     29src = files('killall.c')
  • uspace/app/logset/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = logset
    31 
    32 SOURCES = \
    33         main.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29src = files('main.c')
  • uspace/app/meson.build

    rb401b33 re28175d  
    11#
    2 # Copyright (c) 2005 Martin Decky
    3 # Copyright (c) 2007 Jakub Jermar
    4 # Copyright (c) 2012 Julia Medvedeva
     2# Copyright (c) 2019 Jiří Zárevúcky
    53# All rights reserved.
    64#
     
    2927#
    3028
    31 USPACE_PREFIX = ../../..
    32 LIBS = block fs
    33 BINARY = udf
     29apps = [
     30        'barber',
     31        'bdsh',
     32        'bithenge',
     33        'blkdump',
     34        'contacts',
     35        'corecfg',
     36        'cpptest',
     37        'date',
     38        'devctl',
     39        'df',
     40        'dnscfg',
     41        'dnsres',
     42        'download',
     43        'edit',
     44        'fdisk',
     45        'fontviewer',
     46        'getterm',
     47        'gunzip',
     48        'hbench',
     49        'inet',
     50        'init',
     51        'kill',
     52        'killall',
     53        'kio',
     54        'loc',
     55        'logset',
     56        'lprint',
     57        'mixerctl',
     58        'mkbd',
     59        'mkexfat',
     60        'mkext4',
     61        'mkfat',
     62        'mkmfs',
     63        'modplay',
     64        'netecho',
     65        'nic',
     66        'nterm',
     67        'pci',
     68        'ping',
     69        'pkg',
     70        'redir',
     71        'sbi',
     72        'sportdmp',
     73        'stats',
     74        'sysinfo',
     75        'sysinst',
     76        'taskdump',
     77        'tester',
     78        'testread',
     79        'testrunner',
     80        'testwrit',
     81        'tetris',
     82        'tmon',
     83        'top',
     84        'trace',
     85        'untar',
     86        'usbinfo',
     87        'vcalc',
     88        'vdemo',
     89        'viewer',
     90        'vlaunch',
     91        'vol',
     92        'vterm',
     93        'vuhid',
     94        'wavplay',
     95        'websrv',
     96        'wifi_supplicant',
     97]
    3498
    35 SOURCES = \
    36         udf.c \
    37         udf_volume.c \
    38         udf_ops.c \
    39         udf_osta.c \
    40         udf_cksum.c \
    41         udf_file.c \
    42         udf_idx.c
    43 
    44 include $(USPACE_PREFIX)/Makefile.common
     99if CONFIG_BUILD_SHARED_LIBS
     100        apps += [
     101                'dltest',
     102                'dltests',
     103        ]
     104endif
  • uspace/app/mkext4/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = lprint
    31 
    32 SOURCES = \
    33         lprint.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29# FIXME remove transitive deps
     30deps = [ 'ext4', 'fs', 'block', 'crypto' ]
     31src = files('mkext4.c')
  • uspace/app/modplay/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../../..
    30 LIBS = drv pcm
    31 BINARY = hdaudio
     29deps = [ 'trackmod', 'hound', 'pcm' ]
     30src = files('modplay.c')
    3231
    33 SOURCES = \
    34         codec.c \
    35         regif.c \
    36         hdactl.c \
    37         hdaudio.c \
    38         pcm_iface.c \
    39         stream.c
    40 
    41 include $(USPACE_PREFIX)/Makefile.common
     32if install_nonessential_data
     33        # TODO: install this file somewhere sane
     34        installed_data += { 'name': 'demo.xm', 'dir': '/' }
     35endif
  • uspace/app/pci/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = pci
    31 
    32 SOURCES = \
    33         pci.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29src = files('pci.c')
  • uspace/app/pkg/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = vol
    31 
    32 SOURCES = \
    33         vol.c
    34 
    35 include $(USPACE_PREFIX)/Makefile.common
     29src = files('pkg.c')
  • uspace/app/redir/meson.build

    rb401b33 re28175d  
    11#
    22# Copyright (c) 2005 Martin Decky
     3# Copyright (c) 2007 Jakub Jermar
    34# All rights reserved.
    45#
     
    2728#
    2829
    29 ENDIANESS = LE
    30 
    31 BFD_NAME = elf64-littleriscv
    32 BFD_ARCH = riscv
     30src = files('redir.c')
  • uspace/app/sbi/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 LIBS =
    31 EXTRA_CFLAGS =
    32 BINARY = kill
    33 
    34 SOURCES = \
    35         kill.c
    36 
    37 include $(USPACE_PREFIX)/Makefile.common
     29deps = [ 'clui' ]
     30c_args += '-D__HELENOS__'
     31src = files(
     32        'src/builtin/bi_boxed.c',
     33        'src/builtin/bi_error.c',
     34        'src/builtin/bi_char.c',
     35        'src/builtin/bi_console.c',
     36        'src/builtin/bi_int.c',
     37        'src/builtin/bi_task.c',
     38        'src/builtin/bi_textfile.c',
     39        'src/builtin/bi_string.c',
     40        'src/os/helenos.c',
     41        'src/ancr.c',
     42        'src/bigint.c',
     43        'src/builtin.c',
     44        'src/cspan.c',
     45        'src/imode.c',
     46        'src/input.c',
     47        'src/intmap.c',
     48        'src/lex.c',
     49        'src/list.c',
     50        'src/main.c',
     51        'src/p_expr.c',
     52        'src/p_type.c',
     53        'src/parse.c',
     54        'src/program.c',
     55        'src/rdata.c',
     56        'src/run.c',
     57        'src/run_expr.c',
     58        'src/run_texpr.c',
     59        'src/stree.c',
     60        'src/strtab.c',
     61        'src/stype.c',
     62        'src/stype_expr.c',
     63        'src/symbol.c',
     64        'src/tdata.c',
     65)
  • uspace/app/stats/stats.c

    rb401b33 re28175d  
    5252#define MINUTE  60
    5353
     54#define KERNEL_NAME  "kernel"
     55#define INIT_PREFIX  "init:"
     56
     57typedef enum {
     58        LIST_TASKS,
     59        LIST_THREADS,
     60        LIST_IPCCS,
     61        LIST_CPUS,
     62        PRINT_LOAD,
     63        PRINT_UPTIME,
     64        PRINT_ARCH
     65} output_toggle_t;
     66
    5467static void list_tasks(void)
    5568{
     
    6578            " [kcycles] [name\n");
    6679
    67         size_t i;
    68         for (i = 0; i < count; i++) {
     80        for (size_t i = 0; i < count; i++) {
    6981                uint64_t resmem;
    7082                uint64_t virtmem;
     
    103115        printf("[taskid] [threadid] [state ] [prio] [cpu ] [ucycles] [kcycles]\n");
    104116
    105         size_t i;
    106         for (i = 0; i < count; i++) {
     117        for (size_t i = 0; i < count; i++) {
    107118                if ((all) || (stats_threads[i].task_id == task_id)) {
    108119                        uint64_t ucycles, kcycles;
     
    130141}
    131142
     143static void list_ipccs(task_id_t task_id, bool all)
     144{
     145        size_t count;
     146        stats_ipcc_t *stats_ipccs = stats_get_ipccs(&count);
     147
     148        if (stats_ipccs == NULL) {
     149                fprintf(stderr, "%s: Unable to get IPC connections\n", NAME);
     150                return;
     151        }
     152
     153        printf("[caller] [callee]\n");
     154
     155        for (size_t i = 0; i < count; i++) {
     156                if ((all) || (stats_ipccs[i].caller == task_id)) {
     157                        printf("%-8" PRIu64 " %-8" PRIu64 "\n",
     158                            stats_ipccs[i].caller, stats_ipccs[i].callee);
     159                }
     160        }
     161
     162        free(stats_ipccs);
     163}
     164
    132165static void list_cpus(void)
    133166{
     
    142175        printf("[id] [MHz     ] [busy cycles] [idle cycles]\n");
    143176
    144         size_t i;
    145         for (i = 0; i < count; i++) {
     177        for (size_t i = 0; i < count; i++) {
    146178                printf("%-4u ", cpus[i].id);
    147179                if (cpus[i].active) {
     
    174206        printf("%s: Load average: ", NAME);
    175207
    176         size_t i;
    177         for (i = 0; i < count; i++) {
     208        for (size_t i = 0; i < count; i++) {
    178209                if (i > 0)
    179210                        printf(" ");
     
    197228}
    198229
     230static char *escape_dot(const char *str)
     231{
     232        size_t size = 0;
     233        for (size_t i = 0; str[i] != 0; i++) {
     234                if (str[i] == '"')
     235                        size++;
     236
     237                size++;
     238        }
     239
     240        char *escaped_str = calloc(size + 1, sizeof(char));
     241        if (escaped_str == NULL)
     242                return NULL;
     243
     244        size_t pos = 0;
     245        for (size_t i = 0; str[i] != 0; i++) {
     246                if (str[i] == '"') {
     247                        escaped_str[pos] = '\\';
     248                        pos++;
     249                }
     250
     251                escaped_str[pos] = str[i];
     252                pos++;
     253        }
     254
     255        escaped_str[pos] = 0;
     256
     257        return escaped_str;
     258}
     259
     260static void print_arch(void)
     261{
     262        size_t count_tasks;
     263        stats_task_t *stats_tasks = stats_get_tasks(&count_tasks);
     264
     265        if (stats_tasks == NULL) {
     266                fprintf(stderr, "%s: Unable to get tasks\n", NAME);
     267                return;
     268        }
     269
     270        size_t count_ipccs;
     271        stats_ipcc_t *stats_ipccs = stats_get_ipccs(&count_ipccs);
     272
     273        if (stats_ipccs == NULL) {
     274                fprintf(stderr, "%s: Unable to get IPC connections\n", NAME);
     275                return;
     276        }
     277
     278        /* Global dot language attributes */
     279        printf("digraph HelenOS {\n");
     280        printf("\tlayout=sfdp\n");
     281        printf("\t// layout=neato\n");
     282        printf("\tsplines=true\n");
     283        printf("\t// splines=ortho\n");
     284        printf("\tconcentrate=true\n");
     285        printf("\tcenter=true\n");
     286        printf("\toverlap=false\n");
     287        printf("\toutputorder=edgesfirst\n");
     288        printf("\tfontsize=12\n");
     289        printf("\tnode [shape=component style=filled color=red "
     290            "fillcolor=yellow]\n\t\n");
     291
     292        bool kernel_found = false;
     293        task_id_t kernel_id = 0;
     294
     295        /* Tasks as vertices (components) */
     296        for (size_t i = 0; i < count_tasks; i++) {
     297                /* Kernel task */
     298                bool kernel = (str_cmp(stats_tasks[i].name, KERNEL_NAME) == 0);
     299
     300                /* Init task */
     301                bool init = str_test_prefix(stats_tasks[i].name, INIT_PREFIX);
     302
     303                char *escaped_name = NULL;
     304
     305                if (init)
     306                        escaped_name = escape_dot(str_suffix(stats_tasks[i].name,
     307                            str_length(INIT_PREFIX)));
     308                else
     309                        escaped_name = escape_dot(stats_tasks[i].name);
     310
     311                if (escaped_name == NULL)
     312                        continue;
     313
     314                if (kernel) {
     315                        if (kernel_found) {
     316                                fprintf(stderr, "%s: Duplicate kernel tasks\n", NAME);
     317                        } else {
     318                                kernel_found = true;
     319                                kernel_id = stats_tasks[i].task_id;
     320                        }
     321
     322                        printf("\ttask%" PRIu64 " [label=\"%s\" shape=invtrapezium "
     323                            "fillcolor=gold]\n", stats_tasks[i].task_id, escaped_name);
     324                } else if (init)
     325                        printf("\ttask%" PRIu64 " [label=\"%s\" fillcolor=orange]\n",
     326                            stats_tasks[i].task_id, escaped_name);
     327                else
     328                        printf("\ttask%" PRIu64 " [label=\"%s\"]\n", stats_tasks[i].task_id,
     329                            escaped_name);
     330
     331                free(escaped_name);
     332        }
     333
     334        printf("\t\n");
     335
     336        if (kernel_found) {
     337                /*
     338                 * Add an invisible edge from all user
     339                 * space tasks to the kernel to increase
     340                 * the kernel ranking.
     341                 */
     342
     343                for (size_t i = 0; i < count_tasks; i++) {
     344                        /* Skip the kernel itself */
     345                        if (stats_tasks[i].task_id == kernel_id)
     346                                continue;
     347
     348                        printf("\ttask%" PRIu64 " -> task%" PRIu64 " [style=\"invis\"]\n",
     349                            stats_tasks[i].task_id, kernel_id);
     350                }
     351        }
     352
     353        printf("\t\n");
     354
     355        /* IPC connections as edges */
     356        for (size_t i = 0; i < count_ipccs; i++) {
     357                printf("\ttask%" PRIu64 " -> task%" PRIu64 "\n",
     358                    stats_ipccs[i].caller, stats_ipccs[i].callee);
     359        }
     360
     361        printf("}\n");
     362
     363        free(stats_tasks);
     364        free(stats_ipccs);
     365}
     366
    199367static void usage(const char *name)
    200368{
    201369        printf(
    202             "Usage: %s [-t task_id] [-a] [-c] [-l] [-u]\n"
     370            "Usage: %s [-t task_id] [-i task_id] [-at] [-ai] [-c] [-l] [-u] [-d]\n"
    203371            "\n"
    204372            "Options:\n"
    205             "\t-t task_id\n"
    206             "\t--task=task_id\n"
     373            "\t-t task_id | --task=task_id\n"
    207374            "\t\tList threads of the given task\n"
    208375            "\n"
    209             "\t-a\n"
    210             "\t--all\n"
     376            "\t-i task_id | --ipcc=task_id\n"
     377            "\t\tList IPC connections of the given task\n"
     378            "\n"
     379            "\t-at | --all-threads\n"
    211380            "\t\tList all threads\n"
    212381            "\n"
    213             "\t-c\n"
    214             "\t--cpus\n"
     382            "\t-ai | --all-ipccs\n"
     383            "\t\tList all IPC connections\n"
     384            "\n"
     385            "\t-c | --cpus\n"
    215386            "\t\tList CPUs\n"
    216387            "\n"
    217             "\t-l\n"
    218             "\t--load\n"
     388            "\t-l | --load\n"
    219389            "\t\tPrint system load\n"
    220390            "\n"
    221             "\t-u\n"
    222             "\t--uptime\n"
     391            "\t-u | --uptime\n"
    223392            "\t\tPrint system uptime\n"
    224393            "\n"
    225             "\t-h\n"
    226             "\t--help\n"
     394            "\t-d | --design\n"
     395            "\t\tPrint the current system architecture graph\n"
     396            "\n"
     397            "\t-h | --help\n"
    227398            "\t\tPrint this usage information\n"
    228399            "\n"
     
    233404int main(int argc, char *argv[])
    234405{
    235         bool toggle_tasks = true;
    236         bool toggle_threads = false;
     406        output_toggle_t output_toggle = LIST_TASKS;
    237407        bool toggle_all = false;
    238         bool toggle_cpus = false;
    239         bool toggle_load = false;
    240         bool toggle_uptime = false;
    241 
    242408        task_id_t task_id = 0;
    243409
    244         int i;
    245         for (i = 1; i < argc; i++) {
     410        for (int i = 1; i < argc; i++) {
    246411                int off;
    247412
     
    252417                }
    253418
     419                /* All IPC connections */
     420                if ((off = arg_parse_short_long(argv[i], "-ai", "--all-ipccs")) != -1) {
     421                        output_toggle = LIST_IPCCS;
     422                        toggle_all = true;
     423                        continue;
     424                }
     425
    254426                /* All threads */
    255                 if ((off = arg_parse_short_long(argv[i], "-a", "--all")) != -1) {
    256                         toggle_tasks = false;
    257                         toggle_threads = true;
     427                if ((off = arg_parse_short_long(argv[i], "-at", "--all-threads")) != -1) {
     428                        output_toggle = LIST_THREADS;
    258429                        toggle_all = true;
    259430                        continue;
    260431                }
    261432
    262                 /* CPUs */
    263                 if ((off = arg_parse_short_long(argv[i], "-c", "--cpus")) != -1) {
    264                         toggle_tasks = false;
    265                         toggle_cpus = true;
    266                         continue;
    267                 }
    268 
    269                 /* Threads */
     433                /* IPC connections */
     434                if ((off = arg_parse_short_long(argv[i], "-i", "--ipcc=")) != -1) {
     435                        // TODO: Support for 64b range
     436                        int tmp;
     437                        errno_t ret = arg_parse_int(argc, argv, &i, &tmp, off);
     438                        if (ret != EOK) {
     439                                printf("%s: Malformed task id '%s'\n", NAME, argv[i]);
     440                                return -1;
     441                        }
     442
     443                        task_id = tmp;
     444
     445                        output_toggle = LIST_IPCCS;
     446                        continue;
     447                }
     448
     449                /* Tasks */
    270450                if ((off = arg_parse_short_long(argv[i], "-t", "--task=")) != -1) {
    271451                        // TODO: Support for 64b range
     
    273453                        errno_t ret = arg_parse_int(argc, argv, &i, &tmp, off);
    274454                        if (ret != EOK) {
    275                                 printf("%s: Malformed task_id '%s'\n", NAME, argv[i]);
     455                                printf("%s: Malformed task id '%s'\n", NAME, argv[i]);
    276456                                return -1;
    277457                        }
     
    279459                        task_id = tmp;
    280460
    281                         toggle_tasks = false;
    282                         toggle_threads = true;
     461                        output_toggle = LIST_THREADS;
     462                        continue;
     463                }
     464
     465                /* CPUs */
     466                if ((off = arg_parse_short_long(argv[i], "-c", "--cpus")) != -1) {
     467                        output_toggle = LIST_CPUS;
    283468                        continue;
    284469                }
     
    286471                /* Load */
    287472                if ((off = arg_parse_short_long(argv[i], "-l", "--load")) != -1) {
    288                         toggle_tasks = false;
    289                         toggle_load = true;
     473                        output_toggle = PRINT_LOAD;
    290474                        continue;
    291475                }
     
    293477                /* Uptime */
    294478                if ((off = arg_parse_short_long(argv[i], "-u", "--uptime")) != -1) {
    295                         toggle_tasks = false;
    296                         toggle_uptime = true;
    297                         continue;
    298                 }
    299         }
    300 
    301         if (toggle_tasks)
     479                        output_toggle = PRINT_UPTIME;
     480                        continue;
     481                }
     482
     483                /* Architecture */
     484                if ((off = arg_parse_short_long(argv[i], "-d", "--design")) != -1) {
     485                        output_toggle = PRINT_ARCH;
     486                        continue;
     487                }
     488        }
     489
     490        switch (output_toggle) {
     491        case LIST_TASKS:
    302492                list_tasks();
    303 
    304         if (toggle_threads)
     493                break;
     494        case LIST_THREADS:
    305495                list_threads(task_id, toggle_all);
    306 
    307         if (toggle_cpus)
     496                break;
     497        case LIST_IPCCS:
     498                list_ipccs(task_id, toggle_all);
     499                break;
     500        case LIST_CPUS:
    308501                list_cpus();
    309 
    310         if (toggle_load)
     502                break;
     503        case PRINT_LOAD:
    311504                print_load();
    312 
    313         if (toggle_uptime)
     505                break;
     506        case PRINT_UPTIME:
    314507                print_uptime();
     508                break;
     509        case PRINT_ARCH:
     510                print_arch();
     511                break;
     512        }
    315513
    316514        return 0;
  • uspace/app/sysinst/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 BINARY = nic
    31 LIBS = drv
    32 
    33 SOURCES = \
    34         nic.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     29deps = [ 'block', 'fdisk', 'sif' ]
     30src = files(
     31        'futil.c',
     32        'rdimg.c',
     33        'sysinst.c',
     34        'volume.c',
     35)
  • uspace/app/sysinst/sysinst.c

    rb401b33 re28175d  
    3838#include <block.h>
    3939#include <byteorder.h>
    40 #include <cap.h>
     40#include <capa.h>
    4141#include <errno.h>
    4242#include <fdisk.h>
     
    9898        fdisk_part_spec_t pspec;
    9999        fdisk_part_info_t pinfo;
    100         cap_spec_t cap;
     100        capa_spec_t capa;
    101101        service_id_t sid;
    102102        errno_t rc;
     
    137137        printf("sysinst_label_dev(): create partition\n");
    138138
    139         rc = fdisk_part_get_max_avail(fdev, spc_pri, &cap);
     139        rc = fdisk_part_get_max_avail(fdev, spc_pri, &capa);
    140140        if (rc != EOK) {
    141141                printf("Error getting available capacity: %s.\n", str_error(rc));
     
    144144
    145145        fdisk_pspec_init(&pspec);
    146         pspec.capacity = cap;
     146        pspec.capacity = capa;
    147147        pspec.pkind = lpk_primary;
    148148        pspec.fstype = fs_ext4; /* Cannot be changed without modifying core.img */
  • uspace/app/taskdump/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../../..
    30 
    31 BINARY = s3c24xx_ts
    32 
    33 SOURCES = \
    34         s3c24xx_ts.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     29includes += include_directories('include')
     30src = files(
     31        'elf_core.c',
     32        'fibrildump.c',
     33        'taskdump.c',
     34        'symtab.c',
     35)
  • uspace/app/taskdump/taskdump.c

    rb401b33 re28175d  
    126126static errno_t connect_task(task_id_t task_id)
    127127{
    128         async_sess_t *ksess = async_connect_kbox(task_id);
     128        errno_t rc;
     129        async_sess_t *ksess = async_connect_kbox(task_id, &rc);
    129130
    130131        if (!ksess) {
    131                 if (errno == ENOTSUP) {
     132                if (rc == ENOTSUP) {
    132133                        printf("You do not have userspace debugging support "
    133134                            "compiled in the kernel.\n");
    134135                        printf("Compile kernel with 'Support for userspace debuggers' "
    135136                            "(CONFIG_UDEBUG) enabled.\n");
    136                         return errno;
     137                        return rc;
    137138                }
    138139
    139140                printf("Error connecting\n");
    140141                printf("async_connect_kbox(%" PRIu64 ") -> %s", task_id, str_error_name(errno));
    141                 return errno;
    142         }
    143 
    144         errno_t rc = udebug_begin(ksess);
     142                return rc;
     143        }
     144
     145        rc = udebug_begin(ksess);
    145146        if (rc != EOK) {
    146147                printf("udebug_begin() -> %s\n", str_error_name(rc));
  • uspace/app/tester/mm/pager1.c

    rb401b33 re28175d  
    6565        TPRINTF("Connecting to VFS pager...\n");
    6666
    67         vfs_pager_sess = service_connect_blocking(SERVICE_VFS, INTERFACE_PAGER, 0);
     67        vfs_pager_sess = service_connect_blocking(SERVICE_VFS, INTERFACE_PAGER,
     68            0, NULL);
    6869
    6970        if (!vfs_pager_sess) {
  • uspace/app/tetris/meson.build

    rb401b33 re28175d  
    2828#
    2929
    30 USPACE_PREFIX = ../..
    31 LIBRARY = libfs
    32 
    33 SOURCES = \
    34         libfs.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     30src = files(
     31        'shapes.c',
     32        'scores.c',
     33        'tetris.c',
     34        'screen.c',
     35)
  • uspace/app/trace/syscalls.c

    rb401b33 re28175d  
    3838
    3939const sc_desc_t syscall_desc[] = {
     40        /* System management syscalls. */
    4041        [SYS_KIO] = { "kio", 3, V_INT_ERRNO },
    4142
     43        /* Thread and task related syscalls. */
    4244        [SYS_THREAD_CREATE] = { "thread_create", 3, V_ERRNO },
    4345        [SYS_THREAD_EXIT] = { "thread_exit", 1, V_ERRNO },
    4446        [SYS_THREAD_GET_ID] = { "thread_get_id", 1, V_ERRNO },
     47        [SYS_THREAD_USLEEP] = { "thread_usleep", 1, V_ERRNO },
     48        [SYS_THREAD_UDELAY] = { "thread_udelay", 1, V_ERRNO },
    4549
    4650        [SYS_TASK_GET_ID] = { "task_get_id", 1, V_ERRNO },
    4751        [SYS_TASK_SET_NAME] = { "task_set_name", 2, V_ERRNO },
     52        [SYS_TASK_KILL] = { "task_kill", 1, V_ERRNO },
     53        [SYS_TASK_EXIT] = { "task_exit", 1, V_ERRNO },
     54        [SYS_PROGRAM_SPAWN_LOADER] = { "program_spawn_loader", 2, V_ERRNO },
    4855
     56        /* Synchronization related syscalls. */
     57        [SYS_WAITQ_CREATE] = { "waitq_create", 1, V_ERRNO },
     58        [SYS_WAITQ_SLEEP] = { "waitq_sleep", 3, V_ERRNO },
     59        [SYS_WAITQ_WAKEUP] = { "waitq_wakeup", 1, V_ERRNO },
     60        [SYS_WAITQ_DESTROY] = { "waitq_destroy", 1, V_ERRNO },
     61        [SYS_SMC_COHERENCE] = { "smc_coherence", 2, V_ERRNO },
     62
     63        /* Address space related syscalls. */
    4964        [SYS_AS_AREA_CREATE] = { "as_area_create", 5, V_ERRNO },
    5065        [SYS_AS_AREA_RESIZE] = { "as_area_resize", 3, V_ERRNO },
     66        [SYS_AS_AREA_CHANGE_FLAGS] = { "as_area_change_flags", 2, V_ERRNO },
     67        [SYS_AS_AREA_GET_INFO] = { "as_area_get_info", 2, V_ERRNO },
    5168        [SYS_AS_AREA_DESTROY] = { "as_area_destroy", 1, V_ERRNO },
    5269
     70        /* Page mapping related syscalls. */
     71        [SYS_PAGE_FIND_MAPPING] = { "page_find_mapping", 2, V_ERRNO },
     72
     73        /* IPC related syscalls. */
    5374        [SYS_IPC_CALL_ASYNC_FAST] = { "ipc_call_async_fast", 6, V_HASH },
    5475        [SYS_IPC_CALL_ASYNC_SLOW] = { "ipc_call_async_slow", 3, V_HASH },
    55 
    5676        [SYS_IPC_ANSWER_FAST] = { "ipc_answer_fast", 6, V_ERRNO },
    5777        [SYS_IPC_ANSWER_SLOW] = { "ipc_answer_slow", 2, V_ERRNO },
     
    6181        [SYS_IPC_POKE] = { "ipc_poke", 0, V_ERRNO },
    6282        [SYS_IPC_HANGUP] = { "ipc_hangup", 1, V_ERRNO },
     83        [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 2, V_ERRNO },
    6384
     85        /* Event notification syscalls. */
    6486        [SYS_IPC_EVENT_SUBSCRIBE] = { "ipc_event_subscribe", 2, V_ERRNO },
    6587        [SYS_IPC_EVENT_UNSUBSCRIBE] = { "ipc_event_unsubscribe", 1, V_ERRNO },
    6688        [SYS_IPC_EVENT_UNMASK] = { "ipc_event_unmask", 1, V_ERRNO },
    6789
     90        /* Permission related syscalls. */
    6891        [SYS_PERM_GRANT] = { "perm_grant", 2, V_ERRNO },
    6992        [SYS_PERM_REVOKE] = { "perm_revoke", 2, V_ERRNO },
     93
     94        /* DDI related syscalls. */
    7095        [SYS_PHYSMEM_MAP] = { "physmem_map", 4, V_ERRNO },
     96        [SYS_PHYSMEM_UNMAP] = { "physmem_unmap", 1, V_ERRNO },
     97        [SYS_DMAMEM_MAP] = { "dmamem_map", 6, V_ERRNO },
     98        [SYS_DMAMEM_UNMAP] = { "dmamem_unmap", 3, V_ERRNO },
    7199        [SYS_IOSPACE_ENABLE] = { "iospace_enable", 1, V_ERRNO },
     100        [SYS_IOSPACE_DISABLE] = { "iospace_disable", 1, V_ERRNO },
    72101
    73102        [SYS_IPC_IRQ_SUBSCRIBE] = { "ipc_irq_subscribe", 4, V_ERRNO },
    74103        [SYS_IPC_IRQ_UNSUBSCRIBE] = { "ipc_irq_unsubscribe", 2, V_ERRNO },
    75104
     105        /* Sysinfo syscalls. */
     106        [SYS_SYSINFO_GET_KEYS_SIZE] = { "sysinfo_get_keys_size", 3, V_ERRNO },
     107        [SYS_SYSINFO_GET_KEYS] = { "sysinfo_get_keys", 5, V_ERRNO },
    76108        [SYS_SYSINFO_GET_VAL_TYPE] = { "sysinfo_get_val_type", 2, V_INTEGER },
    77109        [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value", 3, V_ERRNO },
     
    79111        [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 5, V_ERRNO },
    80112
     113        /* Kernel console syscalls. */
    81114        [SYS_DEBUG_CONSOLE] = { "debug_console", 0, V_ERRNO },
    82         [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 1, V_ERRNO }
     115
     116        [SYS_KLOG] = { "klog", 5, V_ERRNO }
    83117};
    84118
  • uspace/app/trace/trace.c

    rb401b33 re28175d  
    4747#include <mem.h>
    4848#include <str.h>
    49 #include <loader/loader.h>
    5049#include <io/console.h>
    5150#include <io/keycode.h>
     
    8685void thread_trace_start(uintptr_t thread_hash);
    8786
     87static char *cmd_path;
     88static char **cmd_args;
     89
    8890static task_id_t task_id;
    89 static loader_t *task_ldr;
     91static task_wait_t task_w;
    9092static bool task_wait_for;
    9193
     
    9395display_mask_t display_mask;
    9496
    95 static errno_t program_run_fibril(void *arg);
    9697static errno_t cev_fibril(void *arg);
    97 
    98 static void program_run(void)
    99 {
    100         fid_t fid;
    101 
    102         fid = fibril_create(program_run_fibril, NULL);
    103         if (fid == 0) {
    104                 printf("Error creating fibril\n");
    105                 exit(1);
    106         }
    107 
    108         fibril_add_ready(fid);
    109 }
    11098
    11199static void cev_fibril_start(void)
     
    122110}
    123111
    124 static errno_t program_run_fibril(void *arg)
    125 {
    126         errno_t rc;
    127 
    128         /*
    129          * This must be done in background as it will block until
    130          * we let the task reply to this call.
    131          */
    132         rc = loader_run(task_ldr);
     112static errno_t program_run(void)
     113{
     114        errno_t rc;
     115
     116        rc = task_spawnv_debug(&task_id, &task_w, cmd_path,
     117            (const char *const *)cmd_args, &sess);
     118
     119        if (rc == ENOTSUP) {
     120                printf("You do not have userspace debugging support "
     121                    "compiled in the kernel.\n");
     122                printf("Compile kernel with 'Support for userspace debuggers' "
     123                    "(CONFIG_UDEBUG) enabled.\n");
     124        }
     125
    133126        if (rc != EOK) {
    134                 printf("Error running program\n");
    135                 exit(1);
    136         }
    137 
    138         task_ldr = NULL;
    139 
    140         printf("program_run_fibril exiting\n");
    141         return 0;
     127                printf("Error running program (%s)\n", str_error_name(rc));
     128                return rc;
     129        }
     130
     131        return EOK;
    142132}
    143133
    144134static errno_t connect_task(task_id_t task_id)
    145135{
    146         async_sess_t *ksess = async_connect_kbox(task_id);
    147 
    148         if (!ksess) {
    149                 if (errno == ENOTSUP) {
    150                         printf("You do not have userspace debugging support "
    151                             "compiled in the kernel.\n");
    152                         printf("Compile kernel with 'Support for userspace debuggers' "
    153                             "(CONFIG_UDEBUG) enabled.\n");
    154                         return errno;
    155                 }
    156 
    157                 printf("Error connecting\n");
    158                 printf("ipc_connect_task(%" PRIu64 ") -> %s ", task_id, str_error_name(errno));
    159                 return errno;
    160         }
    161 
    162         errno_t rc = udebug_begin(ksess);
    163         if (rc != EOK) {
    164                 printf("udebug_begin() -> %s\n", str_error_name(rc));
    165                 return rc;
    166         }
    167 
    168         rc = udebug_set_evmask(ksess, UDEBUG_EM_ALL);
     136        errno_t rc;
     137        bool debug_started = false;
     138        bool wait_set_up = false;
     139
     140        if (sess == NULL) {
     141                sess = async_connect_kbox(task_id, &rc);
     142                if (sess == NULL) {
     143                        printf("Error connecting to task %" PRIu64 ".\n",
     144                            task_id);
     145                        goto error;
     146                }
     147
     148                rc = udebug_begin(sess);
     149                if (rc != EOK) {
     150                        printf("Error starting debug session.\n");
     151                        goto error;
     152                }
     153
     154                debug_started = true;
     155
     156                rc = task_setup_wait(task_id, &task_w);
     157                if (rc != EOK) {
     158                        printf("Error setting up wait for task termination.\n");
     159                        goto error;
     160                }
     161
     162                wait_set_up = true;
     163        }
     164
     165        rc = udebug_set_evmask(sess, UDEBUG_EM_ALL);
    169166        if (rc != EOK) {
    170167                printf("udebug_set_evmask(0x%x) -> %s\n ", UDEBUG_EM_ALL, str_error_name(rc));
     
    172169        }
    173170
    174         sess = ksess;
    175         return 0;
     171        return EOK;
     172error:
     173        if (wait_set_up)
     174                task_cancel_wait(&task_w);
     175        if (debug_started)
     176                udebug_end(sess);
     177        if (sess != NULL)
     178                async_hangup(sess);
     179        return rc;
    176180}
    177181
     
    198202        printf("\ntotal of %zu threads\n", tb_needed / sizeof(uintptr_t));
    199203
    200         return 0;
     204        return EOK;
    201205}
    202206
     
    488492
    489493        printf("Finished tracing thread [%d].\n", thread_id);
    490         return 0;
     494        return EOK;
    491495}
    492496
     
    502506        }
    503507        fibril_add_ready(fid);
    504 }
    505 
    506 static loader_t *preload_task(const char *path, char **argv,
    507     task_id_t *task_id)
    508 {
    509         loader_t *ldr;
    510         errno_t rc;
    511 
    512         /* Spawn a program loader */
    513         ldr = loader_connect();
    514         if (ldr == NULL)
    515                 return NULL;
    516 
    517         /* Get task ID. */
    518         rc = loader_get_task_id(ldr, task_id);
    519         if (rc != EOK)
    520                 goto error;
    521 
    522         /* Send program. */
    523         rc = loader_set_program_path(ldr, path);
    524         if (rc != EOK)
    525                 goto error;
    526 
    527         /* Send arguments */
    528         rc = loader_set_args(ldr, (const char **) argv);
    529         if (rc != EOK)
    530                 goto error;
    531 
    532         /* Send default files */
    533         int fd_root;
    534         int fd_stdin;
    535         int fd_stdout;
    536         int fd_stderr;
    537 
    538         fd_root = vfs_root();
    539         if (fd_root >= 0) {
    540                 rc = loader_add_inbox(ldr, "root", fd_root);
    541                 vfs_put(fd_root);
    542                 if (rc != EOK)
    543                         goto error;
    544         }
    545 
    546         if ((stdin != NULL) && (vfs_fhandle(stdin, &fd_stdin) == EOK)) {
    547                 rc = loader_add_inbox(ldr, "stdin", fd_stdin);
    548                 if (rc != EOK)
    549                         goto error;
    550         }
    551 
    552         if ((stdout != NULL) && (vfs_fhandle(stdout, &fd_stdout) == EOK)) {
    553                 rc = loader_add_inbox(ldr, "stdout", fd_stdout);
    554                 if (rc != EOK)
    555                         goto error;
    556         }
    557 
    558         if ((stderr != NULL) && (vfs_fhandle(stderr, &fd_stderr) == EOK)) {
    559                 rc = loader_add_inbox(ldr, "stderr", fd_stderr);
    560                 if (rc != EOK)
    561                         goto error;
    562         }
    563 
    564         /* Load the program. */
    565         rc = loader_load_program(ldr);
    566         if (rc != EOK)
    567                 goto error;
    568 
    569         /* Success */
    570         return ldr;
    571 
    572         /* Error exit */
    573 error:
    574         loader_abort(ldr);
    575         return NULL;
    576508}
    577509
     
    807739                                ++argv;
    808740                                task_id = strtol(*argv, &err_p, 10);
    809                                 task_ldr = NULL;
    810741                                task_wait_for = false;
    811742                                if (*err_p) {
     
    848779                printf("'%s'\n", *cp++);
    849780
    850         task_ldr = preload_task(*argv, argv, &task_id);
     781        cmd_path = *argv;
     782        cmd_args = argv;
    851783        task_wait_for = true;
    852784
     
    869801
    870802        main_init();
     803
     804        if (cmd_path != NULL)
     805                program_run();
    871806
    872807        rc = connect_task(task_id);
     
    878813        printf("Connected to task %" PRIu64 ".\n", task_id);
    879814
    880         if (task_ldr != NULL)
    881                 program_run();
    882 
    883815        cev_fibril_start();
    884816        trace_task(task_id);
     
    887819                printf("Waiting for task to exit.\n");
    888820
    889                 rc = task_wait_task_id(task_id, &texit, &retval);
     821                rc = task_wait(&task_w, &texit, &retval);
    890822                if (rc != EOK) {
    891823                        printf("Failed waiting for task.\n");
  • uspace/app/usbinfo/main.c

    rb401b33 re28175d  
    6969        _OPTION("-S --status", "Get status of the device.");
    7070        _OPTION("-r --hid-report", "Dump HID report descriptor.");
    71         _OPTION("-r --hid-report-usages", "Dump usages of HID report.");
     71        _OPTION("-R --hid-report-usages", "Dump usages of HID report.");
    7272
    7373        printf("\n");
  • uspace/app/usbinfo/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../../..
    30 LIBS = drv
    31 BINARY = test1
    32 
    33 SOURCES = \
    34         test1.c
    35 
    36 include $(USPACE_PREFIX)/Makefile.common
     29deps = [ 'usbhid', 'usbdev', 'usb', 'drv' ]
     30src = files(
     31        'desctree.c',
     32        'dump.c',
     33        'hid.c',
     34        'info.c',
     35        'list.c',
     36        'main.c',
     37)
  • uspace/app/viewer/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
     29deps = [ 'gui' ]
     30src = files('viewer.c')
    3031
    31 # TODO: Should be just "gui", rest is transitive dependencies.
    32 LIBS = gui draw softrend compress math
    33 
    34 BINARY = viewer
    35 
    36 SOURCES = \
    37         viewer.c
    38 
    39 include $(USPACE_PREFIX)/Makefile.common
     32if install_nonessential_data
     33        # TODO: install this file somewhere sane
     34        installed_data += { 'name': 'logo.tga', 'dir': '/' }
     35endif
  • uspace/app/viewer/viewer.c

    rb401b33 re28175d  
    4141#include <window.h>
    4242#include <canvas.h>
    43 #include <surface.h>
    44 #include <codec/tga.h>
     43#include <draw/surface.h>
     44#include <draw/codec.h>
    4545#include <task.h>
    4646#include <str.h>
  • uspace/app/vlaunch/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
     29deps = [ 'gui' ]
    3030
    31 # TODO: Should be just "gui", rest is transitive dependencies.
    32 LIBS = gui draw softrend compress math
     31_images = files('gfx/helenos.tga')
    3332
    34 BINARY = vcalc
     33_images_zip = custom_target('vlaunch_images.zip',
     34        input : _images,
     35        output : [ 'images.zip' ],
     36        command : [ mkarray, '@OUTDIR@', 'images', 'image', uspace_as_prolog, '.data', '@INPUT@' ],
     37)
     38_imgs_s = custom_target('vlaunch_images.s',
     39        input : _images_zip,
     40        output : [ 'images.s' ],
     41        command : [ unzip, '-p', '@INPUT@', 'images.s' ],
     42        capture : true,
     43)
     44_imgs_h = custom_target('vlaunch_images.h',
     45        input : _images_zip,
     46        output : [ 'images.h' ],
     47        command : [ unzip, '-p', '@INPUT@', 'images.h' ],
     48        capture : true,
     49)
     50_imgs_desc_c = custom_target('vlaunch_images_desc.c',
     51        input : _images_zip,
     52        output : [ 'images_desc.c' ],
     53        command : [ unzip, '-p', '@INPUT@', 'images_desc.c' ],
     54        capture : true,
     55)
    3556
    36 SOURCES = \
    37         vcalc.c
    38 
    39 include $(USPACE_PREFIX)/Makefile.common
     57src = [ files('vlaunch.c'), _imgs_s, _imgs_h, _imgs_desc_c ]
  • uspace/app/vlaunch/vlaunch.c

    rb401b33 re28175d  
    4646#include <canvas.h>
    4747
    48 #include <surface.h>
    49 #include <source.h>
    50 #include <drawctx.h>
    51 #include <codec/tga.h>
     48#include <draw/surface.h>
     49#include <draw/source.h>
     50#include <draw/drawctx.h>
     51#include <draw/codec.h>
    5252
    5353#include "images.h"
  • uspace/app/vuhid/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../../..
    30 
    31 LIBS = usbdev usb drv scsi
    32 
    33 BINARY = usbmast
    34 
    35 SOURCES = \
    36         bo_trans.c \
    37         cmdw.c \
    38         main.c \
    39         scsi_ms.c
    40 
    41 include $(USPACE_PREFIX)/Makefile.common
     29deps = [ 'usb', 'usbdev', 'usbhid', 'usbvirt', 'drv' ]
     30src = files(
     31        'main.c',
     32        'device.c',
     33        'ifaces.c',
     34        'life.c',
     35        'stdreq.c',
     36        'hids/bootkbd.c',
     37        'hids/logitech_wireless.c',
     38)
  • uspace/app/wavplay/meson.build

    rb401b33 re28175d  
    2727#
    2828
    29 USPACE_PREFIX = ../..
    30 EXTRA_CFLAGS = -Iinclude/hound
    31 LIBRARY = libhound
    32 LIBS = pcm
     29deps = [ 'drv', 'hound', 'pcm' ]
     30src = files(
     31        'dplay.c',
     32        'drec.c',
     33        'main.c',
     34        'wave.c',
     35)
    3336
    34 SOURCES = \
    35         src/protocol.c \
    36         src/client.c
    37 include $(USPACE_PREFIX)/Makefile.common
    38 
     37if install_nonessential_data
     38        # TODO: install this file somewhere sane
     39        installed_data += { 'name': 'demo.wav', 'dir': '/' }
     40endif
Note: See TracChangeset for help on using the changeset viewer.