Changeset 371bd7d in mainline for uspace/app


Ignore:
Timestamp:
2010-03-27T09:22:17Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36a75a2
Parents:
cd82bb1 (diff), eaf22d4 (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.
Message:

Merge mainline changes.

Location:
uspace/app
Files:
19 added
7 deleted
73 edited
8 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31LIBS = $(LIBBLOCK_PREFIX)/libblock.a
     32EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I. -Icmds/ -Icmds/builtins -Icmds/modules
     33BINARY = bdsh
    3134
    32 .PHONY: all clean
     35SOURCES = \
     36        cmds/modules/help/help.c \
     37        cmds/modules/mkdir/mkdir.c \
     38        cmds/modules/mkfile/mkfile.c \
     39        cmds/modules/rm/rm.c \
     40        cmds/modules/bdd/bdd.c \
     41        cmds/modules/cat/cat.c \
     42        cmds/modules/touch/touch.c \
     43        cmds/modules/ls/ls.c \
     44        cmds/modules/pwd/pwd.c \
     45        cmds/modules/sleep/sleep.c \
     46        cmds/modules/cp/cp.c \
     47        cmds/modules/mv/mv.c \
     48        cmds/modules/mount/mount.c \
     49        cmds/modules/unmount/unmount.c \
     50        cmds/modules/kcon/kcon.c \
     51        cmds/builtins/exit/exit.c \
     52        cmds/builtins/cd/cd.c \
     53        cmds/mod_cmds.c \
     54        cmds/builtin_cmds.c \
     55        errors.c \
     56        input.c \
     57        util.c \
     58        exec.c \
     59        scli.c
    3360
    34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     61include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/bdsh/cmds/builtin_cmds.c

    rcd82bb1 r371bd7d  
    3434#include <stdio.h>
    3535#include <stdlib.h>
    36 #include <string.h>
     36#include <str.h>
    3737#include "errors.h"
    3838#include "cmds.h"
  • uspace/app/bdsh/cmds/builtins/builtins.h

    rcd82bb1 r371bd7d  
    1010#include "cd/cd_def.h"
    1111#include "exit/exit_def.h"
    12         {NULL, NULL, NULL, NULL}
     12        {NULL, NULL, NULL, NULL, NULL}
    1313};
    1414
  • uspace/app/bdsh/cmds/builtins/cd/cd.c

    rcd82bb1 r371bd7d  
    3232#include <stdlib.h>
    3333#include <unistd.h>
    34 #include <string.h>
     34#include <str.h>
    3535#include <errno.h>
    3636
     
    4141#include "cd.h"
    4242
    43 static char * cmdname = "cd";
     43static const char *cmdname = "cd";
    4444
    4545void help_cmd_cd(unsigned int level)
  • uspace/app/bdsh/cmds/builtins/cd/cd_def.h

    rcd82bb1 r371bd7d  
    44        &cmd_cd,
    55        &help_cmd_cd,
     6        0
    67},
  • uspace/app/bdsh/cmds/builtins/exit/exit_def.h

    rcd82bb1 r371bd7d  
    44        &cmd_exit,
    55        &help_cmd_exit,
     6        0
    67},
  • uspace/app/bdsh/cmds/cmds.h

    rcd82bb1 r371bd7d  
    3333/* Module structure */
    3434typedef struct {
    35         char *name;         /* Name of the command */
    36         char *desc;         /* Description of the command */
     35        const char *name;   /* Name of the command */
     36        const char *desc;   /* Description of the command */
    3737        mod_entry_t entry;  /* Command (exec) entry function */
    3838        mod_help_t help;    /* Command (help) entry function */
     
    4141/* Builtin structure, same as modules except different types of entry points */
    4242typedef struct {
    43         char *name;
    44         char *desc;
     43        const char *name;
     44        const char *desc;
    4545        builtin_entry_t entry;
    4646        builtin_help_t help;
     
    5757extern int is_module(const char *);
    5858extern int is_module_alias(const char *);
    59 extern char * alias_for_module(const char *);
     59extern char *alias_for_module(const char *);
    6060extern int help_module(int, unsigned int);
    6161extern int run_module(int, char *[]);
     
    6565extern int is_builtin(const char *);
    6666extern int is_builtin_alias(const char *);
    67 extern char * alias_for_builtin(const char *);
     67extern char *alias_for_builtin(const char *);
    6868extern int help_builtin(int, unsigned int);
    6969extern int run_builtin(int, char *[], cliuser_t *);
  • uspace/app/bdsh/cmds/mod_cmds.c

    rcd82bb1 r371bd7d  
    4747#include <stdio.h>
    4848#include <stdlib.h>
    49 #include <string.h>
     49#include <str.h>
    5050#include "errors.h"
    5151#include "cmds.h"
  • uspace/app/bdsh/cmds/modules/bdd/bdd.c

    rcd82bb1 r371bd7d  
    2929#include <stdio.h>
    3030#include <stdlib.h>
    31 #include <string.h>
     31#include <str.h>
    3232#include "config.h"
    3333#include "util.h"
     
    7373        size_t block_size;
    7474        int rc;
    75         bn_t ba;
     75        aoff64_t ba;
    7676        uint8_t b;
    7777
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    rcd82bb1 r371bd7d  
    3333#include <unistd.h>
    3434#include <getopt.h>
    35 #include <string.h>
     35#include <str.h>
    3636#include <fcntl.h>
    3737
     
    4343#include "cmds.h"
    4444
    45 static char *cmdname = "cat";
     45static const char *cmdname = "cat";
    4646#define CAT_VERSION "0.0.1"
    4747#define CAT_DEFAULT_BUFLEN 1024
    4848
    49 static char *cat_oops = "That option is not yet supported\n";
     49static const char *cat_oops = "That option is not yet supported\n";
    5050
    5151static struct option const long_options[] = {
     
    8585{
    8686        int fd, bytes = 0, count = 0, reads = 0;
    87         off_t total = 0;
     87        off64_t total = 0;
    8888        char *buff = NULL;
    8989
  • uspace/app/bdsh/cmds/modules/cp/cp.c

    rcd82bb1 r371bd7d  
    3333#include <unistd.h>
    3434#include <getopt.h>
    35 #include <string.h>
     35#include <str.h>
    3636#include <fcntl.h>
    3737#include "config.h"
     
    7474{
    7575        int fd1, fd2, bytes = 0;
    76         off_t total = 0;
     76        off64_t total = 0;
    7777        int64_t copied = 0;
    7878        char *buff = NULL;
  • uspace/app/bdsh/cmds/modules/help/help.c

    rcd82bb1 r371bd7d  
    3131#include <stdio.h>
    3232#include <stdlib.h>
    33 #include <string.h>
     33#include <str.h>
    3434
    3535#include "config.h"
     
    4242#include "util.h"
    4343
    44 static char *cmdname = "help";
     44static const char *cmdname = "help";
    4545extern const char *progname;
    4646
  • uspace/app/bdsh/cmds/modules/kcon/kcon.c

    rcd82bb1 r371bd7d  
    4040#include "cmds.h"
    4141
    42 static char *cmdname = "kcon";
     42static const char *cmdname = "kcon";
    4343
    4444/* Dispays help for kcon in various levels */
  • uspace/app/bdsh/cmds/modules/ls/ls.c

    rcd82bb1 r371bd7d  
    4040#include <sys/types.h>
    4141#include <sys/stat.h>
    42 #include <string.h>
     42#include <str.h>
    4343
    4444#include "errors.h"
     
    4949#include "cmds.h"
    5050
    51 static char *cmdname = "ls";
     51static const char *cmdname = "ls";
    5252
    5353static void ls_scan_dir(const char *d, DIR *dirp)
     
    100100        if (s.is_file)
    101101                printf("%-40s\t%llu\n", name, (long long) s.size);
     102        else if (s.is_directory)
     103                printf("%-40s\t<dir>\n", name);
    102104        else
    103105                printf("%-40s\n", name);
  • uspace/app/bdsh/cmds/modules/mkdir/mkdir.c

    rcd82bb1 r371bd7d  
    3838#include <getopt.h>
    3939#include <stdarg.h>
    40 #include <string.h>
     40#include <str.h>
    4141
    4242#include "config.h"
     
    4949#define MKDIR_VERSION "0.0.1"
    5050
    51 static char *cmdname = "mkdir";
     51static const char *cmdname = "mkdir";
    5252
    5353static struct option const long_options[] = {
  • uspace/app/bdsh/cmds/modules/module_aliases.h

    rcd82bb1 r371bd7d  
    1212 * the entry point being reached. */
    1313
    14 char *mod_aliases[] = {
     14const char *mod_aliases[] = {
    1515        "ren", "mv",
     16        "umount", "unmount",
    1617        NULL, NULL
    1718};
  • uspace/app/bdsh/cmds/modules/modules.h

    rcd82bb1 r371bd7d  
    2020#include "help/entry.h"
    2121#include "mkdir/entry.h"
     22#include "mkfile/entry.h"
    2223#include "rm/entry.h"
    2324#include "bdd/entry.h"
     
    3031#include "mv/entry.h"
    3132#include "mount/entry.h"
     33#include "unmount/entry.h"
    3234#include "kcon/entry.h"
    3335
     
    3941#include "help/help_def.h"
    4042#include "mkdir/mkdir_def.h"
     43#include "mkfile/mkfile_def.h"
    4144#include "rm/rm_def.h"
    4245#include "bdd/bdd_def.h"
     
    4952#include "mv/mv_def.h"
    5053#include "mount/mount_def.h"
     54#include "unmount/unmount_def.h"
    5155#include "kcon/kcon_def.h"
    5256
  • uspace/app/bdsh/cmds/modules/mount/mount.c

    rcd82bb1 r371bd7d  
    5858{
    5959        unsigned int argc;
    60         char *mopts = "";
     60        const char *mopts = "";
    6161        int rc;
    6262
  • uspace/app/bdsh/cmds/modules/pwd/pwd.c

    rcd82bb1 r371bd7d  
    3939#include "pwd.h"
    4040
    41 static char * cmdname = "pwd";
     41static const char *cmdname = "pwd";
    4242
    4343void help_cmd_pwd(unsigned int level)
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    rcd82bb1 r371bd7d  
    3636#include <getopt.h>
    3737#include <mem.h>
    38 #include <string.h>
     38#include <str.h>
    3939
    4040#include "config.h"
     
    4545#include "cmds.h"
    4646
    47 static char *cmdname = "rm";
     47static const char *cmdname = "rm";
    4848#define RM_VERSION "0.0.1"
    4949
  • uspace/app/bdsh/cmds/modules/sleep/sleep.c

    rcd82bb1 r371bd7d  
    3838#include "cmds.h"
    3939
    40 static char *cmdname = "sleep";
     40static const char *cmdname = "sleep";
    4141
    4242/* Dispays help for sleep in various levels */
  • uspace/app/bdsh/cmds/modules/touch/touch.c

    rcd82bb1 r371bd7d  
    3838#include <dirent.h>
    3939#include <sys/types.h>
    40 #include <string.h>
     40#include <str.h>
    4141
    4242#include "config.h"
     
    4747#include "cmds.h"
    4848
    49 static char *cmdname = "touch";
     49static const char *cmdname = "touch";
    5050
    5151/* Dispays help for touch in various levels */
  • uspace/app/bdsh/errors.c

    rcd82bb1 r371bd7d  
    3030
    3131#include <stdio.h>
    32 #include <string.h>
     32#include <str.h>
    3333#include <stdlib.h>
    3434#include <unistd.h>
     
    4747/* Look up errno in cl_errors and return the corresponding string.
    4848 * Return NULL if not found */
    49 static char *err2str(int err)
     49static const char *err2str(int err)
    5050{
    5151
  • uspace/app/bdsh/errstr.h

    rcd82bb1 r371bd7d  
    44/* Simple array to translate error codes to meaningful strings */
    55
    6 static char *cl_errors[] = {
     6static const char *cl_errors[] = {
    77        "Success",
    88        "Failure",
     
    1818};
    1919
    20 static char *err2str(int);
     20static const char *err2str(int);
    2121
    2222#endif
  • uspace/app/bdsh/exec.c

    rcd82bb1 r371bd7d  
    3838#include <stdlib.h>
    3939#include <unistd.h>
    40 #include <string.h>
     40#include <str.h>
    4141#include <fcntl.h>
    4242
     
    120120        free(found);
    121121
    122         tid = task_spawn((const char *)tmp, argv);
     122        tid = task_spawn(tmp, (const char **) argv);
    123123        free(tmp);
    124124
  • uspace/app/bdsh/exec.h

    rcd82bb1 r371bd7d  
    55
    66extern unsigned int try_exec(char *, char **);
     7
    78#endif
  • uspace/app/bdsh/input.c

    rcd82bb1 r371bd7d  
    3232#include <stdio.h>
    3333#include <stdlib.h>
    34 #include <string.h>
     34#include <str.h>
    3535#include <io/console.h>
    3636#include <io/keycode.h>
     
    508508{
    509509        int sa, sb;
    510         wchar_t tmp_c;
    511510        char *str;
    512511
     
    514513
    515514        if (sb < ti->nc) {
    516                 tmp_c = ti->buffer[sb];
     515                wchar_t tmp_c = ti->buffer[sb];
    517516                ti->buffer[sb] = '\0';
    518         }
    519 
    520         str = wstr_to_astr(ti->buffer + sa);
    521 
    522         if (sb < ti->nc)
     517                str = wstr_to_astr(ti->buffer + sa);
    523518                ti->buffer[sb] = tmp_c;
    524 
     519        } else
     520                str = wstr_to_astr(ti->buffer + sa);
     521       
    525522        if (str == NULL)
    526523                goto error;
  • uspace/app/bdsh/scli.c

    rcd82bb1 r371bd7d  
    3131#include <stdio.h>
    3232#include <stdlib.h>
    33 #include <string.h>
     33#include <str.h>
    3434#include <unistd.h>
    3535#include "config.h"
  • uspace/app/bdsh/scli.h

    rcd82bb1 r371bd7d  
    66
    77typedef struct {
    8         char *name;
     8        const char *name;
    99        char *line;
    1010        char *cwd;
  • uspace/app/bdsh/util.c

    rcd82bb1 r371bd7d  
    2929
    3030#include <stdio.h>
    31 #include <string.h>
     31#include <str.h>
    3232#include <stdarg.h>
    3333#include <stdlib.h>
  • uspace/app/edit/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31BINARY = edit
    3132
    32 .PHONY: all clean
     33SOURCES = \
     34        edit.c \
     35        sheet.c
    3336
    34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     37include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/edit/edit.c

    rcd82bb1 r371bd7d  
    9898static bool done;
    9999static pane_t pane;
     100static bool cursor_visible;
    100101
    101102static int scr_rows, scr_columns;
     
    108109/** Maximum filename length that can be entered. */
    109110#define INFNAME_MAX_LEN 128
     111
     112static void cursor_show(void);
     113static void cursor_hide(void);
     114static void cursor_setvis(bool visible);
    110115
    111116static void key_handle_unmod(console_event_t const *ev);
     
    199204
    200205        /* Initial display */
     206        cursor_visible = true;
     207
     208        cursor_hide();
    201209        console_clear(con);
    202210        pane_text_display();
     
    205213                status_display("File not found. Starting empty file.");
    206214        pane_caret_display();
    207 
     215        cursor_show();
    208216
    209217        done = false;
     
    230238                /* Redraw as necessary. */
    231239
     240                cursor_hide();
     241
    232242                if (pane.rflags & REDRAW_TEXT)
    233243                        pane_text_display();
     
    238248                if (pane.rflags & REDRAW_CARET)
    239249                        pane_caret_display();
     250
     251                cursor_show();
    240252        }
    241253
     
    243255
    244256        return 0;
     257}
     258
     259static void cursor_show(void)
     260{
     261        cursor_setvis(true);
     262}
     263
     264static void cursor_hide(void)
     265{
     266        cursor_setvis(false);
     267}
     268
     269static void cursor_setvis(bool visible)
     270{
     271        if (cursor_visible != visible) {
     272                console_cursor_visibility(con, visible);
     273                cursor_visible = visible;
     274        }
    245275}
    246276
     
    445475static void file_save_as(void)
    446476{
    447         char *old_fname, *fname;
    448         int rc;
    449 
    450         old_fname = (doc.file_name != NULL) ? doc.file_name : "";
     477        const char *old_fname = (doc.file_name != NULL) ? doc.file_name : "";
     478        char *fname;
     479       
    451480        fname = filename_prompt("Save As", old_fname);
    452481        if (fname == NULL) {
     
    455484        }
    456485
    457         rc = file_save(fname);
     486        int rc = file_save(fname);
    458487        if (rc != EOK)
    459488                return;
     
    688717        wchar_t c;
    689718        size_t pos, size;
    690         unsigned s_column;
     719        int s_column;
    691720        coord_t csel_start, csel_end, ctmp;
    692721
     
    736765                s_column = pane.sh_column;
    737766                while (pos < size) {
    738                         if (csel_start.row == rbc.row && csel_start.column == s_column) {
     767                        if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) {
    739768                                fflush(stdout);
    740769                                console_set_color(con, COLOR_BLACK, COLOR_RED, 0);
     
    742771                        }
    743772       
    744                         if (csel_end.row == rbc.row && csel_end.column == s_column) {
     773                        if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    745774                                fflush(stdout);
    746775                                console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     
    762791                }
    763792
    764                 if (csel_end.row == rbc.row && csel_end.column == s_column) {
     793                if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    765794                        fflush(stdout);
    766795                        console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     
    789818        spt_t caret_pt;
    790819        coord_t coord;
    791         char *fname;
    792         int n;
    793820
    794821        tag_get_pt(&pane.caret_pos, &caret_pt);
    795822        spt_get_coord(&caret_pt, &coord);
    796823
    797         fname = (doc.file_name != NULL) ? doc.file_name : "<unnamed>";
     824        const char *fname = (doc.file_name != NULL) ? doc.file_name : "<unnamed>";
    798825
    799826        console_goto(con, 0, scr_rows - 1);
    800827        console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0);
    801         n = printf(" %d, %d: File '%s'. Ctrl-Q Quit  Ctrl-S Save  "
     828        int n = printf(" %d, %d: File '%s'. Ctrl-Q Quit  Ctrl-S Save  "
    802829            "Ctrl-E Save As", coord.row, coord.column, fname);
    803830        printf("%*s", scr_columns - 1 - n, "");
  • uspace/app/edit/sheet.c

    rcd82bb1 r371bd7d  
    5050
    5151#include <stdlib.h>
    52 #include <string.h>
     52#include <str.h>
    5353#include <errno.h>
    5454#include <adt/list.h>
  • uspace/app/getterm/Makefile

    rcd82bb1 r371bd7d  
    11#
    22# Copyright (c) 2005 Martin Decky
     3# Copyright (c) 2007 Jakub Jermar
    34# All rights reserved.
    45#
     
    2728#
    2829
     30USPACE_PREFIX = ../..
     31DEFS = -DRELEASE=$(RELEASE) "-DNAME=$(NAME)"
     32BINARY = getterm
    2933
    30 ## Common names
    31 #
     34SOURCES = \
     35        getterm.c \
     36        version.c
    3237
    33 LIBC_PREFIX = ../../lib/libc
    34 SOFTINT_PREFIX = ../../lib/softint
    35 LIBS = $(LIBC_PREFIX)/libc.a
    36 
    37 DEPEND = Makefile.depend
    38 DEPEND_PREV = $(DEPEND).prev
    39 OUTPUT = redir
     38include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/getterm/getterm.c

    rcd82bb1 r371bd7d  
    2727 */
    2828
    29 /** @addtogroup getvc GetVC
     29/** @addtogroup getterm GetTerm
    3030 * @brief Console initialization task.
    3131 * @{
     
    4444static void usage(void)
    4545{
    46         printf("Usage: getvc <device> <path>\n");
     46        printf("Usage: getterm <terminal> <path>\n");
    4747}
    4848
     
    6969}
    7070
    71 static task_id_t spawn(char *fname)
     71static task_id_t spawn(const char *fname)
    7272{
    73         char *args[2];
     73        const char *args[2];
    7474       
    7575        args[0] = fname;
  • uspace/app/getterm/getterm.h

    rcd82bb1 r371bd7d  
    2727 */
    2828
    29 /** @addtogroup getvc
     29/** @addtogroup getterm
    3030 * @{
    3131 */
     
    3434 */
    3535
    36 #ifndef GETVC_H__
    37 #define GETVC_H__
     36#ifndef GETTERM_H__
     37#define GETTERM_H__
    3838
    3939#endif
  • uspace/app/getterm/version.c

    rcd82bb1 r371bd7d  
    2727 */
    2828
    29 /** @addtogroup getvc
     29/** @addtogroup getterm
    3030 * @{
    3131 */
     
    3737#include <stdio.h>
    3838#include <macros.h>
    39 #include "getvc.h"
     39#include "getterm.h"
    4040#include "version.h"
    4141
    42 static char *release = STRING(RELEASE);
    43 static char *name = STRING(NAME);
    44 static char *arch = STRING(UARCH);
     42static const char *release = STRING(RELEASE);
     43static const char *name = STRING(NAME);
     44static const char *arch = STRING(UARCH);
    4545
    4646#ifdef REVISION
    47         static char *revision = ", revision " STRING(REVISION);
     47        static const char *revision = ", revision " STRING(REVISION);
    4848#else
    49         static char *revision = "";
     49        static const char *revision = "";
    5050#endif
    5151
    5252#ifdef TIMESTAMP
    53         static char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
     53        static const char *timestamp = "\nBuilt on " STRING(TIMESTAMP);
    5454#else
    55         static char *timestamp = "";
     55        static const char *timestamp = "";
    5656#endif
    5757
    5858/** Print version information. */
    59 void version_print(const char *vc)
     59void version_print(const char *term)
    6060{
    6161        printf("HelenOS release %s (%s)%s%s\n", release, name, revision, timestamp);
    62         printf("Running on %s (%s)\n", arch, vc);
     62        printf("Running on %s (%s)\n", arch, term);
    6363        printf("Copyright (c) 2001-2009 HelenOS project\n\n");
    6464}
  • uspace/app/getterm/version.h

    rcd82bb1 r371bd7d  
    2727 */
    2828
    29 /** @addtogroup getvc
     29/** @addtogroup getterm
    3030 * @{
    3131 */
     
    3737#define VERSION_H__
    3838
    39 extern void version_print(const char *vc);
     39extern void version_print(const char *term);
    4040
    4141#endif
  • uspace/app/init/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31BINARY = init
    3132
    32 .PHONY: all clean
     33SOURCES = \
     34        init.c
    3335
    34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     36include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/init/init.c

    rcd82bb1 r371bd7d  
    4646#include <malloc.h>
    4747#include <macros.h>
    48 #include <string.h>
     48#include <str.h>
    4949#include <devmap.h>
    5050#include "init.h"
    5151
     52#define DEVFS_MOUNT_POINT  "/dev"
     53
     54#define SRV_CONSOLE  "/srv/console"
     55#define APP_GETTERM  "/app/getterm"
     56
    5257static void info_print(void)
    5358{
     
    5762static bool mount_root(const char *fstype)
    5863{
    59         char *opts = "";
    60         const char *root_dev = "initrd";
     64        const char *opts = "";
     65        const char *root_dev = "bd/initrd";
    6166       
    6267        if (str_cmp(fstype, "tmpfs") == 0)
     
    8994static bool mount_devfs(void)
    9095{
    91         char null[MAX_DEVICE_NAME];
    92         int null_id = devmap_null_create();
    93        
    94         if (null_id == -1) {
    95                 printf(NAME ": Unable to create null device\n");
    96                 return false;
    97         }
    98        
    99         snprintf(null, MAX_DEVICE_NAME, "null%d", null_id);
    100         int rc = mount("devfs", "/dev", null, "", IPC_FLAG_BLOCKING);
     96        int rc = mount("devfs", DEVFS_MOUNT_POINT, "", "", IPC_FLAG_BLOCKING);
    10197       
    10298        switch (rc) {
     
    106102        case EBUSY:
    107103                printf(NAME ": Device filesystem already mounted\n");
    108                 devmap_null_destroy(null_id);
    109104                return false;
    110105        case ELIMIT:
    111106                printf(NAME ": Unable to mount device filesystem\n");
    112                 devmap_null_destroy(null_id);
    113107                return false;
    114108        case ENOENT:
    115109                printf(NAME ": Unknown filesystem type (devfs)\n");
    116                 devmap_null_destroy(null_id);
    117110                return false;
    118111        default:
    119112                printf(NAME ": Error mounting device filesystem (%d)\n", rc);
    120                 devmap_null_destroy(null_id);
    121113                return false;
    122114        }
     
    125117}
    126118
    127 static void spawn(char *fname)
    128 {
    129         char *argv[2];
     119static void spawn(const char *fname)
     120{
     121        const char *argv[2];
    130122        struct stat s;
    131123       
     
    142134}
    143135
    144 static void srv_start(char *fname)
    145 {
    146         char *argv[2];
     136static void srv_start(const char *fname)
     137{
     138        const char *argv[2];
    147139        task_id_t id;
    148140        task_exit_t texit;
     
    170162        }
    171163
    172         if (texit != TASK_EXIT_NORMAL || retval != 0) {
     164        if ((texit != TASK_EXIT_NORMAL) || (retval != 0)) {
    173165                printf(NAME ": Server %s failed to start (returned %d)\n",
    174166                        fname, retval);
     
    176168}
    177169
    178 static void getvc(char *dev, char *app)
    179 {
    180         char *argv[4];
    181         char vc[MAX_DEVICE_NAME];
     170static void console(const char *dev)
     171{
     172        const char *argv[3];
     173        char hid_in[DEVMAP_NAME_MAXLEN];
    182174        int rc;
    183175       
    184         snprintf(vc, MAX_DEVICE_NAME, "/dev/%s", dev);
    185        
    186         printf(NAME ": Spawning getvc on %s\n", vc);
    187        
     176        snprintf(hid_in, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev);
     177       
     178        printf(NAME ": Spawning %s with %s\n", SRV_CONSOLE, hid_in);
     179       
     180        /* Wait for the input device to be ready */
    188181        dev_handle_t handle;
    189182        rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);
    190183       
    191184        if (rc == EOK) {
    192                 argv[0] = "/app/getvc";
    193                 argv[1] = vc;
     185                argv[0] = SRV_CONSOLE;
     186                argv[1] = hid_in;
     187                argv[2] = NULL;
     188               
     189                if (!task_spawn(SRV_CONSOLE, argv))
     190                        printf(NAME ": Error spawning %s with %s\n", SRV_CONSOLE, hid_in);
     191        } else
     192                printf(NAME ": Error waiting on %s\n", hid_in);
     193}
     194
     195static void getterm(const char *dev, const char *app)
     196{
     197        const char *argv[4];
     198        char term[DEVMAP_NAME_MAXLEN];
     199        int rc;
     200       
     201        snprintf(term, DEVMAP_NAME_MAXLEN, "%s/%s", DEVFS_MOUNT_POINT, dev);
     202       
     203        printf(NAME ": Spawning %s with %s %s\n", APP_GETTERM, term, app);
     204       
     205        /* Wait for the terminal device to be ready */
     206        dev_handle_t handle;
     207        rc = devmap_device_get_handle(dev, &handle, IPC_FLAG_BLOCKING);
     208       
     209        if (rc == EOK) {
     210                argv[0] = APP_GETTERM;
     211                argv[1] = term;
    194212                argv[2] = app;
    195213                argv[3] = NULL;
    196214               
    197                 if (!task_spawn("/app/getvc", argv))
    198                         printf(NAME ": Error spawning getvc on %s\n", vc);
    199         } else {
    200                 printf(NAME ": Error waiting on %s\n", vc);
    201         }
    202 }
    203 
    204 static void mount_data(void)
     215                if (!task_spawn(APP_GETTERM, argv))
     216                        printf(NAME ": Error spawning %s with %s %s\n", APP_GETTERM,
     217                            term, app);
     218        } else
     219                printf(NAME ": Error waiting on %s\n", term);
     220}
     221
     222static void mount_scratch(void)
    205223{
    206224        int rc;
    207225
    208         printf("Trying to mount disk0 on /data... ");
     226        printf("Trying to mount null/0 on /scratch... ");
    209227        fflush(stdout);
    210228
    211         rc = mount("fat", "/data", "disk0", "wtcache", 0);
     229        rc = mount("tmpfs", "/scratch", "null/0", "", 0);
    212230        if (rc == EOK)
    213231                printf("OK\n");
     
    216234}
    217235
     236static void mount_data(void)
     237{
     238        int rc;
     239
     240        printf("Trying to mount bd/disk0 on /data... ");
     241        fflush(stdout);
     242
     243        rc = mount("fat", "/data", "bd/disk0", "wtcache", 0);
     244        if (rc == EOK)
     245                printf("OK\n");
     246        else
     247                printf("Failed\n");
     248}
     249
    218250int main(int argc, char *argv[])
    219251{
     
    224256                return -1;
    225257        }
     258
     259        /* Make sure tmpfs is running. */
     260        if (str_cmp(STRING(RDFMT), "tmpfs") != 0) {
     261                spawn("/srv/tmpfs");
     262        }
    226263       
    227264        spawn("/srv/devfs");
     265        spawn("/srv/taskmon");
    228266       
    229267        if (!mount_devfs()) {
     
    231269                return -2;
    232270        }
    233        
     271
     272        mount_scratch();
     273       
     274        spawn("/srv/fhc");
     275        spawn("/srv/obio");
     276        srv_start("/srv/cuda_adb");
     277        srv_start("/srv/i8042");
     278        srv_start("/srv/adb_ms");
     279        srv_start("/srv/char_ms");
     280
    234281        spawn("/srv/fb");
    235282        spawn("/srv/kbd");
    236         spawn("/srv/console");
    237         spawn("/srv/fhc");
    238         spawn("/srv/obio");
     283        console("hid_in/kbd");
     284       
     285        spawn("/srv/clip");
    239286
    240287        /*
     
    255302#endif
    256303
    257         getvc("vc0", "/app/bdsh");
    258         getvc("vc1", "/app/bdsh");
    259         getvc("vc2", "/app/bdsh");
    260         getvc("vc3", "/app/bdsh");
    261         getvc("vc4", "/app/bdsh");
    262         getvc("vc5", "/app/bdsh");
    263         getvc("vc6", "/app/klog");
    264        
     304        getterm("term/vc0", "/app/bdsh");
     305        getterm("term/vc1", "/app/bdsh");
     306        getterm("term/vc2", "/app/bdsh");
     307        getterm("term/vc3", "/app/bdsh");
     308        getterm("term/vc4", "/app/bdsh");
     309        getterm("term/vc5", "/app/bdsh");
     310        getterm("term/vc6", "/app/klog");
     311
    265312        return 0;
    266313}
  • uspace/app/init/init.h

    rcd82bb1 r371bd7d  
    3939#define NAME  "init"
    4040
    41 #define MAX_DEVICE_NAME  32
    42 
    4341#endif
    4442
  • uspace/app/klog/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31BINARY = klog
    3132
    32 .PHONY: all clean
     33SOURCES = \
     34        klog.c
    3335
    34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     36include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/mkfat/Makefile

    rcd82bb1 r371bd7d  
    11#
    22# Copyright (c) 2005 Martin Decky
     3# Copyright (c) 2007 Jakub Jermar
    34# All rights reserved.
    45#
     
    2728#
    2829
     30USPACE_PREFIX = ../..
     31LIBS = $(LIBBLOCK_PREFIX)/libblock.a
     32EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX)
     33BINARY = mkfat
    2934
    30 ## Common names
    31 #
     35SOURCES = \
     36        mkfat.c
    3237
    33 LIBC_PREFIX = ../../lib/libc
    34 SOFTINT_PREFIX = ../../lib/softint
    35 LIBS = $(LIBC_PREFIX)/libc.a
    36 
    37 DEPEND = Makefile.depend
    38 DEPEND_PREV = $(DEPEND).prev
    39 OUTPUT = init
     38include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/redir/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31BINARY = redir
    3132
    32 .PHONY: all clean
     33SOURCES = \
     34        redir.c
    3335
    34 all: $(LIBC_PREFIX)/../../../version $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     36include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/redir/redir.c

    rcd82bb1 r371bd7d  
    3939#include <fcntl.h>
    4040#include <unistd.h>
    41 #include <string.h>
     41#include <str.h>
    4242#include <stdio.h>
    4343#include <task.h>
     
    7272static task_id_t spawn(int argc, char *argv[])
    7373{
    74         char **args = (char *) calloc(argc + 1, sizeof(char *));
     74        const char **args = (const char **) calloc(argc + 1, sizeof(char *));
    7575        if (!args) {
    7676                printf("No memory available\n");
  • uspace/app/tester/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31BINARY = tester
    3132
    32 .PHONY: all clean
     33SOURCES = \
     34        tester.c \
     35        thread/thread1.c \
     36        print/print1.c \
     37        print/print2.c \
     38        print/print3.c \
     39        print/print4.c \
     40        console/console1.c \
     41        stdio/stdio1.c \
     42        stdio/stdio2.c \
     43        fault/fault1.c \
     44        fault/fault2.c \
     45        fault/fault3.c \
     46        vfs/vfs1.c \
     47        ipc/ping_pong.c \
     48        ipc/register.c \
     49        ipc/connect.c \
     50        loop/loop1.c \
     51        mm/malloc1.c
    3352
    34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     53include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/tester/console/console1.c

    rcd82bb1 r371bd7d  
    3636#include "../tester.h"
    3737
    38 const char *color_name[] = {
     38static const char *color_name[] = {
    3939        [COLOR_BLACK] = "black",
    4040        [COLOR_BLUE] = "blue",
     
    4747};
    4848
    49 char *test_console1(void)
     49const char *test_console1(void)
    5050{
    5151        if (!test_quiet) {
  • uspace/app/tester/fault/fault1.c

    rcd82bb1 r371bd7d  
    3030#include "../tester.h"
    3131
    32 char *test_fault1(void)
     32const char *test_fault1(void)
    3333{
    3434        ((int *)(0))[1] = 0;
  • uspace/app/tester/fault/fault2.c

    rcd82bb1 r371bd7d  
    3030#include "../tester.h"
    3131
    32 char *test_fault2(void)
     32typedef int __attribute__((may_alias)) aliasing_int;
     33
     34const char *test_fault2(void)
    3335{
    3436        volatile long long var;
    3537        volatile int var1;
    3638       
    37         var1 = *((int *) (((char *) (&var)) + 1));
     39        var1 = *((aliasing_int *) (((char *) (&var)) + 1));
    3840       
    3941        return "Survived unaligned read";
  • uspace/app/tester/ipc/connect.c

    rcd82bb1 r371bd7d  
    3939}
    4040
    41 char *test_connect(void)
     41const char *test_connect(void)
    4242{
    4343        TPRINTF("Connecting to %u...", IPC_TEST_SERVICE);
  • uspace/app/tester/ipc/ping_pong.c

    rcd82bb1 r371bd7d  
    3838#define COUNT_GRANULARITY  100
    3939
    40 char *test_ping_pong(void)
     40const char *test_ping_pong(void)
    4141{
    4242        TPRINTF("Pinging ns server for %d seconds...", DURATION_SECS);
  • uspace/app/tester/ipc/register.c

    rcd82bb1 r371bd7d  
    7474}
    7575
    76 char *test_register(void)
     76const char *test_register(void)
    7777{
    7878        async_set_client_connection(client_connection);
  • uspace/app/tester/loop/loop1.c

    rcd82bb1 r371bd7d  
    3131#include "../tester.h"
    3232
    33 char *test_loop1(void)
     33const char *test_loop1(void)
    3434{
    3535        TPRINTF("Looping...");
  • uspace/app/tester/mm/malloc1.c

    rcd82bb1 r371bd7d  
    7373
    7474typedef struct {
    75         char *name;
     75        const char *name;
    7676        sp_term_cond_s cond;
    7777        sp_action_prob_s prob;
     
    9090
    9191typedef struct {
    92         char *name;
     92        const char *name;
    9393        ph_alloc_size_s alloc;
    9494        subphase_s *subphases;
     
    628628}
    629629
    630 char *test_malloc1(void)
     630const char *test_malloc1(void)
    631631{
    632632        init_mem();
  • uspace/app/tester/print/print1.c

    rcd82bb1 r371bd7d  
    3131#include "../tester.h"
    3232
    33 char *test_print1(void)
     33const char *test_print1(void)
    3434{
    3535        TPRINTF("Testing printf(\"%%*.*s\", 5, 3, \"text\"):\n");
  • uspace/app/tester/print/print2.c

    rcd82bb1 r371bd7d  
    3131#include "../tester.h"
    3232
    33 char *test_print2(void)
     33const char *test_print2(void)
    3434{
    3535        TPRINTF("Testing printf(\"%%c %%3.2c %%-3.2c %%2.3c %%-2.3c\", 'a', 'b', 'c', 'd', 'e'):\n");
  • uspace/app/tester/print/print3.c

    rcd82bb1 r371bd7d  
    3434#define BUFFER_SIZE  32
    3535
    36 char *test_print3(void)
     36const char *test_print3(void)
    3737{
    3838        char buffer[BUFFER_SIZE];
  • uspace/app/tester/print/print4.c

    rcd82bb1 r371bd7d  
    3131#include "../tester.h"
    3232
    33 char *test_print4(void)
     33const char *test_print4(void)
    3434{
    3535        TPRINTF("ASCII printable characters (32 - 127) using printf(\"%%c\") and printf(\"%%lc\"):\n");
  • uspace/app/tester/stdio/stdio1.c

    rcd82bb1 r371bd7d  
    3636static char buf[BUF_SIZE + 1];
    3737
    38 char *test_stdio1(void)
     38const char *test_stdio1(void)
    3939{
    4040        FILE *file;
    41         char *file_name = "/readme";
     41        const char *file_name = "/readme";
    4242       
    4343        TPRINTF("Open file \"%s\"...", file_name);
  • uspace/app/tester/stdio/stdio2.c

    rcd82bb1 r371bd7d  
    3232#include "../tester.h"
    3333
    34 char *test_stdio2(void)
     34const char *test_stdio2(void)
    3535{
    3636        FILE *file;
    37         char *file_name = "/test";
     37        const char *file_name = "/test";
    3838       
    3939        TPRINTF("Open file \"%s\" for writing...", file_name);
  • uspace/app/tester/tester.c

    rcd82bb1 r371bd7d  
    3838#include <unistd.h>
    3939#include <stdio.h>
    40 #include <string.h>
     40#include <str.h>
    4141#include "tester.h"
    4242
     
    5656#include "fault/fault1.def"
    5757#include "fault/fault2.def"
     58#include "fault/fault3.def"
    5859#include "vfs/vfs1.def"
    5960#include "ipc/ping_pong.def"
     
    6869{
    6970        /* Execute the test */
    70         char *ret = test->entry();
     71        const char *ret = test->entry();
    7172       
    7273        if (ret == NULL) {
  • uspace/app/tester/tester.h

    rcd82bb1 r371bd7d  
    5454        }
    5555
    56 typedef char *(*test_entry_t)(void);
     56typedef const char *(*test_entry_t)(void);
    5757
    5858typedef struct {
    59         char *name;
    60         char *desc;
     59        const char *name;
     60        const char *desc;
    6161        test_entry_t entry;
    6262        bool safe;
    6363} test_t;
    6464
    65 extern char *test_thread1(void);
    66 extern char *test_print1(void);
    67 extern char *test_print2(void);
    68 extern char *test_print3(void);
    69 extern char *test_print4(void);
    70 extern char *test_console1(void);
    71 extern char *test_stdio1(void);
    72 extern char *test_stdio2(void);
    73 extern char *test_fault1(void);
    74 extern char *test_fault2(void);
    75 extern char *test_vfs1(void);
    76 extern char *test_ping_pong(void);
    77 extern char *test_register(void);
    78 extern char *test_connect(void);
    79 extern char *test_loop1(void);
    80 extern char *test_malloc1(void);
     65extern const char *test_thread1(void);
     66extern const char *test_print1(void);
     67extern const char *test_print2(void);
     68extern const char *test_print3(void);
     69extern const char *test_print4(void);
     70extern const char *test_console1(void);
     71extern const char *test_stdio1(void);
     72extern const char *test_stdio2(void);
     73extern const char *test_fault1(void);
     74extern const char *test_fault2(void);
     75extern const char *test_fault3(void);
     76extern const char *test_vfs1(void);
     77extern const char *test_ping_pong(void);
     78extern const char *test_register(void);
     79extern const char *test_connect(void);
     80extern const char *test_loop1(void);
     81extern const char *test_malloc1(void);
    8182
    8283extern test_t tests[];
  • uspace/app/tester/thread/thread1.c

    rcd82bb1 r371bd7d  
    5050}
    5151
    52 char *test_thread1(void)
     52const char *test_thread1(void)
    5353{
    5454        unsigned int i;
    55         int total = 0;
     55        atomic_count_t total = 0;
    5656       
    5757        atomic_set(&finish, 1);
  • uspace/app/tester/vfs/vfs1.c

    rcd82bb1 r371bd7d  
    3030#include <stdio.h>
    3131#include <stdlib.h>
    32 #include <string.h>
     32#include <str.h>
    3333#include <vfs/vfs.h>
    3434#include <unistd.h>
     
    5454static char text[] = "Lorem ipsum dolor sit amet, consectetur adipisicing elit";
    5555
    56 static char *read_root(void)
     56static const char *read_root(void)
    5757{
    5858        TPRINTF("Opening the root directory...");
     
    7373}
    7474
    75 char *test_vfs1(void)
     75const char *test_vfs1(void)
    7676{
    7777        if (mkdir(MOUNT_POINT, 0) != 0)
     
    7979        TPRINTF("Created directory %s\n", MOUNT_POINT);
    8080       
    81         char null[MAX_DEVICE_NAME];
    82         int null_id = devmap_null_create();
    83        
    84         if (null_id == -1)
    85                 return "Unable to create null device";
    86        
    87         snprintf(null, MAX_DEVICE_NAME, "null%d", null_id);
    88         int rc = mount(FS_TYPE, MOUNT_POINT, null, OPTIONS, FLAGS);
     81        int rc = mount(FS_TYPE, MOUNT_POINT, "", OPTIONS, FLAGS);
    8982        switch (rc) {
    9083        case EOK:
    91                 TPRINTF("Mounted /dev/%s as %s on %s\n", null, FS_TYPE, MOUNT_POINT);
     84                TPRINTF("Mounted %s on %s\n", FS_TYPE, MOUNT_POINT);
    9285                break;
    9386        case EBUSY:
     
    128121        close(fd0);
    129122       
    130         char *rv = read_root();
     123        const char *rv = read_root();
    131124        if (rv != NULL)
    132125                return rv;
  • uspace/app/tetris/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31BINARY = tetris
    3132
    32 .PHONY: all clean
     33SOURCES = \
     34        shapes.c \
     35        scores.c \
     36        input.c \
     37        tetris.c \
     38        screen.c
    3339
    34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     40include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/tetris/input.c

    rcd82bb1 r371bd7d  
    5252#include <errno.h>
    5353#include <unistd.h>
    54 #include <string.h>
     54#include <str.h>
    5555
    5656#include "input.h"
  • uspace/app/tetris/scores.c

    rcd82bb1 r371bd7d  
    5252#include <errno.h>
    5353#include <stdio.h>
    54 #include <string.h>
     54#include <str.h>
    5555#include <io/console.h>
    5656#include <io/keycode.h>
  • uspace/app/tetris/scores.h

    rcd82bb1 r371bd7d  
    4848
    4949#include <sys/time.h>
    50 #include <string.h>
     50#include <str.h>
    5151
    5252#define MAXLOGNAME   16
  • uspace/app/tetris/screen.c

    rcd82bb1 r371bd7d  
    4949#include <stdio.h>
    5050#include <stdlib.h>
    51 #include <string.h>
     51#include <str.h>
    5252#include <unistd.h>
    5353#include <vfs/vfs.h>
     
    7272 * simply literal strings);
    7373 */
    74 static inline void putstr(char *s)
     74static inline void putstr(const char *s)
    7575{
    7676        while (*s)
     
    181181}
    182182
    183 void stop(char *why)
     183void stop(const char *why)
    184184{
    185185        if (isset)
  • uspace/app/tetris/tetris.c

    rcd82bb1 r371bd7d  
    5353#include <stdio.h>
    5454#include <stdlib.h>
    55 #include <string.h>
     55#include <str.h>
    5656#include <unistd.h>
    5757#include <getopt.h>
  • uspace/app/tetris/tetris.h

    rcd82bb1 r371bd7d  
    186186extern int fits_in(const struct shape *, int);
    187187extern void place(const struct shape *, int, int);
    188 extern void stop(char *);
     188extern void stop(const char *);
    189189
    190190/** @}
  • uspace/app/trace/Makefile

    rcd82bb1 r371bd7d  
    2828#
    2929
    30 include Makefile.common
     30USPACE_PREFIX = ../..
     31BINARY = trace
    3132
    32 .PHONY: all clean
     33SOURCES = \
     34        trace.c \
     35        syscalls.c \
     36        ipcp.c \
     37        ipc_desc.c \
     38        proto.c \
     39        errors.c
    3340
    34 all: $(LIBC_PREFIX)/../../../Makefile.config $(LIBC_PREFIX)/../../../config.h $(LIBC_PREFIX)/../../../config.defs $(LIBS)
    35         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    36         $(MAKE) -f Makefile.build
    37 
    38 clean:
    39         rm -f $(DEPEND) $(DEPEND_PREV) $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm
    40         find . -name '*.o' -follow -exec rm \{\} \;
     41include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/trace/errors.h

    rcd82bb1 r371bd7d  
    3737
    3838typedef struct {
    39         char *name;     /**< Error value name (Exx) */
    40         char *desc;     /**< Error description */
     39        const char *name;  /**< Error value name (Exx) */
     40        const char *desc;  /**< Error description */
    4141} err_desc_t;
    4242
  • uspace/app/trace/ipc_desc.h

    rcd82bb1 r371bd7d  
    3838typedef struct {
    3939        int number;
    40         char *name;
     40        const char *name;
    4141} ipc_m_desc_t;
    4242
  • uspace/app/trace/ipcp.c

    rcd82bb1 r371bd7d  
    3636#include <stdlib.h>
    3737#include <adt/hash_table.h>
     38#include <sys/typefmt.h>
    3839
    3940#include "ipc_desc.h"
     
    200201
    201202        if ((display_mask & DM_IPC) != 0) {
    202                 printf("Call ID: 0x%lx, phone: %d, proto: %s, method: ", hash,
     203                printf("Call ID: %p, phone: %d, proto: %s, method: ", hash,
    203204                        phone, (proto ? proto->name : "n/a"));
    204205                ipc_m_print(proto, IPC_GET_METHOD(*call));
    205                 printf(" args: (%lu, %lu, %lu, %lu, %lu)\n", args[1], args[2],
     206                printf(" args: (%" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG
     207                    ", %" PRIuIPCARG ", %" PRIuIPCARG ")\n", args[1], args[2],
    206208                    args[3], args[4], args[5]);
    207209        }
     
    279281
    280282        if ((display_mask & DM_IPC) != 0) {
    281                 printf("Response to 0x%lx: retval=%ld, args = (%lu, %lu, %lu, %lu, %lu)\n",
    282                         hash, retval, IPC_GET_ARG1(*answer),
    283                         IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
    284                         IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
     283                printf("Response to %p: retval=%ld, args = (%" PRIuIPCARG
     284                    ", %" PRIuIPCARG ", %" PRIuIPCARG ", %" PRIuIPCARG
     285                    ", %" PRIuIPCARG ")\n",
     286                    hash, retval, IPC_GET_ARG1(*answer),
     287                    IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
     288                    IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
    285289        }
    286290
     
    336340                /* Not a response */
    337341                if ((display_mask & DM_IPC) != 0) {
    338                         printf("Not a response (hash 0x%lx)\n", hash);
     342                        printf("Not a response (hash %p)\n", hash);
    339343                }
    340344                return;
  • uspace/app/trace/proto.c

    rcd82bb1 r371bd7d  
    157157}
    158158
    159 static void proto_struct_init(proto_t *proto, char *name)
     159static void proto_struct_init(proto_t *proto, const char *name)
    160160{
    161161        proto->name = name;
     
    164164}
    165165
    166 proto_t *proto_new(char *name)
     166proto_t *proto_new(const char *name)
    167167{
    168168        proto_t *p;
     
    206206}
    207207
    208 static void oper_struct_init(oper_t *oper, char *name)
     208static void oper_struct_init(oper_t *oper, const char *name)
    209209{
    210210        oper->name = name;
    211211}
    212212
    213 oper_t *oper_new(char *name, int argc, val_type_t *arg_types,
     213oper_t *oper_new(const char *name, int argc, val_type_t *arg_types,
    214214    val_type_t rv_type, int respc, val_type_t *resp_types)
    215215{
  • uspace/app/trace/proto.h

    rcd82bb1 r371bd7d  
    4343
    4444typedef struct {
    45         char *name;
     45        const char *name;
    4646
    4747        int argc;
     
    5656typedef struct {
    5757        /** Protocol name */
    58         char *name;
     58        const char *name;
    5959
    6060        /** Maps method number to operation */
     
    7070void proto_register(int srv, proto_t *proto);
    7171proto_t *proto_get_by_srv(int srv);
    72 proto_t *proto_new(char *name);
     72proto_t *proto_new(const char *name);
    7373void proto_delete(proto_t *proto);
    7474void proto_add_oper(proto_t *proto, int method, oper_t *oper);
    7575oper_t *proto_get_oper(proto_t *proto, int method);
    7676
    77 oper_t *oper_new(char *name, int argc, val_type_t *arg_types,
     77oper_t *oper_new(const char *name, int argc, val_type_t *arg_types,
    7878    val_type_t rv_type, int respc, val_type_t *resp_types);
    7979
  • uspace/app/trace/syscalls.h

    rcd82bb1 r371bd7d  
    3939
    4040typedef struct {
    41         char *name;
     41        const char *name;
    4242        int n_args;
    4343        val_type_t rv_type;
  • uspace/app/trace/trace.c

    rcd82bb1 r371bd7d  
    4343#include <task.h>
    4444#include <mem.h>
    45 #include <string.h>
     45#include <str.h>
    4646#include <bool.h>
    4747#include <loader/loader.h>
    4848#include <io/console.h>
    4949#include <io/keycode.h>
    50 #include <fibril_sync.h>
     50#include <fibril_synch.h>
     51#include <sys/types.h>
     52#include <sys/typefmt.h>
    5153
    5254#include <libc.h>
     
    159161        if (rc < 0) {
    160162                printf("Error connecting\n");
    161                 printf("ipc_connect_task(%lld) -> %d ", task_id, rc);
     163                printf("ipc_connect_task(%" PRIdTASKID ") -> %d ", task_id, rc);
    162164                return rc;
    163165        }
     
    198200        printf("Threads:");
    199201        for (i = 0; i < n_threads; i++) {
    200                 printf(" [%d] (hash 0x%lx)", 1+i, thread_hash_buf[i]);
     202                printf(" [%d] (hash %p)", 1+i, thread_hash_buf[i]);
    201203        }
    202204        printf("\ntotal of %u threads\n", tb_needed / sizeof(uintptr_t));
     
    222224        case V_HASH:
    223225        case V_PTR:
    224                 printf("0x%08lx", val);
     226                printf("%p", val);
    225227                break;
    226228
     
    275277
    276278        putchar('(');
    277         if (n > 0) printf("%ld", sc_args[0]);
     279        if (n > 0) printf("%" PRIdSYSARG, sc_args[0]);
    278280        for (i = 1; i < n; i++) {
    279                 printf(", %ld", sc_args[i]);
     281                printf(", %" PRIdSYSARG, sc_args[i]);
    280282        }
    281283        putchar(')');
     
    508510        }
    509511
    510         printf("Start tracing thread [%d] (hash 0x%lx).\n", thread_id, thread_hash);
     512        printf("Start tracing thread [%d] (hash %p).\n", thread_id, thread_hash);
    511513
    512514        while (!abort_trace) {
     
    552554                                break;
    553555                        case UDEBUG_EVENT_THREAD_E:
    554                                 printf("Thread 0x%lx exited.\n", val0);
     556                                printf("Thread %p exited.\n", val0);
    555557                                fibril_mutex_lock(&state_lock);
    556558                                abort_trace = true;
     
    583585}
    584586
    585 static loader_t *preload_task(const char *path, char *const argv[],
     587static loader_t *preload_task(const char *path, char **argv,
    586588    task_id_t *task_id)
    587589{
     
    589591        int rc;
    590592
    591         /* Spawn a program loader */   
     593        /* Spawn a program loader */
    592594        ldr = loader_connect();
    593595        if (ldr == NULL)
     
    605607
    606608        /* Send arguments */
    607         rc = loader_set_args(ldr, argv);
     609        rc = loader_set_args(ldr, (const char **) argv);
    608610        if (rc != EOK)
    609611                goto error;
     
    868870}
    869871
    870 static display_mask_t parse_display_mask(char *text)
     872static display_mask_t parse_display_mask(const char *text)
    871873{
    872874        display_mask_t dm;
    873         char *c;
    874 
    875         c = text;
    876 
     875        const char *c = text;
     876       
    877877        while (*c) {
    878878                switch (*c) {
    879                 case 't': dm = dm | DM_THREAD; break;
    880                 case 's': dm = dm | DM_SYSCALL; break;
    881                 case 'i': dm = dm | DM_IPC; break;
    882                 case 'p': dm = dm | DM_SYSTEM | DM_USER; break;
     879                case 't':
     880                        dm = dm | DM_THREAD;
     881                        break;
     882                case 's':
     883                        dm = dm | DM_SYSCALL;
     884                        break;
     885                case 'i':
     886                        dm = dm | DM_IPC;
     887                        break;
     888                case 'p':
     889                        dm = dm | DM_SYSTEM | DM_USER;
     890                        break;
    883891                default:
    884892                        printf("Unexpected event type '%c'.\n", *c);
    885893                        exit(1);
    886894                }
    887 
     895               
    888896                ++c;
    889897        }
    890 
     898       
    891899        return dm;
    892900}
     
    894902static int parse_args(int argc, char *argv[])
    895903{
    896         char *arg;
    897904        char *err_p;
    898905
    899906        task_id = 0;
    900907
    901         --argc; ++argv;
     908        --argc;
     909        ++argv;
    902910
    903911        while (argc > 0) {
    904                 arg = *argv;
     912                char *arg = *argv;
    905913                if (arg[0] == '+') {
    906914                        display_mask = parse_display_mask(&arg[1]);
     
    908916                        if (arg[1] == 't') {
    909917                                /* Trace an already running task */
    910                                 --argc; ++argv;
     918                                --argc;
     919                                ++argv;
    911920                                task_id = strtol(*argv, &err_p, 10);
    912921                                task_ldr = NULL;
     
    925934                        break;
    926935                }
    927 
    928                 --argc; ++argv;
     936               
     937                --argc;
     938                ++argv;
    929939        }
    930940
    931941        if (task_id != 0) {
    932                 if (argc == 0) return 0;
     942                if (argc == 0)
     943                        return 0;
    933944                printf("Extra arguments\n");
    934945                print_syntax();
     
    944955        /* Preload the specified program file. */
    945956        printf("Spawning '%s' with arguments:\n", *argv);
    946         {
    947                 char **cp = argv;
    948                 while (*cp) printf("'%s'\n", *cp++);
    949         }
     957       
     958        char **cp = argv;
     959        while (*cp)
     960                printf("'%s'\n", *cp++);
     961       
    950962        task_ldr = preload_task(*argv, argv, &task_id);
    951963        task_wait_for = true;
     
    972984        rc = connect_task(task_id);
    973985        if (rc < 0) {
    974                 printf("Failed connecting to task %lld.\n", task_id);
     986                printf("Failed connecting to task %" PRIdTASKID ".\n", task_id);
    975987                return 1;
    976988        }
    977989
    978         printf("Connected to task %lld.\n", task_id);
     990        printf("Connected to task %" PRIdTASKID ".\n", task_id);
    979991
    980992        if (task_ldr != NULL)
Note: See TracChangeset for help on using the changeset viewer.