Changeset ab936440 in mainline for uspace/app


Ignore:
Timestamp:
2019-02-12T20:42:42Z (7 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f31ca47
Parents:
7f7817a9 (diff), 4805495 (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:
Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:26:18)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:42:42)
Message:

Merge branch 'master' into bdsh_alias

Conflicts:

uspace/app/bdsh/Makefile
uspace/app/bdsh/cmds/modules/modules.h

Ccheck correction and removing header which includes itself

Location:
uspace/app
Files:
23 added
12 deleted
26 edited
2 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/Makefile

    r7f7817a9 rab936440  
    3434
    3535SOURCES = \
     36        cmds/modules/module_aliases.c \
     37        cmds/modules/modules.c \
    3638        cmds/modules/alias/alias.c \
    3739        cmds/modules/unalias/unalias.c \
     
    5355        cmds/modules/kcon/kcon.c \
    5456        cmds/modules/cmp/cmp.c \
     57        cmds/builtins/builtin_aliases.c \
     58        cmds/builtins/builtins.c \
    5559        cmds/builtins/batch/batch.c \
    5660        cmds/builtins/exit/exit.c \
  • uspace/app/bdsh/cmds/builtins/builtin_aliases.h

    r7f7817a9 rab936440  
     1/*
     2 * Copyright (c) 2008 Tim Post
     3 * All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
     28
    129#ifndef BUILTIN_ALIASES_H
    230#define BUILTIN_ALIASES_H
    331
    4 /* See modules/module_aliases.h for an explanation of this file */
    5 
    6 char *builtin_aliases[] = {
    7         NULL, NULL
    8 };
     32extern char *builtin_aliases[];
    933
    1034#endif
  • uspace/app/bdsh/cmds/builtins/builtins.h

    r7f7817a9 rab936440  
     1/*
     2 * Copyright (c) 2008 Tim Post
     3 * All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
     28
    129#ifndef BUILTINS_H
    230#define BUILTINS_H
    331
    4 #include "config.h"
     32#include "../cmds.h"
    533
    6 #include "batch/entry.h"
    7 #include "cd/entry.h"
    8 #include "exit/entry.h"
    9 
    10 builtin_t builtins[] = {
    11 #include "batch/batch_def.inc"
    12 #include "cd/cd_def.inc"
    13 #include "exit/exit_def.inc"
    14         { NULL, NULL, NULL, NULL, 0 }
    15 };
     34extern builtin_t builtins[];
    1635
    1736#endif
  • uspace/app/bdsh/cmds/mknewcmd

    r7f7817a9 rab936440  
    213213        printf " to include your new command.\n"
    214214        [ -n "$CMDALIAS" ] &&  {
    215                 printf "\nYou should also modify %ss/%s_aliases.h and " \
     215                printf "\nYou should also modify %ss/%s_aliases.c and " \
    216216                        "${CMDTYPE}" "${CMDTYPE}"
    217217                printf "add %s as an alias for %s\n" \
  • uspace/app/bdsh/cmds/modules/alias/alias.c

    r7f7817a9 rab936440  
    6060                return true;
    6161        }
    62        
     62
    6363        cli_error(CL_ENOENT, "%s: No alias with the name '%s' exists\n", cmdname, name);
    6464        return false;
     
    123123int cmd_alias(char **argv)
    124124{
    125        
     125
    126126        if (argv[1] == NULL) {
    127127                list_aliases();
     
    140140                                return CMD_FAILURE;
    141141                        }
    142                        
     142
    143143                        set_alias(name, value + 1);
    144144                } else {
     
    151151                free(name);
    152152        }
    153        
     153
    154154        return CMD_SUCCESS;
    155155}
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    r7f7817a9 rab936440  
    199199
    200200        /* Populate the directory list. */
    201         if (ls.recursive) {
     201        if (ls.recursive && nbdirs > 0) {
    202202                tmp = (struct dir_elem_t *) realloc(*dir_list_ptr,
    203203                    nbdirs * sizeof(struct dir_elem_t));
  • uspace/app/bdsh/cmds/modules/module_aliases.h

    r7f7817a9 rab936440  
    3030#define MODULE_ALIASES_H
    3131
    32 /*
    33  * Modules that declare multiple names for themselves but use the
    34  * same entry functions are aliases. This array helps to determine if
    35  * a module is an alias, as such it can be invoked differently.
    36  * format is alias , real_name
    37  */
    38 
    39 /*
    40  * So far, this is only used in the help display but could be used to
    41  * handle a module differently even prior to reaching its entry code.
    42  * For instance, 'exit' could behave differently than 'quit', prior to
    43  * the entry point being reached.
    44  */
    45 
    46 const char *mod_aliases[] = {
    47         "ren", "mv",
    48         "umount", "unmount",
    49         NULL, NULL
    50 };
     32extern const char *mod_aliases[];
    5133
    5234#endif
  • uspace/app/bdsh/cmds/modules/modules.h

    r7f7817a9 rab936440  
    3030#define MODULES_H
    3131
    32 /*
    33  * Each built in function has two files, one being an entry.h file which
    34  * prototypes the run/help entry functions, the other being a .def file
    35  * which fills the modules[] array according to the cmd_t structure
    36  * defined in cmds.h.
    37  *
    38  * To add or remove a module, just make a new directory in cmds/modules
    39  * for it and copy the 'show' example for basics, then include it here.
    40  * (or reverse the process to remove one)
    41  *
    42  * NOTE: See module_ aliases.h as well, this is where aliases (commands that
    43  * share an entry point with others) are indexed
    44  */
     32#include "../cmds.h"
    4533
    46 #include "config.h"
    47 
    48 /* Prototypes for each module's entry (help/exec) points */
    49 
    50 #include "help/entry.h"
    51 #include "mkdir/entry.h"
    52 #include "mkfile/entry.h"
    53 #include "rm/entry.h"
    54 #include "cat/entry.h"
    55 #include "touch/entry.h"
    56 #include "ls/entry.h"
    57 #include "pwd/entry.h"
    58 #include "sleep/entry.h"
    59 #include "cp/entry.h"
    60 #include "mv/entry.h"
    61 #include "mount/entry.h"
    62 #include "unmount/entry.h"
    63 #include "kcon/entry.h"
    64 #include "printf/entry.h"
    65 #include "echo/entry.h"
    66 #include "cmp/entry.h"
    67 #include "alias/entry.h"
    68 #include "unalias/entry.h"
    69 
    70 /*
    71  * Each .def function fills the module_t struct with the individual name, entry
    72  * point, help entry point, etc. You can use config.h to control what modules
    73  * are loaded based on what libraries exist on the system.
    74  */
    75 
    76 module_t modules[] = {
    77 #include "help/help_def.inc"
    78 #include "mkdir/mkdir_def.inc"
    79 #include "mkfile/mkfile_def.inc"
    80 #include "rm/rm_def.inc"
    81 #include "cat/cat_def.inc"
    82 #include "touch/touch_def.inc"
    83 #include "ls/ls_def.inc"
    84 #include "pwd/pwd_def.inc"
    85 #include "sleep/sleep_def.inc"
    86 #include "cp/cp_def.inc"
    87 #include "mv/mv_def.inc"
    88 #include "mount/mount_def.inc"
    89 #include "unmount/unmount_def.inc"
    90 #include "kcon/kcon_def.inc"
    91 #include "printf/printf_def.inc"
    92 #include "echo/echo_def.inc"
    93 #include "cmp/cmp_def.inc"
    94 #include "alias/alias_def.inc"
    95 #include "unalias/unalias_def.inc"
    96 
    97         { NULL, NULL, NULL, NULL }
    98 };
     34extern module_t modules[];
    9935
    10036#endif
  • uspace/app/bdsh/cmds/modules/sleep/sleep.c

    r7f7817a9 rab936440  
    2727 */
    2828
    29 #include <async.h>
    3029#include <errno.h>
     30#include <fibril.h>
    3131#include <stdio.h>
    3232#include <stdlib.h>
  • uspace/app/bdsh/cmds/modules/unalias/unalias.c

    r7f7817a9 rab936440  
    9999                free_alias(alias_link);
    100100        }
    101        
     101
    102102        return CMD_SUCCESS;
    103103}
  • uspace/app/bdsh/compl.c

    r7f7817a9 rab936440  
    408408                                        }
    409409                                }
    410                                
     410
    411411                                asprintf(compl, "%s%c", dent->d_name,
    412412                                    ent_stat.is_directory ? '/' : ' ');
  • uspace/app/dltest/dltest.c

    r7f7817a9 rab936440  
    9191}
    9292
     93/** Test calling function that calls a function that returns a constant */
     94static bool test_dlfcn_dl_get_constant_via_call(void)
     95{
     96        int (*p_dl_get_constant)(void);
     97        int val;
     98
     99        printf("Call dlsym/dl_get_constant_via_call...\n");
     100
     101        p_dl_get_constant = dlsym(handle, "dl_get_constant_via_call");
     102        if (p_dl_get_constant == NULL) {
     103                printf("FAILED\n");
     104                return false;
     105        }
     106
     107        val = p_dl_get_constant();
     108
     109        printf("Got %d, expected %d... ", val, dl_constant);
     110        if (val != dl_constant) {
     111                printf("FAILED\n");
     112                return false;
     113        }
     114
     115        printf("Passed\n");
     116        return true;
     117}
     118
    93119/** Test calling a function that returns contents of a private initialized
    94120 * variable.
     
    564590}
    565591
     592/** Test directly calling function that calls a function that returns a constant */
     593static bool test_lnk_dl_get_constant_via_call(void)
     594{
     595        int val;
     596
     597        printf("Call linked dl_get_constant_via_call...\n");
     598
     599        val = dl_get_constant_via_call();
     600
     601        printf("Got %d, expected %d... ", val, dl_constant);
     602        if (val != dl_constant) {
     603                printf("FAILED\n");
     604                return false;
     605        }
     606
     607        printf("Passed\n");
     608        return true;
     609}
     610
    566611/** Test dircetly calling a function that returns contents of a private
    567612 * initialized variable.
     
    853898                return 1;
    854899
     900        if (!test_dlfcn_dl_get_constant_via_call())
     901                return 1;
     902
    855903        if (!test_dlfcn_dl_get_private_var())
    856904                return 1;
     
    905953{
    906954        if (!test_lnk_dl_get_constant())
     955                return 1;
     956
     957        if (!test_lnk_dl_get_constant_via_call())
    907958                return 1;
    908959
  • uspace/app/hbench/benchlist.c

    r7f7817a9 rab936440  
    11/*
    22 * Copyright (c) 2018 Jiri Svoboda
     3 * Copyright (c) 2018 Vojtech Horky
    34 * All rights reserved.
    45 *
     
    2728 */
    2829
    29 /** @addtogroup perf
     30/** @addtogroup hbench
    3031 * @{
    3132 */
    32 /** @file
     33/**
     34 * @file
    3335 */
    3436
    35 #ifndef PERF_H_
    36 #define PERF_H_
     37#include <stdlib.h>
     38#include "hbench.h"
    3739
    38 #include <stdbool.h>
     40benchmark_t *benchmarks[] = {
     41        &benchmark_dir_read,
     42        &benchmark_fibril_mutex,
     43        &benchmark_file_read,
     44        &benchmark_malloc1,
     45        &benchmark_malloc2,
     46        &benchmark_ns_ping,
     47        &benchmark_ping_pong
     48};
    3949
    40 typedef const char *(*benchmark_entry_t)(void);
    41 
    42 typedef struct {
    43         const char *name;
    44         const char *desc;
    45         benchmark_entry_t entry;
    46 } benchmark_t;
    47 
    48 extern const char *bench_malloc1(void);
    49 extern const char *bench_malloc2(void);
    50 extern const char *bench_ns_ping(void);
    51 extern const char *bench_ping_pong(void);
    52 
    53 extern benchmark_t benchmarks[];
    54 
    55 #endif
     50size_t benchmark_count = sizeof(benchmarks) / sizeof(benchmarks[0]);
    5651
    5752/** @}
  • uspace/app/init/untar.c

    r7f7817a9 rab936440  
    4545typedef struct {
    4646        const char *dev;
    47        
     47
    4848        service_id_t sid;
    4949        aoff64_t offset;
  • uspace/app/lprint/Makefile

    r7f7817a9 rab936440  
    11#
    2 # Copyright (c) 2011 Martin Sucha
     2# Copyright (c) 2018 Jiri Svoboda
    33# All rights reserved.
    44#
     
    2828
    2929USPACE_PREFIX = ../..
    30 BINARY = bnchmark
     30BINARY = lprint
    3131
    3232SOURCES = \
    33         bnchmark.c
     33        lprint.c
    3434
    3535include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/mkbd/main.c

    r7f7817a9 rab936440  
    3939#include <stdlib.h>
    4040#include <errno.h>
     41#include <fibril.h>
    4142#include <str_error.h>
    4243#include <stdbool.h>
  • uspace/app/mkext4/mkext4.c

    r7f7817a9 rab936440  
    5656        aoff64_t nblocks;
    5757        const char *label = "";
     58        unsigned int bsize = 4096;
    5859
    5960        cfg.version = ext4_def_fs_version;
     
    6869        ++argv;
    6970
    70         while (*argv[0] == '-') {
     71        while (*argv && *argv[0] == '-') {
    7172                if (str_cmp(*argv, "--size") == 0) {
    7273                        --argc;
     
    8788                        --argc;
    8889                        ++argv;
     90                        continue;
     91                }
     92
     93                if (str_cmp(*argv, "--bsize") == 0) {
     94                        --argc;
     95                        ++argv;
     96                        if (*argv == NULL) {
     97                                printf(NAME ": Error, argument missing.\n");
     98                                syntax_print();
     99                                return 1;
     100                        }
     101
     102                        bsize = strtol(*argv, &endptr, 10);
     103                        if (*endptr != '\0') {
     104                                printf(NAME ": Error, invalid argument.\n");
     105                                syntax_print();
     106                                return 1;
     107                        }
     108
     109                        --argc;
     110                        ++argv;
     111                        continue;
    89112                }
    90113
     
    107130                        --argc;
    108131                        ++argv;
     132                        continue;
    109133                }
    110134
     
    122146                        --argc;
    123147                        ++argv;
     148                        continue;
     149                }
     150
     151                if (str_cmp(*argv, "--help") == 0) {
     152                        syntax_print();
     153                        return 0;
    124154                }
    125155
     
    128158                        ++argv;
    129159                        break;
     160                } else {
     161                        printf(NAME ": Invalid argument: %s\n", *argv);
     162                        syntax_print();
     163                        return 1;
    130164                }
    131165        }
     
    147181
    148182        cfg.volume_name = label;
     183        cfg.bsize = bsize;
    149184        (void) nblocks;
    150185
     
    166201            "\t--size <sectors> Filesystem size, overrides device size\n"
    167202            "\t--label <label>  Volume label\n"
    168             "\t--type <fstype>  Filesystem type (ext2, ext2old)\n");
     203            "\t--type <fstype>  Filesystem type (ext2, ext2old)\n"
     204            "\t--bsize <bytes>  Filesystem block size in bytes (default = 4096)\n");
    169205}
    170206
  • uspace/app/modplay/modplay.c

    r7f7817a9 rab936440  
    3939#include <stdio.h>
    4040#include <stdlib.h>
     41#include <str.h>
    4142#include <str_error.h>
    4243#include <trackmod.h>
     
    6768}
    6869
     70static void print_syntax(void)
     71{
     72        printf("syntax: modplay [<options>] <filename.mod>\n");
     73        printf("options:\n");
     74        printf("\t-t <target>\tOutput to specified audio target.\n");
     75}
     76
    6977int main(int argc, char *argv[])
    7078{
     
    7886        void *buffer;
    7987        size_t buffer_size;
     88        const char *target = HOUND_DEFAULT_TARGET;
    8089        errno_t rc;
    8190
    82         if (argc != 2) {
    83                 printf("syntax: modplay <filename.mod>\n");
     91        ++argv;
     92        --argc;
     93
     94        while (argc > 0 && (*argv)[0] == '-') {
     95                if (str_cmp(*argv, "-t") == 0) {
     96                        ++argv;
     97                        --argc;
     98
     99                        if (argc < 1) {
     100                                printf("Option '-t' requires an argument.\n");
     101                                print_syntax();
     102                                return 1;
     103                        }
     104
     105                        target = *argv++;
     106                        --argc;
     107                        continue;
     108                }
     109
     110                printf("Invalid option '%s'\n", *argv);
     111                print_syntax();
     112                return 1;
     113        }
     114
     115        if (argc != 1) {
     116                print_syntax();
    84117                return 1;
    85118        }
     
    87120        con = console_init(stdin, stdout);
    88121
    89         rc = trackmod_module_load(argv[1], &mod);
     122        rc = trackmod_module_load(argv[0], &mod);
    90123        if (rc != EOK) {
    91                 printf("Error loading %s.\n", argv[1]);
     124                printf("Error loading %s.\n", argv[0]);
    92125                return 1;
    93126        }
     
    114147        }
    115148
    116         rc = hound_context_connect_target(hound, HOUND_DEFAULT_TARGET);
     149        rc = hound_context_connect_target(hound, target);
    117150        if (rc != EOK) {
    118                 printf("Error connecting default audio target: %s.\n", str_error(rc));
     151                printf("Error connecting audio target '%s': %s.\n",
     152                    target, str_error(rc));
     153
     154                char **names = NULL;
     155                size_t count = 0;
     156                rc = hound_context_get_available_targets(hound, &names, &count);
     157                if (rc == EOK) {
     158                        printf("Available targets:\n");
     159                        for (size_t i = 0; i < count; i++)
     160                                printf(" - %s\n", names[i]);
     161                }
     162
    119163                return 1;
    120164        }
  • uspace/app/sbi/src/bigint.c

    r7f7817a9 rab936440  
    379379        printf("Convert bigint to string.\n");
    380380#endif
    381         static_assert(BIGINT_BASE >= 10);
     381        static_assert(BIGINT_BASE >= 10, "");
    382382
    383383        /* Compute number of characters. */
  • uspace/app/sportdmp/sportdmp.c

    r7f7817a9 rab936440  
    146146
    147147        while (true) {
    148                 rc = chardev_read(chardev, buf, BUF_SIZE, &nread);
     148                rc = chardev_read(chardev, buf, BUF_SIZE, &nread,
     149                    chardev_f_none);
    149150                for (size_t i = 0; i < nread; i++) {
    150151                        printf("%02hhx ", buf[i]);
  • uspace/app/sysinst/rdimg.c

    r7f7817a9 rab936440  
    3434
    3535#include <errno.h>
     36#include <fibril.h>
    3637#include <stdio.h>
    3738#include <stdlib.h>
  • uspace/app/sysinst/sysinst.c

    r7f7817a9 rab936440  
    6262 * in Grub notation).
    6363 */
    64 #define DEFAULT_DEV "devices/\\hw\\pci0\\00:01.0\\ata-c1\\d0"
     64#define DEFAULT_DEV "devices/\\hw\\sys\\00:01.0\\ata-c1\\d0"
    6565//#define DEFAULT_DEV "devices/\\hw\\pci0\\00:01.2\\uhci_rh\\usb01_a1\\mass-storage0\\l0"
    6666/** Volume label for the new file system */
  • uspace/app/tester/chardev/chardev1.c

    r7f7817a9 rab936440  
    11/*
    2  * Copyright (c) 2017 Jiri Svoboda
     2 * Copyright (c) 2019 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    7676        TPRINTF("Sent %zu bytes\n", nbytes);
    7777
    78         rc = chardev_read(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes);
     78        rc = chardev_read(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes,
     79            chardev_f_none);
    7980        if (rc != EOK) {
    8081                chardev_close(chardev);
     
    128129        TPRINTF("Sent %zu bytes\n", nbytes);
    129130
    130         rc = chardev_read(chardev, large_buffer, LARGE_BUFFER_SIZE, &nbytes);
     131        rc = chardev_read(chardev, large_buffer, LARGE_BUFFER_SIZE, &nbytes,
     132            chardev_f_none);
    131133        if (rc != EOK) {
    132134                chardev_close(chardev);
     
    181183            str_error_name(rc));
    182184
    183         rc = chardev_read(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes);
     185        rc = chardev_read(chardev, small_buffer, SMALL_BUFFER_SIZE, &nbytes,
     186            chardev_f_none);
    184187        if (rc != EIO || nbytes != 1) {
    185188                chardev_close(chardev);
  • uspace/app/tester/hw/serial/serial1.c

    r7f7817a9 rab936440  
    136136        while (total < cnt) {
    137137
    138                 rc = chardev_read(chardev, buf, cnt - total, &nread);
     138                rc = chardev_read(chardev, buf, cnt - total, &nread,
     139                    chardev_f_none);
    139140                if (rc != EOK) {
    140141                        (void) serial_set_comm_props(serial, old_baud,
  • uspace/app/tester/stdio/logger2.c

    r7f7817a9 rab936440  
    3030#include <stdlib.h>
    3131#include <errno.h>
     32#include <fibril.h>
    3233#include <io/log.h>
    33 #include <async.h>
    3434#include "../tester.h"
    3535
  • uspace/app/tester/tester.c

    r7f7817a9 rab936440  
    3535 */
    3636
     37#include <assert.h>
    3738#include <stdio.h>
    3839#include <stddef.h>
     
    4041#include <str.h>
    4142#include <io/log.h>
     43#include <types/casting.h>
    4244#include "tester.h"
    4345
     
    144146        }
    145147
    146         unsigned int _len = (unsigned int) len;
    147         if ((_len != len) || (((int) _len) < 0)) {
    148                 printf("Command length overflow\n");
    149                 return;
    150         }
     148        assert(can_cast_size_t_to_int(len) && "test name length overflow");
    151149
    152150        for (test = tests; test->name != NULL; test++)
    153                 printf("%-*s %s%s\n", _len, test->name, test->desc,
     151                printf("%-*s %s%s\n", (int) len, test->name, test->desc,
    154152                    (test->safe ? "" : " (unsafe)"));
    155153
    156         printf("%-*s Run all safe tests\n", _len, "*");
     154        printf("%-*s Run all safe tests\n", (int) len, "*");
    157155}
    158156
  • uspace/app/wavplay/drec.c

    r7f7817a9 rab936440  
    3636#include <assert.h>
    3737#include <errno.h>
     38#include <fibril.h>
    3839#include <str_error.h>
    3940#include <audio_pcm_iface.h>
     
    8889 * Writes recorded data.
    8990 *
    90  * @param icall Poitner to IPC call structure.
    91  * @param arg   Argument. Poitner to recording helper structure.
     91 * @param icall Pointer to IPC call structure.
     92 * @param arg   Argument. Pointer to recording helper structure.
    9293 *
    9394 */
  • uspace/app/wavplay/main.c

    r7f7817a9 rab936440  
    119119 * @return Error code
    120120 */
    121 static errno_t hplay(const char *filename)
     121static errno_t hplay(const char *filename, const char *target)
    122122{
    123123        printf("Hound playback: %s\n", filename);
     
    158158        }
    159159
    160         ret = hound_context_connect_target(hound, HOUND_DEFAULT_TARGET);
     160        ret = hound_context_connect_target(hound, target);
    161161        if (ret != EOK) {
    162                 printf("Failed to connect to default target: %s\n",
     162                printf("Failed to connect to target '%s': %s\n", target,
    163163                    str_error(ret));
     164
     165                char **names = NULL;
     166                size_t count = 0;
     167                ret = hound_context_get_available_targets(hound, &names, &count);
     168                if (ret == EOK) {
     169                        printf("Available targets:\n");
     170                        for (size_t i = 0; i < count; i++)
     171                                printf(" - %s\n", names[i]);
     172                }
     173
    164174                hound_context_destroy(hound);
    165175                fclose(source);
     
    215225        { "parallel", no_argument, 0, 'p' },
    216226        { "record", no_argument, 0, 'r' },
     227        { "target", required_argument, 0, 't' },
    217228        { "help", no_argument, 0, 'h' },
    218229        { 0, 0, 0, 0 }
     
    230241        printf("\t -r, --record\t Start recording instead of playback. "
    231242            "(Not implemented)\n");
    232         printf("\t -d, --device\t Use specified device instead of the sound "
    233             "service. Use location path or a special device `default'\n");
     243        printf("\t -d, --device\t Direct output to specified device instead of "
     244            "the sound service. Use location path or a special device `default'\n");
     245        printf("\t -t, --target\t Output to the specified audio target.\n");
    234246        printf("\t -p, --parallel\t Play given files in parallel instead of "
    235247            "sequentially (does not work with -d).\n");
     
    239251{
    240252        const char *device = "default";
     253        const char *target = HOUND_DEFAULT_TARGET;
    241254        int idx = 0;
    242255        bool direct = false, record = false, parallel = false;
     
    246259        /* Parse command line options */
    247260        while (ret != -1) {
    248                 ret = getopt_long(argc, argv, "d:prh", opts, &idx);
     261                ret = getopt_long(argc, argv, "d:prt:h", opts, &idx);
    249262                switch (ret) {
    250263                case 'd':
     
    257270                case 'p':
    258271                        parallel = true;
     272                        break;
     273                case 't':
     274                        target = optarg;
    259275                        break;
    260276                case 'h':
     
    334350                                fibril_add_ready(fid);
    335351                        } else {
    336                                 hplay(file);
     352                                hplay(file, target);
    337353                        }
    338354                }
Note: See TracChangeset for help on using the changeset viewer.