Changeset e28175d in mainline for uspace/app
- Timestamp:
- 2020-03-15T10:44:02Z (6 years ago)
- 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)
- Location:
- uspace/app
- Files:
-
- 49 added
- 29 deleted
- 25 edited
- 29 moved
-
barber/Makefile (deleted)
-
barber/barber.c (modified) (1 diff)
-
barber/meson.build (added)
-
bdsh/cmds/modules/alias/alias.c (added)
-
bdsh/cmds/modules/alias/alias.h (added)
-
bdsh/cmds/modules/alias/alias_def.inc (added)
-
bdsh/cmds/modules/alias/entry.h (added)
-
bdsh/cmds/modules/ls/ls.c (modified) (2 diffs)
-
bdsh/cmds/modules/modules.c (modified) (2 diffs)
-
bdsh/cmds/modules/modules.h (modified) (1 diff)
-
bdsh/cmds/modules/unalias/entry.h (added)
-
bdsh/cmds/modules/unalias/unalias.c (added)
-
bdsh/cmds/modules/unalias/unalias.h (added)
-
bdsh/cmds/modules/unalias/unalias_def.inc (added)
-
bdsh/compl.c (modified) (6 diffs)
-
bdsh/config.h (modified) (1 diff)
-
bdsh/input.c (modified) (6 diffs)
-
bdsh/meson.build (moved) (moved from uspace/app/bdsh/Makefile ) (1 diff)
-
bdsh/scli.c (modified) (5 diffs)
-
bdsh/scli.h (modified) (3 diffs)
-
bithenge/meson.build (added)
-
blkdump/meson.build (moved) (moved from uspace/srv/klog/Makefile ) (1 diff)
-
contacts/meson.build (moved) (moved from boot/arch/abs32le/Makefile.inc ) (2 diffs)
-
corecfg/Makefile (deleted)
-
corecfg/meson.build (added)
-
cpptest/main.cpp (modified) (1 diff)
-
cpptest/meson.build (added)
-
date/meson.build (moved) (moved from uspace/app/date/Makefile ) (1 diff)
-
devctl/Makefile (deleted)
-
devctl/meson.build (moved) (moved from uspace/app/loc/Makefile ) (1 diff)
-
df/df.c (modified) (2 diffs)
-
df/meson.build (moved) (moved from uspace/app/df/Makefile ) (1 diff)
-
dltest/Makefile (deleted)
-
dltest/meson.build (added)
-
dltests/meson.build (added)
-
dnscfg/Makefile (deleted)
-
dnscfg/meson.build (added)
-
dnsres/Makefile (deleted)
-
dnsres/meson.build (added)
-
download/main.c (modified) (1 diff)
-
download/meson.build (moved) (moved from uspace/srv/hid/rfb/Makefile ) (1 diff)
-
edit/meson.build (moved) (moved from uspace/app/redir/Makefile ) (1 diff)
-
fdisk/fdisk.c (modified) (37 diffs)
-
fdisk/meson.build (added)
-
fontviewer/fontviewer.c (modified) (1 diff)
-
fontviewer/meson.build (added)
-
getterm/meson.build (added)
-
getterm/version.c (modified) (1 diff)
-
gunzip/Makefile (deleted)
-
gunzip/meson.build (moved) (moved from uspace/app/pkg/Makefile ) (1 diff)
-
hbench/meson.build (moved) (moved from uspace/app/contacts/Makefile ) (1 diff)
-
inet/meson.build (moved) (moved from uspace/app/inet/Makefile ) (1 diff)
-
init/init.c (modified) (7 diffs)
-
init/meson.build (moved) (moved from uspace/app/stats/Makefile ) (1 diff)
-
kill/meson.build (added)
-
killall/meson.build (moved) (moved from uspace/lib/c/arch/abs32le/Makefile.common ) (1 diff)
-
kio/meson.build (added)
-
loc/meson.build (added)
-
logset/meson.build (moved) (moved from uspace/app/logset/Makefile ) (1 diff)
-
lprint/meson.build (added)
-
meson.build (moved) (moved from uspace/srv/fs/udf/Makefile ) (2 diffs)
-
mixerctl/meson.build (added)
-
mkbd/meson.build (added)
-
mkexfat/Makefile (deleted)
-
mkexfat/meson.build (added)
-
mkext4/Makefile (deleted)
-
mkext4/meson.build (moved) (moved from uspace/app/lprint/Makefile ) (1 diff)
-
mkfat/meson.build (added)
-
mkmfs/Makefile (deleted)
-
mkmfs/meson.build (added)
-
modplay/Makefile (deleted)
-
modplay/meson.build (moved) (moved from uspace/drv/audio/hdaudio/Makefile ) (1 diff)
-
netecho/meson.build (added)
-
nic/meson.build (added)
-
nterm/meson.build (added)
-
pci/meson.build (moved) (moved from uspace/app/pci/Makefile ) (1 diff)
-
ping/meson.build (added)
-
pkg/meson.build (moved) (moved from uspace/app/vol/Makefile ) (1 diff)
-
redir/meson.build (moved) (moved from uspace/lib/c/arch/riscv64/Makefile.common ) (2 diffs)
-
sbi/Makefile (deleted)
-
sbi/meson.build (moved) (moved from uspace/app/kill/Makefile ) (1 diff)
-
sportdmp/Makefile (deleted)
-
sportdmp/meson.build (added)
-
stats/meson.build (added)
-
stats/stats.c (modified) (13 diffs)
-
sysinfo/Makefile (deleted)
-
sysinfo/meson.build (added)
-
sysinst/Makefile (deleted)
-
sysinst/meson.build (moved) (moved from uspace/app/nic/Makefile ) (1 diff)
-
sysinst/sysinst.c (modified) (4 diffs)
-
taskdump/Makefile (deleted)
-
taskdump/meson.build (moved) (moved from uspace/srv/hid/s3c24xx_ts/Makefile ) (1 diff)
-
taskdump/taskdump.c (modified) (1 diff)
-
tester/Makefile (deleted)
-
tester/meson.build (added)
-
tester/mm/pager1.c (modified) (1 diff)
-
testread/Makefile (deleted)
-
testread/meson.build (added)
-
testrunner/Makefile (deleted)
-
testrunner/meson.build (added)
-
testwrit/Makefile (deleted)
-
testwrit/meson.build (added)
-
tetris/Makefile (deleted)
-
tetris/meson.build (moved) (moved from uspace/lib/fs/Makefile ) (1 diff)
-
tmon/Makefile (deleted)
-
tmon/meson.build (added)
-
top/Makefile (deleted)
-
top/meson.build (added)
-
trace/Makefile (deleted)
-
trace/meson.build (added)
-
trace/syscalls.c (modified) (3 diffs)
-
trace/trace.c (modified) (13 diffs)
-
untar/meson.build (added)
-
usbinfo/Makefile (deleted)
-
usbinfo/main.c (modified) (1 diff)
-
usbinfo/meson.build (moved) (moved from uspace/drv/test/test1/Makefile ) (1 diff)
-
vcalc/meson.build (added)
-
vdemo/Makefile (deleted)
-
vdemo/meson.build (added)
-
viewer/meson.build (moved) (moved from uspace/app/viewer/Makefile ) (1 diff)
-
viewer/viewer.c (modified) (1 diff)
-
vlaunch/meson.build (moved) (moved from uspace/app/vcalc/Makefile ) (1 diff)
-
vlaunch/vlaunch.c (modified) (1 diff)
-
vol/meson.build (added)
-
vterm/Makefile (deleted)
-
vterm/meson.build (added)
-
vuhid/Makefile (deleted)
-
vuhid/meson.build (moved) (moved from uspace/drv/block/usbmast/Makefile ) (1 diff)
-
wavplay/meson.build (moved) (moved from uspace/lib/hound/Makefile ) (1 diff)
-
websrv/Makefile (deleted)
-
websrv/meson.build (added)
-
wifi_supplicant/meson.build (added)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/barber/barber.c
rb401b33 re28175d 45 45 #include <window.h> 46 46 #include <canvas.h> 47 #include < surface.h>48 #include < codec/tga.gz.h>47 #include <draw/surface.h> 48 #include <draw/codec.h> 49 49 #include "images.h" 50 50 -
uspace/app/bdsh/cmds/modules/ls/ls.c
rb401b33 re28175d 42 42 #include <vfs/vfs.h> 43 43 #include <str.h> 44 #include <cap .h>44 #include <capa.h> 45 45 46 46 #include "ls.h" … … 106 106 } 107 107 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); 111 111 112 112 char *rptr; 113 errno_t rc = cap _format(&cap, &rptr);113 errno_t rc = capa_format(&capa, &rptr); 114 114 if (rc != EOK) { 115 115 return rc; -
uspace/app/bdsh/cmds/modules/modules.c
rb401b33 re28175d 63 63 #include "echo/entry.h" 64 64 #include "cmp/entry.h" 65 #include "alias/entry.h" 66 #include "unalias/entry.h" 65 67 66 68 /* … … 88 90 #include "echo/echo_def.inc" 89 91 #include "cmp/cmp_def.inc" 92 #include "alias/alias_def.inc" 93 #include "unalias/unalias_def.inc" 90 94 91 95 { NULL, NULL, NULL, NULL } -
uspace/app/bdsh/cmds/modules/modules.h
rb401b33 re28175d 31 31 32 32 #include "../cmds.h" 33 #include "modules.h"34 33 35 34 extern module_t modules[]; -
uspace/app/bdsh/compl.c
rb401b33 re28175d 35 35 #include <vfs/vfs.h> 36 36 #include <str.h> 37 37 #include <adt/odict.h> 38 39 #include "scli.h" 38 40 #include "cmds/cmds.h" 39 41 #include "compl.h" … … 63 65 /** Length of string prefix (number of characters) */ 64 66 size_t prefix_len; 67 68 /* Pointer to the current alias */ 69 odlink_t *alias_link; 65 70 66 71 /** Pointer inside list of modules */ … … 243 248 } else if (cs->is_command) { 244 249 /* Command without path */ 250 cs->alias_link = odict_first(&alias_dict); 245 251 cs->module = modules; 246 252 cs->builtin = builtins; … … 321 327 } 322 328 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 323 343 /* Modules */ 324 344 if (cs->module != NULL) { 325 345 while (*compl == NULL && cs->module->name != NULL) { 346 /* prevents multiple listing of an overriden cmd */ 326 347 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 } 331 355 } 332 356 cs->module++; … … 338 362 while (*compl == NULL && cs->builtin->name != NULL) { 339 363 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 } 344 372 } 345 373 cs->builtin++; … … 389 417 free(ent_path); 390 418 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 391 427 asprintf(compl, "%s%c", dent->d_name, 392 428 ent_stat.is_directory ? '/' : ' '); -
uspace/app/bdsh/config.h
rb401b33 re28175d 42 42 #endif 43 43 44 /* define maximal nested aliases */ 45 #ifndef HUBS_MAX 46 #define HUBS_MAX 20 47 #endif 48 44 49 /* Used in many places */ 45 50 #define SMALL_BUFLEN 256 -
uspace/app/bdsh/input.c
rb401b33 re28175d 3 3 * Copyright (c) 2011 Jiri Svoboda 4 4 * Copyright (c) 2011 Martin Sucha 5 * Copyright (c) 2018 Matthieu Riolo 5 6 * All rights reserved. 6 7 * … … 43 44 #include <stdbool.h> 44 45 #include <tinput.h> 46 #include <adt/odict.h> 47 #include <adt/list.h> 45 48 46 49 #include "config.h" … … 62 65 static void print_pipe_usage(void); 63 66 67 typedef struct { 68 link_t alias_hup_link; 69 alias_t *alias; 70 } alias_hup_t; 71 72 static 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 64 83 /* 65 84 * Tokenizes input from console, sees if the first word is a built-in, if so … … 67 86 * the handler 68 87 */ 69 errno_t process_input(cliuser_t *usr) 70 { 88 static 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 71 95 token_t *tokens_buf = calloc(WORD_MAX, sizeof(token_t)); 72 96 if (tokens_buf == NULL) … … 171 195 } 172 196 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 173 247 iostate_t new_iostate = { 174 248 .stdin = stdin, … … 225 299 } 226 300 301 errno_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 227 316 void print_pipe_usage(void) 228 317 { -
uspace/app/bdsh/meson.build
rb401b33 re28175d 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 LIBS = clui fmtutil 32 EXTRA_CFLAGS = -I. -Icmds/ -Icmds/builtins -Icmds/modules 33 BINARY = bdsh 30 deps = [ 'clui', 'fmtutil' ] 31 includes += include_directories('.', 'cmds', 'cmds/builtins', 'cmds/modules') 32 src = 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 ) 34 69 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 70 test_src = files( 71 'tok.c', 72 'test/toktest.c', 73 ) 69 74 70 TEST_SOURCES = \ 71 tok.c \ 72 test/toktest.c 73 74 include $(USPACE_PREFIX)/Makefile.common 75 # TODO: install this file somewhere sane 76 installed_data += { 'name': 'demo.txt', 'dir': '/' } -
uspace/app/bdsh/scli.c
rb401b33 re28175d 1 1 /* 2 2 * Copyright (c) 2008 Tim Post 3 * Copyright (c) 2018 Matthieu Riolo 3 4 * All rights reserved. 4 5 * … … 31 32 #include <stddef.h> 32 33 #include <str.h> 34 #include <adt/odict.h> 33 35 #include "config.h" 34 36 #include "scli.h" … … 42 44 static iostate_t *iostate; 43 45 static iostate_t stdiostate; 46 47 odict_t alias_dict; 44 48 45 49 /* … … 55 59 */ 56 60 const char *progname = PACKAGE_NAME; 61 62 static int alias_cmp(void *a, void *b) 63 { 64 return str_cmp((char *)a, (char *)b); 65 } 66 67 static void *alias_key(odlink_t *odlink) 68 { 69 return (void *)odict_get_instance(odlink, alias_t, odict)->name; 70 } 57 71 58 72 /* These are not exposed, even to builtins */ … … 108 122 iostate = &stdiostate; 109 123 124 odict_initialize(&alias_dict, alias_key, alias_cmp); 125 110 126 if (cli_init(&usr)) 111 127 exit(EXIT_FAILURE); -
uspace/app/bdsh/scli.h
rb401b33 re28175d 1 1 /* 2 2 * Copyright (c) 2008 Tim Post 3 * Copyright (c) 2018 Matthieu Riolo 3 4 * All rights reserved. 4 5 * … … 34 35 #include <stdint.h> 35 36 #include <stdio.h> 37 #include <types/adt/odict.h> 36 38 37 39 typedef struct { … … 54 56 extern void set_iostate(iostate_t *); 55 57 58 extern odict_t alias_dict; 59 60 typedef struct { 61 odlink_t odict; 62 char *name; 63 char *value; 64 } alias_t; 65 56 66 #endif -
uspace/app/blkdump/meson.build
rb401b33 re28175d 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 BINARY = klog 32 33 SOURCES = \ 34 klog.c 35 36 include $(USPACE_PREFIX)/Makefile.common 30 deps = [ 'block', 'scsi' ] 31 src = files('blkdump.c') -
uspace/app/contacts/meson.build
rb401b33 re28175d 1 1 # 2 # Copyright (c) 201 0 Martin Decky2 # Copyright (c) 2018 Jiri Svoboda 3 3 # All rights reserved. 4 4 # … … 27 27 # 28 28 29 BOOT_OUTPUT = 30 RAW = 31 JOB = 32 MAP = 33 PREBUILD = 34 BUILD = Makefile.empty 29 deps = [ 'clui', 'sif' ] 30 src = files('contacts.c') -
uspace/app/cpptest/main.cpp
rb401b33 re28175d 121 121 ts.add<std::test::functional_test>(); 122 122 ts.add<std::test::algorithm_test>(); 123 ts.add<std::test::future_test>(); 123 124 124 125 return ts.run(true) ? 0 : 1; -
uspace/app/date/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = date 31 32 SOURCES = \ 33 date.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 src = files('date.c') -
uspace/app/devctl/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = loc 31 32 SOURCES = \ 33 loc.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 src = files('devctl.c') -
uspace/app/df/df.c
rb401b33 re28175d 35 35 */ 36 36 37 #include <cap .h>37 #include <capa.h> 38 38 #include <stdbool.h> 39 39 #include <stdio.h> … … 124 124 static errno_t size_to_human_readable(uint64_t nblocks, size_t block_size, char **rptr) 125 125 { 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); 131 131 } 132 132 -
uspace/app/df/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = df 31 32 SOURCES = \ 33 df.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 src = files('df.c') -
uspace/app/download/main.c
rb401b33 re28175d 49 49 #define NAME "download" 50 50 #ifdef TIMESTAMP_UNIX 51 #define VERSION STRING( RELEASE) "-" STRING(TIMESTAMP_UNIX)51 #define VERSION STRING(HELENOS_RELEASE) "-" STRING(TIMESTAMP_UNIX) 52 52 #else 53 #define VERSION STRING( RELEASE)53 #define VERSION STRING(HELENOS_RELEASE) 54 54 #endif 55 55 #define USER_AGENT "HelenOS-" NAME "/" VERSION -
uspace/app/download/meson.build
rb401b33 re28175d 27 27 # 28 28 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 29 deps = [ 'http', 'uri' ] 30 c_args += ('-DRELEASE=' + HELENOS_RELEASE) 31 src = files('main.c') -
uspace/app/edit/meson.build
rb401b33 re28175d 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 BINARY = redir 32 33 SOURCES = \ 34 redir.c 35 36 include $(USPACE_PREFIX)/Makefile.common 30 src = files( 31 'edit.c', 32 'search.c', 33 'sheet.c', 34 ) -
uspace/app/fdisk/fdisk.c
rb401b33 re28175d 34 34 */ 35 35 36 #include <cap .h>36 #include <capa.h> 37 37 #include <errno.h> 38 38 #include <fdisk.h> … … 136 136 nchoice_t *choice = NULL; 137 137 char *svcname = NULL; 138 cap _spec_t cap;138 capa_spec_t capa; 139 139 fdisk_dev_info_t *sdev; 140 char *scap = NULL;140 char *scapa = NULL; 141 141 char *dtext = NULL; 142 142 service_id_t svcid; … … 177 177 } 178 178 179 rc = fdisk_dev_info_capacity(info, &cap );179 rc = fdisk_dev_info_capacity(info, &capa); 180 180 if (rc != EOK) { 181 181 printf("Error getting device capacity " … … 185 185 } 186 186 187 cap _simplify(&cap);188 189 rc = cap _format(&cap, &scap);187 capa_simplify(&capa); 188 189 rc = capa_format(&capa, &scapa); 190 190 if (rc != EOK) { 191 191 assert(rc == ENOMEM); … … 194 194 } 195 195 196 int ret = asprintf(&dtext, "%s (%s)", svcname, scap );196 int ret = asprintf(&dtext, "%s (%s)", svcname, scapa); 197 197 if (ret < 0) { 198 198 rc = ENOMEM; … … 203 203 free(svcname); 204 204 svcname = NULL; 205 free(scap );206 scap = NULL;205 free(scapa); 206 scapa = NULL; 207 207 208 208 rc = nchoice_add(choice, dtext, info, 0); … … 261 261 free(dtext); 262 262 free(svcname); 263 free(scap );263 free(scapa); 264 264 return rc; 265 265 } … … 432 432 errno_t rc; 433 433 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; 436 436 vol_label_supp_t vlsupp; 437 437 vol_fstype_t fstype = 0; 438 438 tinput_t *tinput = NULL; 439 439 fdisk_spc_t spc; 440 char *scap ;441 char *smcap = NULL;440 char *scapa; 441 char *smcapa = NULL; 442 442 char *label = NULL; 443 443 char *mountp = NULL; … … 448 448 spc = spc_pri; 449 449 450 rc = fdisk_part_get_max_avail(dev, spc, &mcap );450 rc = fdisk_part_get_max_avail(dev, spc, &mcapa); 451 451 if (rc != EOK) { 452 452 rc = EIO; … … 454 454 } 455 455 456 cap _simplify(&mcap);457 458 rc = cap _format(&mcap, &smcap);456 capa_simplify(&mcapa); 457 458 rc = capa_format(&mcapa, &smcapa); 459 459 if (rc != EOK) { 460 460 rc = ENOMEM; … … 474 474 while (true) { 475 475 printf("Enter capacity of new partition.\n"); 476 rc = tinput_read_i(tinput, smcap , &scap);476 rc = tinput_read_i(tinput, smcapa, &scapa); 477 477 if (rc != EOK) 478 478 goto error; 479 479 480 rc = cap _parse(scap, &cap);480 rc = capa_parse(scapa, &capa); 481 481 if (rc == EOK) 482 482 break; … … 485 485 tinput_destroy(tinput); 486 486 tinput = NULL; 487 free(smcap );488 smcap = NULL;487 free(smcapa); 488 smcapa = NULL; 489 489 490 490 if (pkind != lpk_extended) { … … 545 545 546 546 fdisk_pspec_init(&pspec); 547 pspec.capacity = cap ;547 pspec.capacity = capa; 548 548 pspec.pkind = pkind; 549 549 pspec.fstype = fstype; … … 561 561 return EOK; 562 562 error: 563 free(smcap );563 free(smcapa); 564 564 free(label); 565 565 free(mountp); … … 581 581 fdisk_part_t *part; 582 582 fdisk_part_info_t pinfo; 583 char *scap = NULL;583 char *scapa = NULL; 584 584 char *spkind = NULL; 585 585 char *sfstype = NULL; … … 596 596 } 597 597 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); 601 601 if (rc != EOK) { 602 602 printf("Out of memory.\n"); … … 623 623 624 624 int ret = asprintf(&sdesc, "%s %s, %s, %s", label, 625 scap , spkind, sfstype);625 scapa, spkind, sfstype); 626 626 if (ret < 0) { 627 627 rc = ENOMEM; … … 630 630 631 631 } else { 632 int ret = asprintf(&sdesc, "%s, %s", scap , spkind);632 int ret = asprintf(&sdesc, "%s, %s", scapa, spkind); 633 633 if (ret < 0) { 634 634 rc = ENOMEM; … … 644 644 } 645 645 646 free(scap );647 scap = NULL;646 free(scapa); 647 scapa = NULL; 648 648 free(spkind); 649 649 spkind = NULL; … … 658 658 return EOK; 659 659 error: 660 free(scap );660 free(scapa); 661 661 free(spkind); 662 662 free(sfstype); … … 907 907 fdisk_part_t *part; 908 908 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; 911 911 fdisk_dev_flags_t dflags; 912 912 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; 916 916 char *sfstype = NULL; 917 917 char *svcname = NULL; … … 936 936 } 937 937 938 rc = fdisk_dev_capacity(dev, &cap );938 rc = fdisk_dev_capacity(dev, &capa); 939 939 if (rc != EOK) { 940 940 printf("Error getting device capacity.\n"); … … 942 942 } 943 943 944 cap _simplify(&cap);945 946 rc = cap _format(&cap, &sdcap);944 capa_simplify(&capa); 945 946 rc = capa_format(&capa, &sdcapa); 947 947 if (rc != EOK) { 948 948 printf("Out of memory.\n"); … … 958 958 fdisk_dev_get_flags(dev, &dflags); 959 959 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; 963 963 964 964 rc = fdisk_label_get_info(dev, &linfo); … … 996 996 } 997 997 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); 1001 1001 if (rc != EOK) { 1002 1002 printf("Out of memory.\n"); … … 1016 1016 1017 1017 if (linfo.ltype == lt_none) 1018 printf("Entire disk: %s %s", label, scap );1018 printf("Entire disk: %s %s", label, scapa); 1019 1019 else 1020 printf("Partition %d: %s %s", npart, label, scap );1020 printf("Partition %d: %s %s", npart, label, scapa); 1021 1021 1022 1022 if ((linfo.flags & lf_ext_supp) != 0) { … … 1037 1037 printf("\n"); 1038 1038 1039 free(scap );1040 scap = NULL;1039 free(scapa); 1040 scapa = NULL; 1041 1041 free(sfstype); 1042 1042 sfstype = NULL; … … 1047 1047 /* Display available space */ 1048 1048 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); 1050 1050 if (rc != EOK) { 1051 1051 rc = EIO; … … 1053 1053 } 1054 1054 1055 cap _simplify(&mcap);1056 1057 rc = cap _format(&mcap, &smcap);1055 capa_simplify(&mcapa); 1056 1057 rc = capa_format(&mcapa, &smcapa); 1058 1058 if (rc != EOK) { 1059 1059 rc = ENOMEM; … … 1062 1062 1063 1063 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); 1065 1065 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); 1072 1072 if (rc != EOK) { 1073 1073 rc = EIO; … … 1075 1075 } 1076 1076 1077 cap _simplify(&mcap);1078 1079 rc = cap _format(&mcap, &smcap);1077 capa_simplify(&mcapa); 1078 1079 rc = capa_format(&mcapa, &smcapa); 1080 1080 if (rc != EOK) { 1081 1081 rc = ENOMEM; … … 1084 1084 1085 1085 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); 1087 1087 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; 1092 1092 } 1093 1093 1094 1094 /* Display available space */ 1095 1095 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); 1097 1097 if (rc != EOK) { 1098 1098 rc = EIO; … … 1100 1100 } 1101 1101 1102 cap _simplify(&mcap);1103 1104 rc = cap _format(&mcap, &smcap);1102 capa_simplify(&mcapa); 1103 1104 rc = capa_format(&mcapa, &smcapa); 1105 1105 if (rc != EOK) { 1106 1106 rc = ENOMEM; … … 1108 1108 } 1109 1109 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); 1115 1115 if (rc != EOK) { 1116 1116 rc = EIO; … … 1118 1118 } 1119 1119 1120 cap _simplify(&mcap);1121 1122 rc = cap _format(&mcap, &smcap);1120 capa_simplify(&mcapa); 1121 1122 rc = capa_format(&mcapa, &smcapa); 1123 1123 if (rc != EOK) { 1124 1124 rc = ENOMEM; … … 1126 1126 } 1127 1127 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; 1131 1131 } 1132 1132 … … 1279 1279 return EOK; 1280 1280 error: 1281 free(sdcap );1282 free(scap );1283 free(smcap );1281 free(sdcapa); 1282 free(scapa); 1283 free(smcapa); 1284 1284 free(sfstype); 1285 1285 free(svcname); -
uspace/app/fontviewer/fontviewer.c
rb401b33 re28175d 41 41 #include <window.h> 42 42 #include <canvas.h> 43 #include < surface.h>44 #include < codec/tga.h>43 #include <draw/surface.h> 44 #include <draw/codec.h> 45 45 #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> 49 48 #include <stdarg.h> 50 49 #include <io/verify.h> -
uspace/app/getterm/version.c
rb401b33 re28175d 39 39 #include "version.h" 40 40 41 static const char *copyright = STRING( COPYRIGHT);42 static const char *release = STRING( RELEASE);43 static const char *name = STRING( NAME);41 static const char *copyright = STRING(HELENOS_COPYRIGHT); 42 static const char *release = STRING(HELENOS_RELEASE); 43 static const char *name = STRING(HELENOS_CODENAME); 44 44 static const char *arch = STRING(UARCH); 45 45 -
uspace/app/gunzip/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = pkg 31 32 SOURCES = \ 33 pkg.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 deps = [ 'compress' ] 30 src = files('gunzip.c') -
uspace/app/hbench/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = contacts 31 LIBS = clui sif 32 33 SOURCES = \ 34 contacts.c 35 36 include $(USPACE_PREFIX)/Makefile.common 29 deps = [ 'math' ] 30 src = 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 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = inet 31 32 SOURCES = \ 33 inet.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 src = files('inet.c') -
uspace/app/init/init.c
rb401b33 re28175d 51 51 #include "init.h" 52 52 53 #define BANNER_LEFT "######> " 54 #define BANNER_RIGHT " <######" 55 53 56 #define ROOT_DEVICE "bd/initrd" 54 57 #define ROOT_MOUNT_POINT "/" … … 81 84 { 82 85 printf("%s: HelenOS init\n", NAME); 86 } 87 88 static 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 } 83 99 } 84 100 … … 199 215 200 216 if (rc != EOK) { 217 oom_check(rc, path); 201 218 printf("%s: Error spawning %s (%s)\n", NAME, path, 202 219 str_error(rc)); … … 279 296 errno_t rc = task_spawnl(&id, &wait, app, app, winreg, NULL); 280 297 if (rc != EOK) { 298 oom_check(rc, app); 281 299 printf("%s: Error spawning %s %s (%s)\n", NAME, app, 282 300 winreg, str_error(rc)); 283 return -1;301 return rc; 284 302 } 285 303 … … 290 308 printf("%s: Error retrieving retval from %s (%s)\n", NAME, 291 309 app, str_error(rc)); 292 return -1;310 return rc; 293 311 } 294 312 … … 304 322 errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc, 305 323 LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL); 306 if (rc != EOK) 324 if (rc != EOK) { 325 oom_check(rc, APP_GETTERM); 307 326 printf("%s: Error spawning %s %s %s --msg --wait -- %s\n", 308 327 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 328 } 309 329 } else { 310 330 printf("%s: Spawning %s %s %s --wait -- %s\n", NAME, … … 313 333 errno_t rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc, 314 334 LOCFS_MOUNT_POINT, "--wait", "--", app, NULL); 315 if (rc != EOK) 335 if (rc != EOK) { 336 oom_check(rc, APP_GETTERM); 316 337 printf("%s: Error spawning %s %s %s --wait -- %s\n", 317 338 NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app); 339 } 318 340 } 319 341 } -
uspace/app/init/meson.build
rb401b33 re28175d 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 BINARY = stats 32 33 SOURCES = \ 34 stats.c 35 36 include $(USPACE_PREFIX)/Makefile.common 30 deps = [ 'untar', 'block' ] 31 link_args += '-static' 32 src = files('init.c', 'untar.c') -
uspace/app/killall/meson.build
rb401b33 re28175d 27 27 # 28 28 29 ENDIANESS = LE 29 src = files('killall.c') -
uspace/app/logset/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = logset 31 32 SOURCES = \ 33 main.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 src = files('main.c') -
uspace/app/meson.build
rb401b33 re28175d 1 1 # 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 5 3 # All rights reserved. 6 4 # … … 29 27 # 30 28 31 USPACE_PREFIX = ../../.. 32 LIBS = block fs 33 BINARY = udf 29 apps = [ 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 ] 34 98 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 99 if CONFIG_BUILD_SHARED_LIBS 100 apps += [ 101 'dltest', 102 'dltests', 103 ] 104 endif -
uspace/app/mkext4/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = lprint 31 32 SOURCES = \ 33 lprint.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 # FIXME remove transitive deps 30 deps = [ 'ext4', 'fs', 'block', 'crypto' ] 31 src = files('mkext4.c') -
uspace/app/modplay/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../../.. 30 LIBS = drv pcm 31 BINARY = hdaudio 29 deps = [ 'trackmod', 'hound', 'pcm' ] 30 src = files('modplay.c') 32 31 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 32 if install_nonessential_data 33 # TODO: install this file somewhere sane 34 installed_data += { 'name': 'demo.xm', 'dir': '/' } 35 endif -
uspace/app/pci/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = pci 31 32 SOURCES = \ 33 pci.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 src = files('pci.c') -
uspace/app/pkg/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = vol 31 32 SOURCES = \ 33 vol.c 34 35 include $(USPACE_PREFIX)/Makefile.common 29 src = files('pkg.c') -
uspace/app/redir/meson.build
rb401b33 re28175d 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 3 4 # All rights reserved. 4 5 # … … 27 28 # 28 29 29 ENDIANESS = LE 30 31 BFD_NAME = elf64-littleriscv 32 BFD_ARCH = riscv 30 src = files('redir.c') -
uspace/app/sbi/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 LIBS = 31 EXTRA_CFLAGS = 32 BINARY = kill 33 34 SOURCES = \ 35 kill.c 36 37 include $(USPACE_PREFIX)/Makefile.common 29 deps = [ 'clui' ] 30 c_args += '-D__HELENOS__' 31 src = 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 52 52 #define MINUTE 60 53 53 54 #define KERNEL_NAME "kernel" 55 #define INIT_PREFIX "init:" 56 57 typedef 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 54 67 static void list_tasks(void) 55 68 { … … 65 78 " [kcycles] [name\n"); 66 79 67 size_t i; 68 for (i = 0; i < count; i++) { 80 for (size_t i = 0; i < count; i++) { 69 81 uint64_t resmem; 70 82 uint64_t virtmem; … … 103 115 printf("[taskid] [threadid] [state ] [prio] [cpu ] [ucycles] [kcycles]\n"); 104 116 105 size_t i; 106 for (i = 0; i < count; i++) { 117 for (size_t i = 0; i < count; i++) { 107 118 if ((all) || (stats_threads[i].task_id == task_id)) { 108 119 uint64_t ucycles, kcycles; … … 130 141 } 131 142 143 static 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 132 165 static void list_cpus(void) 133 166 { … … 142 175 printf("[id] [MHz ] [busy cycles] [idle cycles]\n"); 143 176 144 size_t i; 145 for (i = 0; i < count; i++) { 177 for (size_t i = 0; i < count; i++) { 146 178 printf("%-4u ", cpus[i].id); 147 179 if (cpus[i].active) { … … 174 206 printf("%s: Load average: ", NAME); 175 207 176 size_t i; 177 for (i = 0; i < count; i++) { 208 for (size_t i = 0; i < count; i++) { 178 209 if (i > 0) 179 210 printf(" "); … … 197 228 } 198 229 230 static 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 260 static 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 199 367 static void usage(const char *name) 200 368 { 201 369 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" 203 371 "\n" 204 372 "Options:\n" 205 "\t-t task_id\n" 206 "\t--task=task_id\n" 373 "\t-t task_id | --task=task_id\n" 207 374 "\t\tList threads of the given task\n" 208 375 "\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" 211 380 "\t\tList all threads\n" 212 381 "\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" 215 386 "\t\tList CPUs\n" 216 387 "\n" 217 "\t-l\n" 218 "\t--load\n" 388 "\t-l | --load\n" 219 389 "\t\tPrint system load\n" 220 390 "\n" 221 "\t-u\n" 222 "\t--uptime\n" 391 "\t-u | --uptime\n" 223 392 "\t\tPrint system uptime\n" 224 393 "\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" 227 398 "\t\tPrint this usage information\n" 228 399 "\n" … … 233 404 int main(int argc, char *argv[]) 234 405 { 235 bool toggle_tasks = true; 236 bool toggle_threads = false; 406 output_toggle_t output_toggle = LIST_TASKS; 237 407 bool toggle_all = false; 238 bool toggle_cpus = false;239 bool toggle_load = false;240 bool toggle_uptime = false;241 242 408 task_id_t task_id = 0; 243 409 244 int i; 245 for (i = 1; i < argc; i++) { 410 for (int i = 1; i < argc; i++) { 246 411 int off; 247 412 … … 252 417 } 253 418 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 254 426 /* 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; 258 429 toggle_all = true; 259 430 continue; 260 431 } 261 432 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 */ 270 450 if ((off = arg_parse_short_long(argv[i], "-t", "--task=")) != -1) { 271 451 // TODO: Support for 64b range … … 273 453 errno_t ret = arg_parse_int(argc, argv, &i, &tmp, off); 274 454 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]); 276 456 return -1; 277 457 } … … 279 459 task_id = tmp; 280 460 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; 283 468 continue; 284 469 } … … 286 471 /* Load */ 287 472 if ((off = arg_parse_short_long(argv[i], "-l", "--load")) != -1) { 288 toggle_tasks = false; 289 toggle_load = true; 473 output_toggle = PRINT_LOAD; 290 474 continue; 291 475 } … … 293 477 /* Uptime */ 294 478 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: 302 492 list_tasks(); 303 304 if (toggle_threads)493 break; 494 case LIST_THREADS: 305 495 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: 308 501 list_cpus(); 309 310 if (toggle_load)502 break; 503 case PRINT_LOAD: 311 504 print_load(); 312 313 if (toggle_uptime)505 break; 506 case PRINT_UPTIME: 314 507 print_uptime(); 508 break; 509 case PRINT_ARCH: 510 print_arch(); 511 break; 512 } 315 513 316 514 return 0; -
uspace/app/sysinst/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 BINARY = nic 31 LIBS = drv 32 33 SOURCES = \ 34 nic.c 35 36 include $(USPACE_PREFIX)/Makefile.common 29 deps = [ 'block', 'fdisk', 'sif' ] 30 src = files( 31 'futil.c', 32 'rdimg.c', 33 'sysinst.c', 34 'volume.c', 35 ) -
uspace/app/sysinst/sysinst.c
rb401b33 re28175d 38 38 #include <block.h> 39 39 #include <byteorder.h> 40 #include <cap .h>40 #include <capa.h> 41 41 #include <errno.h> 42 42 #include <fdisk.h> … … 98 98 fdisk_part_spec_t pspec; 99 99 fdisk_part_info_t pinfo; 100 cap _spec_t cap;100 capa_spec_t capa; 101 101 service_id_t sid; 102 102 errno_t rc; … … 137 137 printf("sysinst_label_dev(): create partition\n"); 138 138 139 rc = fdisk_part_get_max_avail(fdev, spc_pri, &cap );139 rc = fdisk_part_get_max_avail(fdev, spc_pri, &capa); 140 140 if (rc != EOK) { 141 141 printf("Error getting available capacity: %s.\n", str_error(rc)); … … 144 144 145 145 fdisk_pspec_init(&pspec); 146 pspec.capacity = cap ;146 pspec.capacity = capa; 147 147 pspec.pkind = lpk_primary; 148 148 pspec.fstype = fs_ext4; /* Cannot be changed without modifying core.img */ -
uspace/app/taskdump/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../../.. 30 31 BINARY = s3c24xx_ts 32 33 SOURCES = \ 34 s3c24xx_ts.c 35 36 include $(USPACE_PREFIX)/Makefile.common 29 includes += include_directories('include') 30 src = files( 31 'elf_core.c', 32 'fibrildump.c', 33 'taskdump.c', 34 'symtab.c', 35 ) -
uspace/app/taskdump/taskdump.c
rb401b33 re28175d 126 126 static errno_t connect_task(task_id_t task_id) 127 127 { 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); 129 130 130 131 if (!ksess) { 131 if ( errno== ENOTSUP) {132 if (rc == ENOTSUP) { 132 133 printf("You do not have userspace debugging support " 133 134 "compiled in the kernel.\n"); 134 135 printf("Compile kernel with 'Support for userspace debuggers' " 135 136 "(CONFIG_UDEBUG) enabled.\n"); 136 return errno;137 return rc; 137 138 } 138 139 139 140 printf("Error connecting\n"); 140 141 printf("async_connect_kbox(%" PRIu64 ") -> %s", task_id, str_error_name(errno)); 141 return errno;142 } 143 144 errno_trc = udebug_begin(ksess);142 return rc; 143 } 144 145 rc = udebug_begin(ksess); 145 146 if (rc != EOK) { 146 147 printf("udebug_begin() -> %s\n", str_error_name(rc)); -
uspace/app/tester/mm/pager1.c
rb401b33 re28175d 65 65 TPRINTF("Connecting to VFS pager...\n"); 66 66 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); 68 69 69 70 if (!vfs_pager_sess) { -
uspace/app/tetris/meson.build
rb401b33 re28175d 28 28 # 29 29 30 USPACE_PREFIX = ../.. 31 LIBRARY = libfs 32 33 SOURCES = \ 34 libfs.c 35 36 include $(USPACE_PREFIX)/Makefile.common 30 src = files( 31 'shapes.c', 32 'scores.c', 33 'tetris.c', 34 'screen.c', 35 ) -
uspace/app/trace/syscalls.c
rb401b33 re28175d 38 38 39 39 const sc_desc_t syscall_desc[] = { 40 /* System management syscalls. */ 40 41 [SYS_KIO] = { "kio", 3, V_INT_ERRNO }, 41 42 43 /* Thread and task related syscalls. */ 42 44 [SYS_THREAD_CREATE] = { "thread_create", 3, V_ERRNO }, 43 45 [SYS_THREAD_EXIT] = { "thread_exit", 1, V_ERRNO }, 44 46 [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 }, 45 49 46 50 [SYS_TASK_GET_ID] = { "task_get_id", 1, V_ERRNO }, 47 51 [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 }, 48 55 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. */ 49 64 [SYS_AS_AREA_CREATE] = { "as_area_create", 5, V_ERRNO }, 50 65 [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 }, 51 68 [SYS_AS_AREA_DESTROY] = { "as_area_destroy", 1, V_ERRNO }, 52 69 70 /* Page mapping related syscalls. */ 71 [SYS_PAGE_FIND_MAPPING] = { "page_find_mapping", 2, V_ERRNO }, 72 73 /* IPC related syscalls. */ 53 74 [SYS_IPC_CALL_ASYNC_FAST] = { "ipc_call_async_fast", 6, V_HASH }, 54 75 [SYS_IPC_CALL_ASYNC_SLOW] = { "ipc_call_async_slow", 3, V_HASH }, 55 56 76 [SYS_IPC_ANSWER_FAST] = { "ipc_answer_fast", 6, V_ERRNO }, 57 77 [SYS_IPC_ANSWER_SLOW] = { "ipc_answer_slow", 2, V_ERRNO }, … … 61 81 [SYS_IPC_POKE] = { "ipc_poke", 0, V_ERRNO }, 62 82 [SYS_IPC_HANGUP] = { "ipc_hangup", 1, V_ERRNO }, 83 [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 2, V_ERRNO }, 63 84 85 /* Event notification syscalls. */ 64 86 [SYS_IPC_EVENT_SUBSCRIBE] = { "ipc_event_subscribe", 2, V_ERRNO }, 65 87 [SYS_IPC_EVENT_UNSUBSCRIBE] = { "ipc_event_unsubscribe", 1, V_ERRNO }, 66 88 [SYS_IPC_EVENT_UNMASK] = { "ipc_event_unmask", 1, V_ERRNO }, 67 89 90 /* Permission related syscalls. */ 68 91 [SYS_PERM_GRANT] = { "perm_grant", 2, V_ERRNO }, 69 92 [SYS_PERM_REVOKE] = { "perm_revoke", 2, V_ERRNO }, 93 94 /* DDI related syscalls. */ 70 95 [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 }, 71 99 [SYS_IOSPACE_ENABLE] = { "iospace_enable", 1, V_ERRNO }, 100 [SYS_IOSPACE_DISABLE] = { "iospace_disable", 1, V_ERRNO }, 72 101 73 102 [SYS_IPC_IRQ_SUBSCRIBE] = { "ipc_irq_subscribe", 4, V_ERRNO }, 74 103 [SYS_IPC_IRQ_UNSUBSCRIBE] = { "ipc_irq_unsubscribe", 2, V_ERRNO }, 75 104 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 }, 76 108 [SYS_SYSINFO_GET_VAL_TYPE] = { "sysinfo_get_val_type", 2, V_INTEGER }, 77 109 [SYS_SYSINFO_GET_VALUE] = { "sysinfo_get_value", 3, V_ERRNO }, … … 79 111 [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data", 5, V_ERRNO }, 80 112 113 /* Kernel console syscalls. */ 81 114 [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 } 83 117 }; 84 118 -
uspace/app/trace/trace.c
rb401b33 re28175d 47 47 #include <mem.h> 48 48 #include <str.h> 49 #include <loader/loader.h>50 49 #include <io/console.h> 51 50 #include <io/keycode.h> … … 86 85 void thread_trace_start(uintptr_t thread_hash); 87 86 87 static char *cmd_path; 88 static char **cmd_args; 89 88 90 static task_id_t task_id; 89 static loader_t *task_ldr;91 static task_wait_t task_w; 90 92 static bool task_wait_for; 91 93 … … 93 95 display_mask_t display_mask; 94 96 95 static errno_t program_run_fibril(void *arg);96 97 static 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 }110 98 111 99 static void cev_fibril_start(void) … … 122 110 } 123 111 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); 112 static 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 133 126 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; 142 132 } 143 133 144 134 static errno_t connect_task(task_id_t task_id) 145 135 { 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); 169 166 if (rc != EOK) { 170 167 printf("udebug_set_evmask(0x%x) -> %s\n ", UDEBUG_EM_ALL, str_error_name(rc)); … … 172 169 } 173 170 174 sess = ksess; 175 return 0; 171 return EOK; 172 error: 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; 176 180 } 177 181 … … 198 202 printf("\ntotal of %zu threads\n", tb_needed / sizeof(uintptr_t)); 199 203 200 return 0;204 return EOK; 201 205 } 202 206 … … 488 492 489 493 printf("Finished tracing thread [%d].\n", thread_id); 490 return 0;494 return EOK; 491 495 } 492 496 … … 502 506 } 503 507 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;576 508 } 577 509 … … 807 739 ++argv; 808 740 task_id = strtol(*argv, &err_p, 10); 809 task_ldr = NULL;810 741 task_wait_for = false; 811 742 if (*err_p) { … … 848 779 printf("'%s'\n", *cp++); 849 780 850 task_ldr = preload_task(*argv, argv, &task_id); 781 cmd_path = *argv; 782 cmd_args = argv; 851 783 task_wait_for = true; 852 784 … … 869 801 870 802 main_init(); 803 804 if (cmd_path != NULL) 805 program_run(); 871 806 872 807 rc = connect_task(task_id); … … 878 813 printf("Connected to task %" PRIu64 ".\n", task_id); 879 814 880 if (task_ldr != NULL)881 program_run();882 883 815 cev_fibril_start(); 884 816 trace_task(task_id); … … 887 819 printf("Waiting for task to exit.\n"); 888 820 889 rc = task_wait _task_id(task_id, &texit, &retval);821 rc = task_wait(&task_w, &texit, &retval); 890 822 if (rc != EOK) { 891 823 printf("Failed waiting for task.\n"); -
uspace/app/usbinfo/main.c
rb401b33 re28175d 69 69 _OPTION("-S --status", "Get status of the device."); 70 70 _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."); 72 72 73 73 printf("\n"); -
uspace/app/usbinfo/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../../.. 30 LIBS = drv 31 BINARY = test1 32 33 SOURCES = \ 34 test1.c 35 36 include $(USPACE_PREFIX)/Makefile.common 29 deps = [ 'usbhid', 'usbdev', 'usb', 'drv' ] 30 src = 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 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 deps = [ 'gui' ] 30 src = files('viewer.c') 30 31 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 32 if install_nonessential_data 33 # TODO: install this file somewhere sane 34 installed_data += { 'name': 'logo.tga', 'dir': '/' } 35 endif -
uspace/app/viewer/viewer.c
rb401b33 re28175d 41 41 #include <window.h> 42 42 #include <canvas.h> 43 #include < surface.h>44 #include < codec/tga.h>43 #include <draw/surface.h> 44 #include <draw/codec.h> 45 45 #include <task.h> 46 46 #include <str.h> -
uspace/app/vlaunch/meson.build
rb401b33 re28175d 27 27 # 28 28 29 USPACE_PREFIX = ../.. 29 deps = [ 'gui' ] 30 30 31 # TODO: Should be just "gui", rest is transitive dependencies. 32 LIBS = gui draw softrend compress math 31 _images = files('gfx/helenos.tga') 33 32 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 ) 35 56 36 SOURCES = \ 37 vcalc.c 38 39 include $(USPACE_PREFIX)/Makefile.common 57 src = [ files('vlaunch.c'), _imgs_s, _imgs_h, _imgs_desc_c ] -
uspace/app/vlaunch/vlaunch.c
rb401b33 re28175d 46 46 #include <canvas.h> 47 47 48 #include < surface.h>49 #include < source.h>50 #include <draw ctx.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> 52 52 53 53 #include "images.h" -
uspace/app/vuhid/meson.build
rb401b33 re28175d 27 27 # 28 28 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 29 deps = [ 'usb', 'usbdev', 'usbhid', 'usbvirt', 'drv' ] 30 src = 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 27 27 # 28 28 29 USPACE_PREFIX = ../.. 30 EXTRA_CFLAGS = -Iinclude/hound 31 LIBRARY = libhound 32 LIBS = pcm 29 deps = [ 'drv', 'hound', 'pcm' ] 30 src = files( 31 'dplay.c', 32 'drec.c', 33 'main.c', 34 'wave.c', 35 ) 33 36 34 SOURCES = \ 35 src/protocol.c \ 36 src/client.c 37 include $(USPACE_PREFIX)/Makefile.common 38 37 if install_nonessential_data 38 # TODO: install this file somewhere sane 39 installed_data += { 'name': 'demo.wav', 'dir': '/' } 40 endif
Note:
See TracChangeset
for help on using the changeset viewer.
