Changeset c6588ce in mainline for uspace/app
- Timestamp:
- 2012-05-05T08:12:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ee04c28
- Parents:
- 2cc7f16 (diff), d21e935c (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. - Location:
- uspace/app
- Files:
-
- 6 added
- 2 deleted
- 30 edited
- 3 moved
-
bdsh/cmds/modules/cat/cat.c (modified) (10 diffs)
-
bdsh/cmds/modules/cat/cat.h (modified) (1 diff)
-
bdsh/cmds/modules/ls/ls.c (modified) (15 diffs)
-
bdsh/cmds/modules/ls/ls.h (added)
-
bdsh/cmds/modules/touch/entry.h (modified) (1 diff)
-
bdsh/cmds/modules/touch/touch.c (modified) (5 diffs)
-
bdsh/cmds/modules/touch/touch.h (modified) (1 diff)
-
bdsh/cmds/modules/touch/touch_def.h (modified) (1 diff)
-
binutils/Makefile (modified) (1 diff)
-
getterm/Makefile (modified) (1 diff)
-
getterm/version.c (modified) (2 diffs)
-
inetcfg/Makefile (moved) (moved from uspace/srv/net/il/ip/Makefile ) (2 diffs)
-
inetcfg/inetcfg.c (added)
-
init/init.c (modified) (2 diffs)
-
mkexfat/Makefile (moved) (moved from uspace/srv/net/il/arp/Makefile ) (2 diffs)
-
mkexfat/exfat.h (added)
-
mkexfat/mkexfat.c (added)
-
mkexfat/upcase.h (added)
-
netecho/netecho.c (modified) (1 diff)
-
netecho/print_error.c (modified) (2 diffs)
-
ping/Makefile (modified) (2 diffs)
-
ping/ping.c (modified) (2 diffs)
-
ping/print_error.c (deleted)
-
ping/print_error.h (deleted)
-
sbi/src/run_texpr.c (modified) (3 diffs)
-
sportdmp/sportdmp.c (modified) (5 diffs)
-
sysinfo/sysinfo.c (modified) (4 diffs)
-
tester/Makefile (modified) (1 diff)
-
tester/fault/fault2.c (modified) (1 diff)
-
tester/hw/serial/serial1.c (modified) (5 diffs)
-
tester/ipc/starve.c (moved) (moved from uspace/lib/c/generic/net/icmp_common.c ) (2 diffs)
-
tester/ipc/starve.def (added)
-
tester/print/print1.c (modified) (2 diffs)
-
tester/tester.c (modified) (1 diff)
-
tester/tester.h (modified) (1 diff)
-
top/screen.c (modified) (15 diffs)
-
top/screen.h (modified) (1 diff)
-
top/top.c (modified) (7 diffs)
-
top/top.h (modified) (4 diffs)
-
trace/ipc_desc.c (modified) (1 diff)
-
websrv/websrv.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r2cc7f16 rc6588ce 52 52 #define CAT_VERSION "0.0.1" 53 53 #define CAT_DEFAULT_BUFLEN 1024 54 55 static const char *cat_oops = "That option is not yet supported\n"; 54 #define CAT_FULL_FILE 0 55 56 56 static const char *hexchars = "0123456789abcdef"; 57 57 … … 163 163 } 164 164 165 static unsigned int cat_file(const char *fname, size_t blen, bool hex) 165 static unsigned int cat_file(const char *fname, size_t blen, bool hex, 166 off64_t head, off64_t tail, bool tail_first) 166 167 { 167 168 int fd, bytes = 0, count = 0, reads = 0; 168 169 char *buff = NULL; 169 170 int i; 170 size_t offset = 0; 171 size_t offset = 0, copied_bytes = 0; 172 off64_t file_size = 0, length = 0; 171 173 172 174 fd = open(fname, O_RDONLY); … … 183 185 } 184 186 187 if (tail != CAT_FULL_FILE) { 188 file_size = lseek(fd, 0, SEEK_END); 189 if (head == CAT_FULL_FILE) { 190 head = file_size; 191 length = tail; 192 } else if (tail_first) { 193 length = head; 194 } else { 195 if (tail > head) 196 tail = head; 197 length = tail; 198 } 199 200 if (tail_first) { 201 lseek(fd, (tail >= file_size) ? 0 : (file_size - tail), SEEK_SET); 202 } else { 203 lseek(fd, ((head - tail) >= file_size) ? 0 : (head - tail), SEEK_SET); 204 } 205 } else 206 length = head; 207 185 208 do { 186 bytes = read(fd, buff, blen); 209 bytes = read(fd, buff + copied_bytes, ( 210 (length != CAT_FULL_FILE && length - (off64_t)count <= (off64_t)(blen - copied_bytes)) ? 211 (size_t)(length - count) : 212 (blen - copied_bytes) ) ); 213 bytes += copied_bytes; 214 copied_bytes = 0; 215 187 216 if (bytes > 0) { 188 count += bytes;189 217 buff[bytes] = '\0'; 190 218 offset = 0; … … 193 221 paged_char(hexchars[((uint8_t)buff[i])/16]); 194 222 paged_char(hexchars[((uint8_t)buff[i])%16]); 223 paged_char(((count+i+1) & 0xf) == 0 ? '\n' : ' '); 195 224 } 196 225 else { … … 199 228 /* Reached end of string */ 200 229 break; 230 } else if (c == U_SPECIAL && offset + 2 >= (size_t)bytes) { 231 /* If an extended character is cut off due to the size of the buffer, 232 we will copy it over to the next buffer so it can be read correctly. */ 233 copied_bytes = bytes - offset + 1; 234 memcpy(buff, buff + offset - 1, copied_bytes); 235 break; 201 236 } 202 237 paged_char(c); … … 204 239 205 240 } 241 count += bytes; 206 242 reads++; 207 243 } 208 } while (bytes > 0 && !should_quit );244 } while (bytes > 0 && !should_quit && (count < length || length == CAT_FULL_FILE)); 209 245 210 246 close(fd); … … 223 259 int cmd_cat(char **argv) 224 260 { 225 unsigned int argc, i, ret = 0, buffer = 0; 261 unsigned int argc, i, ret = 0; 262 size_t buffer = 0; 226 263 int c, opt_ind; 264 aoff64_t head = CAT_FULL_FILE, tail = CAT_FULL_FILE; 227 265 bool hex = false; 228 266 bool more = false; 267 bool tailFirst = false; 229 268 sysarg_t rows, cols; 230 269 int rc; … … 254 293 return CMD_SUCCESS; 255 294 case 'H': 256 printf("%s", cat_oops); 257 return CMD_FAILURE; 295 if (!optarg || str_uint64_t(optarg, NULL, 10, false, &head) != EOK ) { 296 puts("Invalid head size\n"); 297 return CMD_FAILURE; 298 } 299 break; 258 300 case 't': 259 printf("%s", cat_oops); 260 return CMD_FAILURE; 301 if (!optarg || str_uint64_t(optarg, NULL, 10, false, &tail) != EOK ) { 302 puts("Invalid tail size\n"); 303 return CMD_FAILURE; 304 } 305 if (head == CAT_FULL_FILE) 306 tailFirst = true; 307 break; 261 308 case 'b': 262 printf("%s", cat_oops); 309 if (!optarg || str_size_t(optarg, NULL, 10, false, &buffer) != EOK ) { 310 puts("Invalid buffer size\n"); 311 return CMD_FAILURE; 312 } 263 313 break; 264 314 case 'm': … … 279 329 } 280 330 281 if (buffer < = 0)331 if (buffer < 4) 282 332 buffer = CAT_DEFAULT_BUFLEN; 283 333 … … 295 345 296 346 for (i = optind; argv[i] != NULL && !should_quit; i++) 297 ret += cat_file(argv[i], buffer, hex );347 ret += cat_file(argv[i], buffer, hex, head, tail, tailFirst); 298 348 299 349 if (ret) -
uspace/app/bdsh/cmds/modules/cat/cat.h
r2cc7f16 rc6588ce 4 4 /* Prototypes for the cat command, excluding entry points */ 5 5 6 static unsigned int cat_file(const char *, size_t, bool );6 static unsigned int cat_file(const char *, size_t, bool, off64_t, off64_t, bool); 7 7 8 8 #endif /* CAT_H */ -
uspace/app/bdsh/cmds/modules/ls/ls.c
r2cc7f16 rc6588ce 42 42 #include <sort.h> 43 43 44 #include "ls.h" 44 45 #include "errors.h" 45 46 #include "config.h" … … 48 49 #include "cmds.h" 49 50 50 /* Various values that can be returned by ls_scope() */51 #define LS_BOGUS 052 #define LS_FILE 153 #define LS_DIR 254 55 /** Structure to represent a directory entry.56 *57 * Useful to keep together important information58 * for sorting directory entries.59 */60 struct dir_elem_t {61 char *name;62 struct stat s;63 };64 65 51 static const char *cmdname = "ls"; 52 53 static ls_job_t ls; 66 54 67 55 static struct option const long_options[] = { 68 56 { "help", no_argument, 0, 'h' }, 69 57 { "unsort", no_argument, 0, 'u' }, 58 { "recursive", no_argument, 0, 'r' }, 70 59 { 0, 0, 0, 0 } 71 60 }; 61 62 /* Prototypes for the ls command, excluding entry points. */ 63 static unsigned int ls_start(ls_job_t *); 64 static void ls_print(struct dir_elem_t *); 65 static int ls_cmp(void *, void *, void *); 66 static signed int ls_scan_dir(const char *, DIR *, struct dir_elem_t **); 67 static unsigned int ls_recursive(const char *, DIR *); 68 static unsigned int ls_scope(const char *, struct dir_elem_t *); 69 70 static unsigned int ls_start(ls_job_t *ls) 71 { 72 ls->recursive = 0; 73 ls->sort = 1; 74 75 return 1; 76 } 72 77 73 78 /** Print an entry. … … 92 97 } 93 98 94 95 99 /** Compare 2 directory elements. 96 100 * … … 127 131 * 0 otherwise. 128 132 */ 129 static void ls_scan_dir(const char *d, DIR *dirp, int sort) 133 static signed int ls_scan_dir(const char *d, DIR *dirp, 134 struct dir_elem_t **dir_list_ptr) 130 135 { 131 136 int alloc_blocks = 20; … … 140 145 141 146 if (!dirp) 142 return ;147 return -1; 143 148 144 149 buff = (char *) malloc(PATH_MAX); 145 150 if (!buff) { 146 151 cli_error(CL_ENOMEM, "ls: failed to scan %s", d); 147 return ;152 return -1; 148 153 } 149 154 … … 152 157 cli_error(CL_ENOMEM, "ls: failed to scan %s", d); 153 158 free(buff); 154 return ;159 return -1; 155 160 } 156 161 … … 187 192 } 188 193 189 if ( sort) {194 if (ls.sort) { 190 195 if (!qsort(&tosort[0], nbdirs, sizeof(struct dir_elem_t), 191 196 ls_cmp, NULL)) { … … 196 201 for (i = 0; i < nbdirs; i++) 197 202 ls_print(&tosort[i]); 203 204 /* Populate the directory list. */ 205 if (ls.recursive) { 206 tmp = (struct dir_elem_t *) realloc(*dir_list_ptr, 207 nbdirs * sizeof(struct dir_elem_t)); 208 if (!tmp) { 209 cli_error(CL_ENOMEM, "ls: failed to scan %s", d); 210 goto out; 211 } 212 *dir_list_ptr = tmp; 213 214 for (i = 0; i < nbdirs; i++) { 215 (*dir_list_ptr)[i].name = str_dup(tosort[i].name); 216 if (!(*dir_list_ptr)[i].name) { 217 cli_error(CL_ENOMEM, "ls: failed to scan %s", d); 218 goto out; 219 } 220 } 221 } 198 222 199 223 out: … … 202 226 free(tosort); 203 227 free(buff); 228 229 return nbdirs; 230 } 231 232 /** Visit a directory recursively. 233 * 234 * ls_recursive visits all the subdirectories recursively and 235 * prints the files and directories in them. 236 * 237 * @param path Path the current directory being visited. 238 * @param dirp Directory stream. 239 */ 240 static unsigned int ls_recursive(const char *path, DIR *dirp) 241 { 242 int i, nbdirs, ret; 243 unsigned int scope; 244 char *subdir_path; 245 DIR *subdirp; 246 struct dir_elem_t *dir_list; 247 248 const char * const trailing_slash = "/"; 249 250 nbdirs = 0; 251 dir_list = (struct dir_elem_t *) malloc(sizeof(struct dir_elem_t)); 252 253 printf("\n%s:\n", path); 254 255 subdir_path = (char *) malloc(PATH_MAX); 256 if (!subdir_path) { 257 ret = CMD_FAILURE; 258 goto out; 259 } 260 261 nbdirs = ls_scan_dir(path, dirp, &dir_list); 262 if (nbdirs == -1) { 263 ret = CMD_FAILURE; 264 goto out; 265 } 266 267 for (i = 0; i < nbdirs; ++i) { 268 memset(subdir_path, 0, PATH_MAX); 269 270 if (str_size(subdir_path) + str_size(path) + 1 <= PATH_MAX) 271 str_append(subdir_path, PATH_MAX, path); 272 if (path[str_size(path)-1] != '/' && 273 str_size(subdir_path) + str_size(trailing_slash) + 1 <= PATH_MAX) 274 str_append(subdir_path, PATH_MAX, trailing_slash); 275 if (str_size(subdir_path) + 276 str_size(dir_list[i].name) + 1 <= PATH_MAX) 277 str_append(subdir_path, PATH_MAX, dir_list[i].name); 278 279 scope = ls_scope(subdir_path, &dir_list[i]); 280 switch (scope) { 281 case LS_FILE: 282 break; 283 case LS_DIR: 284 subdirp = opendir(subdir_path); 285 if (!subdirp) { 286 /* May have been deleted between scoping it and opening it */ 287 cli_error(CL_EFAIL, "Could not stat %s", dir_list[i].name); 288 ret = CMD_FAILURE; 289 goto out; 290 } 291 292 ret = ls_recursive(subdir_path, subdirp); 293 closedir(subdirp); 294 if (ret == CMD_FAILURE) 295 goto out; 296 break; 297 case LS_BOGUS: 298 ret = CMD_FAILURE; 299 goto out; 300 } 301 } 302 303 ret = CMD_SUCCESS; 304 305 out: 306 for (i = 0; i < nbdirs; i++) 307 free(dir_list[i].name); 308 free(dir_list); 309 free(subdir_path); 310 311 return ret; 312 } 313 314 static unsigned int ls_scope(const char *path, struct dir_elem_t *de) 315 { 316 if (stat(path, &de->s)) { 317 cli_error(CL_ENOENT, path); 318 return LS_BOGUS; 319 } 320 321 if (de->s.is_file) 322 return LS_FILE; 323 else if (de->s.is_directory) 324 return LS_DIR; 325 326 return LS_BOGUS; 204 327 } 205 328 … … 215 338 "Options:\n" 216 339 " -h, --help A short option summary\n" 217 " -u, --unsort Do not sort directory entries\n", 340 " -u, --unsort Do not sort directory entries\n" 341 " -r, --recursive List subdirectories recursively\n", 218 342 cmdname); 219 343 } … … 228 352 DIR *dirp; 229 353 int c, opt_ind; 230 int sort = 1; 354 int ret = 0; 355 unsigned int scope; 356 357 if (!ls_start(&ls)) { 358 cli_error(CL_EFAIL, "%s: Could not initialize", cmdname); 359 return CMD_FAILURE; 360 } 231 361 232 362 argc = cli_count_args(argv); 233 363 234 364 for (c = 0, optind = 0, opt_ind = 0; c != -1;) { 235 c = getopt_long(argc, argv, "hu ", long_options, &opt_ind);365 c = getopt_long(argc, argv, "hur", long_options, &opt_ind); 236 366 switch (c) { 237 367 case 'h': … … 239 369 return CMD_SUCCESS; 240 370 case 'u': 241 sort = 0; 371 ls.sort = 0; 372 break; 373 case 'r': 374 ls.recursive = 1; 242 375 break; 243 376 } … … 251 384 return CMD_FAILURE; 252 385 } 253 memset(de.name, 0, sizeof(PATH_MAX));386 memset(de.name, 0, PATH_MAX); 254 387 255 388 if (argc == 0) … … 257 390 else 258 391 str_cpy(de.name, PATH_MAX, argv[optind]); 259 260 if (stat(de.name, &de.s)) { 261 cli_error(CL_ENOENT, de.name); 262 free(de.name); 263 return CMD_FAILURE; 264 } 265 266 if (de.s.is_file) { 392 393 scope = ls_scope(de.name, &de); 394 switch (scope) { 395 case LS_FILE: 267 396 ls_print(&de); 268 } else { 397 break; 398 case LS_DIR: 269 399 dirp = opendir(de.name); 270 400 if (!dirp) { … … 274 404 return CMD_FAILURE; 275 405 } 276 ls_scan_dir(de.name, dirp, sort); 406 if (ls.recursive) 407 ret = ls_recursive(de.name, dirp); 408 else 409 ret = ls_scan_dir(de.name, dirp, NULL); 410 277 411 closedir(dirp); 412 break; 413 case LS_BOGUS: 414 return CMD_FAILURE; 278 415 } 279 416 280 417 free(de.name); 281 418 282 return CMD_SUCCESS; 283 } 284 419 if (ret == -1 || ret == CMD_FAILURE) 420 return CMD_FAILURE; 421 else 422 return CMD_SUCCESS; 423 } 424 -
uspace/app/bdsh/cmds/modules/touch/entry.h
r2cc7f16 rc6588ce 7 7 8 8 #endif /* TOUCH_ENTRY_H */ 9 -
uspace/app/bdsh/cmds/modules/touch/touch.c
r2cc7f16 rc6588ce 27 27 */ 28 28 29 /* TODO: Options that people would expect, such as not creating the file if 30 * it doesn't exist, specifying the access time, etc */ 29 /* 30 * TODO: Options that people would expect, such as specifying the access time, 31 * etc. 32 */ 31 33 32 34 #include <stdio.h> … … 37 39 #include <sys/types.h> 38 40 #include <str.h> 41 #include <getopt.h> 42 #include <sys/stat.h> 43 #include <errno.h> 39 44 40 45 #include "config.h" … … 47 52 static const char *cmdname = "touch"; 48 53 54 static struct option const long_options[] = { 55 { "no-create", no_argument, 0, 'c' }, 56 { 0, 0, 0, 0 } 57 }; 58 49 59 /* Dispays help for touch in various levels */ 50 60 void help_cmd_touch(unsigned int level) 51 61 { 52 62 if (level == HELP_SHORT) { 53 printf("`%s' updates access times forfiles\n", cmdname);63 printf("`%s' updates access times of files\n", cmdname); 54 64 } else { 55 65 help_cmd_touch(HELP_SHORT); 56 printf(" `%s' <file>, if the file does not exist it will be " 57 "created\n", cmdname); 66 printf("Usage: `%s' [-c|--no-create] <file>...\n\n" 67 "If the file does not exist it will be created empty,\n" 68 "unless -c (--no-create) is supplied.\n\n" 69 "Options:\n" 70 " -c, --no-create Do not create new files\n", 71 cmdname); 58 72 } 59 73 60 74 return; 61 75 } … … 64 78 int cmd_touch(char **argv) 65 79 { 66 unsigned int argc, i = 0, ret = 0; 67 int fd; 80 unsigned int argc = cli_count_args(argv); 81 unsigned int i = 0; 82 unsigned int ret = 0; 83 int c; 84 int longind; 85 bool no_create = false; 86 struct stat file_stat; 87 int fd = -1; 68 88 char *buff = NULL; 69 89 70 90 DIR *dirp; 71 72 argc = cli_count_args(argv); 73 74 if (argc == 1) { 75 printf("%s - incorrect number of arguments. Try `help %s extended'\n", 76 cmdname, cmdname); 91 92 for (c = 0, optind = 0, longind = 0; c != -1; ) { 93 c = getopt_long(argc, argv, "c", long_options, &longind); 94 switch (c) { 95 case 'c': 96 no_create = true; 97 break; 98 } 99 } 100 101 if (argc - optind < 1) { 102 printf("%s: Incorrect number of arguments. Try `help %s extended'\n", 103 cmdname, cmdname); 77 104 return CMD_FAILURE; 78 105 } 79 80 for (i = 1; i < argc; i++) {106 107 for (i = optind; argv[i] != NULL; i++) { 81 108 buff = str_dup(argv[i]); 109 if (buff == NULL) { 110 cli_error(CL_ENOMEM, "Out of memory"); 111 ret++; 112 continue; 113 } 114 82 115 dirp = opendir(buff); 83 116 if (dirp) { 84 cli_error(CL_ENOTSUP, " %sis a directory", buff);117 cli_error(CL_ENOTSUP, "`%s' is a directory", buff); 85 118 closedir(dirp); 86 ret ++; 119 free(buff); 120 ret++; 87 121 continue; 88 122 } 89 90 fd = open(buff, O_RDWR | O_CREAT); 123 124 /* Check whether file exists if -c (--no-create) option is given */ 125 if ((!no_create) || ((no_create) && (stat(buff, &file_stat) == EOK))) 126 fd = open(buff, O_RDWR | O_CREAT); 127 91 128 if (fd < 0) { 92 cli_error(CL_EFAIL, "Could not update / create %s ", buff); 93 ret ++; 129 cli_error(CL_EFAIL, "Could not update or create `%s'", buff); 130 free(buff); 131 ret++; 94 132 continue; 95 } else 133 } else { 96 134 close(fd); 97 135 fd = -1; 136 } 137 98 138 free(buff); 99 139 } 100 140 101 141 if (ret) 102 142 return CMD_FAILURE; … … 104 144 return CMD_SUCCESS; 105 145 } 106 -
uspace/app/bdsh/cmds/modules/touch/touch.h
r2cc7f16 rc6588ce 4 4 /* Prototypes for the touch command, excluding entry points */ 5 5 6 7 6 #endif /* TOUCH_H */ 8 -
uspace/app/bdsh/cmds/modules/touch/touch_def.h
r2cc7f16 rc6588ce 5 5 &help_cmd_touch, 6 6 }, 7 -
uspace/app/binutils/Makefile
r2cc7f16 rc6588ce 112 112 endif 113 113 ifeq ($(PLATFORM),arm32) 114 TARGET = arm-linux-gnu 114 TARGET = arm-linux-gnueabi 115 115 endif 116 116 ifeq ($(PLATFORM),ia32) -
uspace/app/getterm/Makefile
r2cc7f16 rc6588ce 29 29 30 30 USPACE_PREFIX = ../.. 31 DEFS = -DRELEASE=$(RELEASE) "-D NAME=$(NAME)"31 DEFS = -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" 32 32 BINARY = getterm 33 33 -
uspace/app/getterm/version.c
r2cc7f16 rc6588ce 40 40 #include "version.h" 41 41 42 static const char *copyright = STRING(COPYRIGHT); 42 43 static const char *release = STRING(RELEASE); 43 44 static const char *name = STRING(NAME); … … 61 62 printf("HelenOS release %s (%s)%s%s\n", release, name, revision, timestamp); 62 63 printf("Running on %s (%s)\n", arch, term); 63 printf(" Copyright (c) 2001-2011 HelenOS project\n\n");64 printf("%s\n\n", copyright); 64 65 } 65 66 -
uspace/app/inetcfg/Makefile
r2cc7f16 rc6588ce 1 1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 2 # Copyright (c) 2012 Jiri Svoboda 4 3 # All rights reserved. 5 4 # … … 28 27 # 29 28 30 USPACE_PREFIX = ../../../.. 31 LIBS = $(LIBNET_PREFIX)/libnet.a 32 EXTRA_CFLAGS = -I$(LIBNET_PREFIX)/include 33 BINARY = ip 29 USPACE_PREFIX = ../.. 30 BINARY = inetcfg 34 31 35 32 SOURCES = \ 36 i p.c33 inetcfg.c 37 34 38 35 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/init/init.c
r2cc7f16 rc6588ce 302 302 spawn("/srv/obio"); 303 303 srv_start("/srv/cuda_adb"); 304 srv_start("/srv/s3c24ser"); 305 srv_start("/srv/s3c24ts"); 306 307 spawn("/srv/net"); 304 srv_start("/srv/s3c24xx_uart"); 305 srv_start("/srv/s3c24xx_ts"); 306 307 spawn("/srv/loopip"); 308 spawn("/srv/ethip"); 309 spawn("/srv/inet"); 310 spawn("/srv/tcp"); 311 spawn("/srv/udp"); 308 312 309 313 spawn("/srv/fb"); … … 311 315 console("hid/input", "hid/fb0"); 312 316 313 spawn("/srv/clip ");317 spawn("/srv/clipboard"); 314 318 spawn("/srv/remcons"); 315 319 -
uspace/app/mkexfat/Makefile
r2cc7f16 rc6588ce 1 1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 2 # Copyright (c) 2012 Maurizio Lombardi 4 3 # All rights reserved. 5 4 # … … 28 27 # 29 28 30 USPACE_PREFIX = ../.. /../..31 LIBS = $(LIB NET_PREFIX)/libnet.a32 EXTRA_CFLAGS = -I$(LIB NET_PREFIX)/include33 BINARY = arp29 USPACE_PREFIX = ../.. 30 LIBS = $(LIBBLOCK_PREFIX)/libblock.a 31 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) 32 BINARY = mkexfat 34 33 35 34 SOURCES = \ 36 arp.c35 mkexfat.c 37 36 38 37 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/netecho/netecho.c
r2cc7f16 rc6588ce 373 373 address_in.sin_family = AF_INET; 374 374 address_in.sin_port = htons(port); 375 address_in.sin_addr.s_addr = INADDR_ANY; 375 376 address = (struct sockaddr *) &address_in; 376 377 addrlen = sizeof(address_in); -
uspace/app/netecho/print_error.c
r2cc7f16 rc6588ce 40 40 #include <errno.h> 41 41 42 #include <net/icmp_codes.h>43 44 /** Prints the specific ICMP error description.45 *46 * @param[in] output The description output stream. May be NULL.47 * @param[in] error_code The ICMP error code.48 * @param[in] prefix The error description prefix. May be NULL.49 * @param[in] suffix The error description suffix. May be NULL.50 */51 void icmp_print_error(FILE *output, int error_code, const char *prefix, const char *suffix)52 {53 if (!output)54 return;55 56 if (prefix)57 fprintf(output, "%s", prefix);58 59 switch (error_code) {60 case ICMP_DEST_UNREACH:61 fprintf(output, "ICMP Destination Unreachable (%d) error", error_code);62 break;63 case ICMP_SOURCE_QUENCH:64 fprintf(output, "ICMP Source Quench (%d) error", error_code);65 break;66 case ICMP_REDIRECT:67 fprintf(output, "ICMP Redirect (%d) error", error_code);68 break;69 case ICMP_ALTERNATE_ADDR:70 fprintf(output, "ICMP Alternate Host Address (%d) error", error_code);71 break;72 case ICMP_ROUTER_ADV:73 fprintf(output, "ICMP Router Advertisement (%d) error", error_code);74 break;75 case ICMP_ROUTER_SOL:76 fprintf(output, "ICMP Router Solicitation (%d) error", error_code);77 break;78 case ICMP_TIME_EXCEEDED:79 fprintf(output, "ICMP Time Exceeded (%d) error", error_code);80 break;81 case ICMP_PARAMETERPROB:82 fprintf(output, "ICMP Paramenter Problem (%d) error", error_code);83 break;84 case ICMP_CONVERSION_ERROR:85 fprintf(output, "ICMP Datagram Conversion Error (%d) error", error_code);86 break;87 case ICMP_REDIRECT_MOBILE:88 fprintf(output, "ICMP Mobile Host Redirect (%d) error", error_code);89 break;90 case ICMP_SKIP:91 fprintf(output, "ICMP SKIP (%d) error", error_code);92 break;93 case ICMP_PHOTURIS:94 fprintf(output, "ICMP Photuris (%d) error", error_code);95 break;96 default:97 fprintf(output, "Other (%d) error", error_code);98 }99 100 if (suffix)101 fprintf(output, "%s", suffix);102 }103 104 42 /** Prints the error description. 105 43 * 106 * Supports ICMP andsocket error codes.44 * Supports socket error codes. 107 45 * 108 46 * @param[in] output The description output stream. May be NULL. … … 113 51 void print_error(FILE *output, int error_code, const char *prefix, const char *suffix) 114 52 { 115 if (IS_ICMP_ERROR(error_code)) 116 icmp_print_error(output, error_code, prefix, suffix); 117 else if(IS_SOCKET_ERROR(error_code)) 53 if(IS_SOCKET_ERROR(error_code)) 118 54 socket_print_error(output, error_code, prefix, suffix); 119 55 } -
uspace/app/ping/Makefile
r2cc7f16 rc6588ce 1 1 # 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2007 Jakub Jermar 2 # Copyright (c) 2012 Jiri Svoboda 4 3 # All rights reserved. 5 4 # … … 29 28 30 29 USPACE_PREFIX = ../.. 31 LIBS =32 EXTRA_CFLAGS =33 30 BINARY = ping 34 31 35 32 SOURCES = \ 36 ping.c \ 37 print_error.c 33 ping.c 38 34 39 35 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/ping/ping.c
r2cc7f16 rc6588ce 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 30 30 * @{ 31 31 */ 32 33 /** @file 34 * Packet Internet Network Grouper. 32 /** @file ICMP echo utility. 35 33 */ 36 34 37 35 #include <async.h> 36 #include <bool.h> 37 #include <errno.h> 38 #include <fibril_synch.h> 39 #include <inet/inetping.h> 40 #include <io/console.h> 38 41 #include <stdio.h> 39 #include <str.h> 40 #include <task.h> 41 #include <time.h> 42 #include <ipc/services.h> 43 #include <str_error.h> 44 #include <errno.h> 45 #include <arg_parse.h> 46 47 #include <net/icmp_api.h> 48 #include <net/in.h> 49 #include <net/in6.h> 50 #include <net/inet.h> 51 #include <net/socket_parse.h> 52 #include <net/ip_codes.h> 53 54 #include "print_error.h" 55 56 #define NAME "ping" 57 58 #define CL_OK 0 59 #define CL_USAGE -1 60 #define CL_MISSING -2 61 #define CL_INVALID -3 62 #define CL_UNSUPPORTED -4 63 #define CL_ERROR -5 64 65 /** Ping configuration 66 * 67 */ 68 typedef struct { 69 bool verbose; /**< Verbose printouts. */ 70 size_t size; /**< Outgoing packet size. */ 71 unsigned int count; /**< Number of packets to send. */ 72 suseconds_t timeout; /**< Reply wait timeout. */ 73 int af; /**< Address family. */ 74 ip_tos_t tos; /**< Type of service. */ 75 ip_ttl_t ttl; /**< Time-to-live. */ 76 bool fragments; /**< Fragmentation. */ 77 78 char *dest_addr; /**< Destination address. */ 79 struct sockaddr_in dest; /**< IPv4 destionation. */ 80 struct sockaddr_in6 dest6; /**< IPv6 destionation. */ 81 82 struct sockaddr *dest_raw; /**< Raw destination address. */ 83 socklen_t dest_len; /**< Raw destination address length. */ 84 85 /** Converted address string. */ 86 char dest_str[INET6_ADDRSTRLEN]; 87 } ping_config_t; 88 89 90 static void usage(void) 91 { 92 printf( 93 "Usage: ping [-c count] [-s size] [-W timeout] [-f family] [-t ttl]\n" \ 94 " [-Q tos] [--dont_fragment] destination\n" \ 95 "\n" \ 96 "Options:\n" \ 97 "\t-c count\n" \ 98 "\t--count=count\n" \ 99 "\t\tNumber of outgoing packets (default: 4)\n" \ 100 "\n" \ 101 "\t-s size\n" \ 102 "\t--size=bytes\n" \ 103 "\t\tOutgoing packet size (default: 56 bytes)\n" \ 104 "\n" \ 105 "\t-W timeout\n" \ 106 "\t--timeout=ms\n" \ 107 "\t\tReply wait timeout (default: 3000 ms)\n" \ 108 "\n" \ 109 "\t-f family\n" \ 110 "\t--family=family\n" \ 111 "\t\tDestination address family, AF_INET or AF_INET6 (default: AF_INET)\n" \ 112 "\n" \ 113 "\t-t ttl\n" \ 114 "\t--ttl=ttl\n" \ 115 "\t\tOutgoing packet time-to-live (default: 0)\n" \ 116 "\n" \ 117 "\t-Q tos\n" \ 118 "\t--tos=tos\n" \ 119 "\t\tOutgoing packet type of service (default: 0)\n" \ 120 "\n" \ 121 "\t--dont_fragment\n" \ 122 "\t\tDisable packet fragmentation (default: enabled)\n" \ 123 "\n" \ 124 "\t-v\n" \ 125 "\t--verbose\n" \ 126 "\t\tVerbose operation\n" \ 127 "\n" \ 128 "\t-h\n" \ 129 "\t--help\n" \ 130 "\t\tPrint this usage information\n" 131 ); 132 } 133 134 static int args_parse(int argc, char *argv[], ping_config_t *config) 135 { 136 if (argc < 2) 137 return CL_USAGE; 138 42 #include <stdlib.h> 43 #include <sys/types.h> 44 45 #define NAME "ping" 46 47 /** Delay between subsequent ping requests in microseconds */ 48 #define PING_DELAY (1000 * 1000) 49 50 /** Ping request timeout in microseconds */ 51 #define PING_TIMEOUT (1000 * 1000) 52 53 static int ping_ev_recv(inetping_sdu_t *); 54 55 static bool done = false; 56 static FIBRIL_CONDVAR_INITIALIZE(done_cv); 57 static FIBRIL_MUTEX_INITIALIZE(done_lock); 58 59 static inetping_ev_ops_t ev_ops = { 60 .recv = ping_ev_recv 61 }; 62 63 static inet_addr_t src_addr; 64 static inet_addr_t dest_addr; 65 66 static bool ping_repeat = false; 67 68 static void print_syntax(void) 69 { 70 printf("syntax: " NAME " [-r] <addr>\n"); 71 } 72 73 static int addr_parse(const char *text, inet_addr_t *addr) 74 { 75 unsigned long a[4]; 76 char *cp = (char *)text; 139 77 int i; 140 int ret; 141 142 for (i = 1; i < argc; i++) { 143 144 /* Not an option */ 145 if (argv[i][0] != '-') 78 79 for (i = 0; i < 3; i++) { 80 a[i] = strtoul(cp, &cp, 10); 81 if (*cp != '.') 82 return EINVAL; 83 ++cp; 84 } 85 86 a[3] = strtoul(cp, &cp, 10); 87 if (*cp != '\0') 88 return EINVAL; 89 90 addr->ipv4 = 0; 91 for (i = 0; i < 4; i++) { 92 if (a[i] > 255) 93 return EINVAL; 94 addr->ipv4 = (addr->ipv4 << 8) | a[i]; 95 } 96 97 return EOK; 98 } 99 100 static int addr_format(inet_addr_t *addr, char **bufp) 101 { 102 int rc; 103 104 rc = asprintf(bufp, "%d.%d.%d.%d", addr->ipv4 >> 24, 105 (addr->ipv4 >> 16) & 0xff, (addr->ipv4 >> 8) & 0xff, 106 addr->ipv4 & 0xff); 107 108 if (rc < 0) 109 return ENOMEM; 110 111 return EOK; 112 } 113 114 static void ping_signal_done(void) 115 { 116 fibril_mutex_lock(&done_lock); 117 done = true; 118 fibril_mutex_unlock(&done_lock); 119 fibril_condvar_broadcast(&done_cv); 120 } 121 122 static int ping_ev_recv(inetping_sdu_t *sdu) 123 { 124 char *asrc, *adest; 125 int rc; 126 127 rc = addr_format(&sdu->src, &asrc); 128 if (rc != EOK) 129 return ENOMEM; 130 131 rc = addr_format(&sdu->dest, &adest); 132 if (rc != EOK) { 133 free(asrc); 134 return ENOMEM; 135 } 136 printf("Received ICMP echo reply: from %s to %s, seq. no %u, " 137 "payload size %zu\n", asrc, adest, sdu->seq_no, sdu->size); 138 139 if (!ping_repeat) { 140 ping_signal_done(); 141 } 142 143 free(asrc); 144 free(adest); 145 return EOK; 146 } 147 148 static int ping_send(uint16_t seq_no) 149 { 150 inetping_sdu_t sdu; 151 int rc; 152 153 sdu.src = src_addr; 154 sdu.dest = dest_addr; 155 sdu.seq_no = seq_no; 156 sdu.data = (void *) "foo"; 157 sdu.size = 3; 158 159 rc = inetping_send(&sdu); 160 if (rc != EOK) { 161 printf(NAME ": Failed sending echo request (%d).\n", rc); 162 return rc; 163 } 164 165 return EOK; 166 } 167 168 static int transmit_fibril(void *arg) 169 { 170 uint16_t seq_no = 0; 171 172 while (true) { 173 fibril_mutex_lock(&done_lock); 174 if (done) { 175 fibril_mutex_unlock(&done_lock); 176 return 0; 177 } 178 fibril_mutex_unlock(&done_lock); 179 180 (void) ping_send(++seq_no); 181 async_usleep(PING_DELAY); 182 } 183 184 return 0; 185 } 186 187 static int input_fibril(void *arg) 188 { 189 console_ctrl_t *con; 190 kbd_event_t ev; 191 192 con = console_init(stdin, stdout); 193 printf("[Press Ctrl-Q to quit]\n"); 194 195 while (true) { 196 if (!console_get_kbd_event(con, &ev)) 146 197 break; 147 148 /* Options terminator */ 149 if (str_cmp(argv[i], "--") == 0) { 150 i++; 151 break; 152 } 153 154 int off; 155 156 /* Usage */ 157 if ((off = arg_parse_short_long(argv[i], "-h", "--help")) != -1) 158 return CL_USAGE; 159 160 /* Verbose */ 161 if ((off = arg_parse_short_long(argv[i], "-v", "--verbose")) != -1) { 162 config->verbose = true; 163 continue; 164 } 165 166 /* Don't fragment */ 167 if (str_cmp(argv[i], "--dont_fragment") == 0) { 168 config->fragments = false; 169 continue; 170 } 171 172 /* Count */ 173 if ((off = arg_parse_short_long(argv[i], "-c", "--count=")) != -1) { 174 int tmp; 175 ret = arg_parse_int(argc, argv, &i, &tmp, off); 176 177 if ((ret != EOK) || (tmp < 0)) 178 return i; 179 180 config->count = (unsigned int) tmp; 181 continue; 182 } 183 184 /* Outgoing packet size */ 185 if ((off = arg_parse_short_long(argv[i], "-s", "--size=")) != -1) { 186 int tmp; 187 ret = arg_parse_int(argc, argv, &i, &tmp, off); 188 189 if ((ret != EOK) || (tmp < 0)) 190 return i; 191 192 config->size = (size_t) tmp; 193 continue; 194 } 195 196 /* Reply wait timeout */ 197 if ((off = arg_parse_short_long(argv[i], "-W", "--timeout=")) != -1) { 198 int tmp; 199 ret = arg_parse_int(argc, argv, &i, &tmp, off); 200 201 if ((ret != EOK) || (tmp < 0)) 202 return i; 203 204 config->timeout = (suseconds_t) tmp; 205 continue; 206 } 207 208 /* Address family */ 209 if ((off = arg_parse_short_long(argv[i], "-f", "--family=")) != -1) { 210 ret = arg_parse_name_int(argc, argv, &i, &config->af, off, 211 socket_parse_address_family); 212 213 if (ret != EOK) 214 return i; 215 216 continue; 217 } 218 219 /* Type of service */ 220 if ((off = arg_parse_short_long(argv[i], "-Q", "--tos=")) != -1) { 221 int tmp; 222 ret = arg_parse_name_int(argc, argv, &i, &tmp, off, 223 socket_parse_address_family); 224 225 if ((ret != EOK) || (tmp < 0)) 226 return i; 227 228 config->tos = (ip_tos_t) tmp; 229 continue; 230 } 231 232 /* Time to live */ 233 if ((off = arg_parse_short_long(argv[i], "-t", "--ttl=")) != -1) { 234 int tmp; 235 ret = arg_parse_name_int(argc, argv, &i, &tmp, off, 236 socket_parse_address_family); 237 238 if ((ret != EOK) || (tmp < 0)) 239 return i; 240 241 config->ttl = (ip_ttl_t) tmp; 242 continue; 243 } 244 } 245 246 if (i >= argc) 247 return CL_MISSING; 248 249 config->dest_addr = argv[i]; 250 251 /* Resolve destionation address */ 252 switch (config->af) { 253 case AF_INET: 254 config->dest_raw = (struct sockaddr *) &config->dest; 255 config->dest_len = sizeof(config->dest); 256 config->dest.sin_family = config->af; 257 ret = inet_pton(config->af, config->dest_addr, 258 (uint8_t *) &config->dest.sin_addr.s_addr); 259 break; 260 case AF_INET6: 261 config->dest_raw = (struct sockaddr *) &config->dest6; 262 config->dest_len = sizeof(config->dest6); 263 config->dest6.sin6_family = config->af; 264 ret = inet_pton(config->af, config->dest_addr, 265 (uint8_t *) &config->dest6.sin6_addr.s6_addr); 266 break; 267 default: 268 return CL_UNSUPPORTED; 269 } 270 271 if (ret != EOK) 272 return CL_INVALID; 273 274 /* Convert destination address back to string */ 275 switch (config->af) { 276 case AF_INET: 277 ret = inet_ntop(config->af, 278 (uint8_t *) &config->dest.sin_addr.s_addr, 279 config->dest_str, sizeof(config->dest_str)); 280 break; 281 case AF_INET6: 282 ret = inet_ntop(config->af, 283 (uint8_t *) &config->dest6.sin6_addr.s6_addr, 284 config->dest_str, sizeof(config->dest_str)); 285 break; 286 default: 287 return CL_UNSUPPORTED; 288 } 289 290 if (ret != EOK) 291 return CL_ERROR; 292 293 return CL_OK; 198 199 if (ev.type == KEY_PRESS && (ev.mods & (KM_ALT | KM_SHIFT)) == 200 0 && (ev.mods & KM_CTRL) != 0) { 201 /* Ctrl+key */ 202 if (ev.key == KC_Q) { 203 ping_signal_done(); 204 return 0; 205 } 206 } 207 } 208 209 return 0; 294 210 } 295 211 296 212 int main(int argc, char *argv[]) 297 213 { 298 ping_config_t config; 299 300 /* Default configuration */ 301 config.verbose = false; 302 config.size = 56; 303 config.count = 4; 304 config.timeout = 3000; 305 config.af = AF_INET; 306 config.tos = 0; 307 config.ttl = 0; 308 config.fragments = true; 309 310 int ret = args_parse(argc, argv, &config); 311 312 switch (ret) { 313 case CL_OK: 314 break; 315 case CL_USAGE: 316 usage(); 317 return 0; 318 case CL_MISSING: 319 fprintf(stderr, "%s: Destination address missing\n", NAME); 320 return 1; 321 case CL_INVALID: 322 fprintf(stderr, "%s: Destination address '%s' invalid or malformed\n", 323 NAME, config.dest_addr); 324 return 2; 325 case CL_UNSUPPORTED: 326 fprintf(stderr, "%s: Destination address '%s' unsupported\n", 327 NAME, config.dest_addr); 328 return 3; 329 case CL_ERROR: 330 fprintf(stderr, "%s: Destination address '%s' error\n", 331 NAME, config.dest_addr); 332 return 4; 333 default: 334 fprintf(stderr, "%s: Unknown or invalid option '%s'\n", NAME, 335 argv[ret]); 336 return 5; 337 } 338 339 printf("PING %s (%s) %zu(%zu) bytes of data\n", config.dest_addr, 340 config.dest_str, config.size, config.size); 341 342 async_sess_t *sess = icmp_connect_module(); 343 if (!sess) { 344 fprintf(stderr, "%s: Unable to connect to ICMP service (%s)\n", NAME, 345 str_error(errno)); 346 return errno; 347 } 348 349 unsigned int seq; 350 for (seq = 0; seq < config.count; seq++) { 351 struct timeval t0; 352 ret = gettimeofday(&t0, NULL); 353 if (ret != EOK) { 354 fprintf(stderr, "%s: gettimeofday failed (%s)\n", NAME, 355 str_error(ret)); 356 357 async_hangup(sess); 358 return ret; 359 } 360 361 /* Ping! */ 362 int result = icmp_echo_msg(sess, config.size, config.timeout, 363 config.ttl, config.tos, !config.fragments, config.dest_raw, 364 config.dest_len); 365 366 struct timeval t1; 367 ret = gettimeofday(&t1, NULL); 368 if (ret != EOK) { 369 fprintf(stderr, "%s: gettimeofday failed (%s)\n", NAME, 370 str_error(ret)); 371 372 async_hangup(sess); 373 return ret; 374 } 375 376 suseconds_t elapsed = tv_sub(&t1, &t0); 377 378 switch (result) { 379 case ICMP_ECHO: 380 printf("%zu bytes from ? (?): icmp_seq=%u ttl=? time=%ld.%04ld\n", 381 config.size, seq, elapsed / 1000, elapsed % 1000); 382 break; 383 case ETIMEOUT: 384 printf("%zu bytes from ? (?): icmp_seq=%u Timed out\n", 385 config.size, seq); 386 break; 387 default: 388 print_error(stdout, result, NULL, "\n"); 389 } 390 } 391 392 async_hangup(sess); 393 214 int rc; 215 int argi; 216 217 rc = inetping_init(&ev_ops); 218 if (rc != EOK) { 219 printf(NAME ": Failed connecting to internet ping service " 220 "(%d).\n", rc); 221 return 1; 222 } 223 224 argi = 1; 225 if (argi < argc && str_cmp(argv[argi], "-r") == 0) { 226 ping_repeat = true; 227 ++argi; 228 } else { 229 ping_repeat = false; 230 } 231 232 if (argc - argi != 1) { 233 print_syntax(); 234 return 1; 235 } 236 237 /* Parse destination address */ 238 rc = addr_parse(argv[argi], &dest_addr); 239 if (rc != EOK) { 240 printf(NAME ": Invalid address format.\n"); 241 print_syntax(); 242 return 1; 243 } 244 245 /* Determine source address */ 246 rc = inetping_get_srcaddr(&dest_addr, &src_addr); 247 if (rc != EOK) { 248 printf(NAME ": Failed determining source address.\n"); 249 return 1; 250 } 251 252 fid_t fid; 253 254 if (ping_repeat) { 255 fid = fibril_create(transmit_fibril, NULL); 256 if (fid == 0) { 257 printf(NAME ": Failed creating transmit fibril.\n"); 258 return 1; 259 } 260 261 fibril_add_ready(fid); 262 263 fid = fibril_create(input_fibril, NULL); 264 if (fid == 0) { 265 printf(NAME ": Failed creating input fibril.\n"); 266 return 1; 267 } 268 269 fibril_add_ready(fid); 270 } else { 271 ping_send(1); 272 } 273 274 fibril_mutex_lock(&done_lock); 275 rc = EOK; 276 while (!done && rc != ETIMEOUT) { 277 rc = fibril_condvar_wait_timeout(&done_cv, &done_lock, 278 ping_repeat ? 0 : PING_TIMEOUT); 279 } 280 fibril_mutex_unlock(&done_lock); 281 282 if (rc == ETIMEOUT) { 283 printf(NAME ": Echo request timed out.\n"); 284 return 1; 285 } 286 394 287 return 0; 395 288 } -
uspace/app/sbi/src/run_texpr.c
r2cc7f16 rc6588ce 98 98 { 99 99 stree_symbol_t *sym; 100 tdata_item_t *targ_i ;101 tdata_item_t *titem ;100 tdata_item_t *targ_i = NULL; 101 tdata_item_t *titem = NULL;; 102 102 tdata_object_t *tobject; 103 103 tdata_deleg_t *tdeleg; … … 139 139 return; 140 140 } 141 142 /* Make compiler happy. */143 titem = NULL;144 141 145 142 switch (sym->sc) { … … 222 219 stree_tindex_t *tindex, tdata_item_t **res) 223 220 { 224 tdata_item_t *base_ti ;221 tdata_item_t *base_ti = NULL; 225 222 tdata_item_t *titem; 226 223 tdata_array_t *tarray; -
uspace/app/sportdmp/sportdmp.c
r2cc7f16 rc6588ce 27 27 */ 28 28 29 #include <device/char_dev.h> 29 30 #include <errno.h> 31 #include <ipc/serial_ctl.h> 32 #include <loc.h> 30 33 #include <stdio.h> 31 #include <devman.h>32 #include <ipc/devman.h>33 #include <device/char_dev.h>34 #include <ipc/serial_ctl.h>35 34 36 35 #define BUF_SIZE 1 37 36 38 static void syntax_print() { 39 fprintf(stderr, "Usage: sportdmp <baud> <device_path>\n"); 37 static void syntax_print(void) 38 { 39 fprintf(stderr, "Usage: sportdmp <baud> <device_service>\n"); 40 40 } 41 41 42 42 int main(int argc, char **argv) 43 43 { 44 const char* devpath = "/hw/pci0/00:01.0/com1/a";44 const char* svc_path = "devices/\\hw\\pci0\\00:01.0\\com1\\a"; 45 45 sysarg_t baud = 9600; 46 46 … … 56 56 57 57 if (argc > 2) { 58 devpath = argv[2];58 svc_path = argv[2]; 59 59 } 60 60 … … 64 64 } 65 65 66 devman_handle_t device;67 int rc = devman_fun_get_handle(devpath, &device, IPC_FLAG_BLOCKING);66 service_id_t svc_id; 67 int rc = loc_service_get_id(svc_path, &svc_id, IPC_FLAG_BLOCKING); 68 68 if (rc != EOK) { 69 fprintf(stderr, "Cannot open device %s\n", devpath);69 fprintf(stderr, "Cannot find device service %s\n", svc_path); 70 70 return 1; 71 71 } 72 72 73 async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, device,73 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id, 74 74 IPC_FLAG_BLOCKING); 75 75 if (!sess) { 76 fprintf(stderr, " Cannot connect device\n");76 fprintf(stderr, "Failed connecting to service %s\n", svc_path); 77 77 } 78 78 … … 83 83 84 84 if (rc != EOK) { 85 fprintf(stderr, " Cannot setserial properties\n");85 fprintf(stderr, "Failed setting serial properties\n"); 86 86 return 2; 87 87 } … … 89 89 uint8_t *buf = (uint8_t *) malloc(BUF_SIZE); 90 90 if (buf == NULL) { 91 fprintf(stderr, " Cannot allocatebuffer\n");91 fprintf(stderr, "Failed allocating buffer\n"); 92 92 return 3; 93 93 } -
uspace/app/sysinfo/sysinfo.c
r2cc7f16 rc6588ce 37 37 #include <stdio.h> 38 38 #include <sysinfo.h> 39 #include <malloc.h> 39 40 #include <sys/types.h> 40 41 41 static int print_item_val(char *ipath); 42 static int print_item_data(char *ipath); 43 44 static void dump_bytes_hex(char *data, size_t size); 45 static void dump_bytes_text(char *data, size_t size); 46 47 static void print_syntax(void); 48 49 int main(int argc, char *argv[]) 50 { 51 int rc; 52 char *ipath; 53 sysinfo_item_val_type_t tag; 54 55 if (argc != 2) { 56 print_syntax(); 57 return 1; 58 } 59 60 ipath = argv[1]; 61 62 tag = sysinfo_get_val_type(ipath); 63 64 /* Silence warning */ 65 rc = EOK; 66 67 switch (tag) { 68 case SYSINFO_VAL_UNDEFINED: 69 printf("Error: Sysinfo item '%s' not defined.\n", ipath); 70 rc = 2; 71 break; 72 case SYSINFO_VAL_VAL: 73 rc = print_item_val(ipath); 74 break; 75 case SYSINFO_VAL_DATA: 76 rc = print_item_data(ipath); 77 break; 78 default: 79 printf("Error: Sysinfo item '%s' with unknown value type.\n", 80 ipath); 81 rc = 2; 82 break; 83 } 84 85 return rc; 42 static void dump_bytes_hex(char *data, size_t size) 43 { 44 for (size_t i = 0; i < size; i++) { 45 if (i > 0) 46 putchar(' '); 47 printf("0x%02x", (uint8_t) data[i]); 48 } 49 } 50 51 static void dump_bytes_text(char *data, size_t size) 52 { 53 size_t offset = 0; 54 55 while (offset < size) { 56 wchar_t c = str_decode(data, &offset, size); 57 printf("%lc", (wint_t) c); 58 } 86 59 } 87 60 … … 89 62 { 90 63 sysarg_t value; 91 int rc; 92 93 rc = sysinfo_get_value(ipath, &value); 64 int rc = sysinfo_get_value(ipath, &value); 94 65 if (rc != EOK) { 95 66 printf("Error reading item '%s'.\n", ipath); 96 67 return rc; 97 68 } 98 69 99 70 printf("%s -> %" PRIu64 " (0x%" PRIx64 ")\n", ipath, 100 71 (uint64_t) value, (uint64_t) value); 101 72 102 73 return EOK; 103 74 } … … 105 76 static int print_item_data(char *ipath) 106 77 { 107 void *data;108 78 size_t size; 109 110 data = sysinfo_get_data(ipath, &size); 79 void *data = sysinfo_get_data(ipath, &size); 111 80 if (data == NULL) { 112 81 printf("Error reading item '%s'.\n", ipath); 113 82 return -1; 114 83 } 115 84 116 85 printf("%s -> ", ipath); 117 86 dump_bytes_hex(data, size); … … 119 88 dump_bytes_text(data, size); 120 89 fputs("')\n", stdout); 121 90 122 91 return EOK; 123 92 } 124 93 125 static void dump_bytes_hex(char *data, size_t size) 126 { 127 size_t i; 128 129 for (i = 0; i < size; ++i) { 130 if (i > 0) putchar(' '); 131 printf("0x%02x", (uint8_t) data[i]); 132 } 133 } 134 135 static void dump_bytes_text(char *data, size_t size) 136 { 137 wchar_t c; 138 size_t offset; 139 140 offset = 0; 141 142 while (offset < size) { 143 c = str_decode(data, &offset, size); 144 printf("%lc", (wint_t) c); 145 } 146 } 147 148 149 static void print_syntax(void) 150 { 151 printf("Syntax: sysinfo <item_path>\n"); 94 static int print_item_property(char *ipath, char *iprop) 95 { 96 size_t size; 97 void *data = sysinfo_get_property(ipath, iprop, &size); 98 if (data == NULL) { 99 printf("Error reading property '%s' of item '%s'.\n", iprop, 100 ipath); 101 return -1; 102 } 103 104 printf("%s property %s -> ", ipath, iprop); 105 dump_bytes_hex(data, size); 106 fputs(" ('", stdout); 107 dump_bytes_text(data, size); 108 fputs("')\n", stdout); 109 110 return EOK; 111 } 112 113 static void print_spaces(size_t spaces) 114 { 115 for (size_t i = 0; i < spaces; i++) 116 printf(" "); 117 } 118 119 static void print_keys(const char *path, size_t spaces) 120 { 121 size_t size; 122 char *keys = sysinfo_get_keys(path, &size); 123 if ((keys == NULL) || (size == 0)) 124 return; 125 126 size_t pos = 0; 127 while (pos < size) { 128 /* Process each key with sanity checks */ 129 size_t cur_size = str_nsize(keys + pos, size - pos); 130 if (keys[pos + cur_size] != 0) 131 break; 132 133 size_t path_size = str_size(path) + cur_size + 2; 134 char *cur_path = (char *) malloc(path_size); 135 if (cur_path == NULL) 136 break; 137 138 size_t length; 139 140 if (path[0] != 0) { 141 print_spaces(spaces); 142 printf(".%s\n", keys + pos); 143 length = str_length(keys + pos) + 1; 144 145 snprintf(cur_path, path_size, "%s.%s", path, keys + pos); 146 } else { 147 printf("%s\n", keys + pos); 148 length = str_length(keys + pos); 149 150 snprintf(cur_path, path_size, "%s", keys + pos); 151 } 152 153 print_keys(cur_path, spaces + length); 154 155 free(cur_path); 156 pos += cur_size + 1; 157 } 158 159 free(keys); 160 } 161 162 int main(int argc, char *argv[]) 163 { 164 int rc = 0; 165 166 if (argc < 2) { 167 /* Print keys */ 168 print_keys("", 0); 169 return rc; 170 } 171 172 char *ipath = argv[1]; 173 174 if (argc < 3) { 175 sysinfo_item_val_type_t tag = sysinfo_get_val_type(ipath); 176 177 switch (tag) { 178 case SYSINFO_VAL_UNDEFINED: 179 printf("Error: Sysinfo item '%s' not defined.\n", ipath); 180 rc = 2; 181 break; 182 case SYSINFO_VAL_VAL: 183 rc = print_item_val(ipath); 184 break; 185 case SYSINFO_VAL_DATA: 186 rc = print_item_data(ipath); 187 break; 188 default: 189 printf("Error: Sysinfo item '%s' with unknown value type.\n", 190 ipath); 191 rc = 2; 192 break; 193 } 194 195 return rc; 196 } 197 198 char *iprop = argv[2]; 199 rc = print_item_property(ipath, iprop); 200 return rc; 152 201 } 153 202 -
uspace/app/tester/Makefile
r2cc7f16 rc6588ce 50 50 vfs/vfs1.c \ 51 51 ipc/ping_pong.c \ 52 ipc/starve.c \ 52 53 loop/loop1.c \ 53 54 mm/common.c \ -
uspace/app/tester/fault/fault2.c
r2cc7f16 rc6588ce 35 35 const char *test_fault2(void) 36 36 { 37 volatile long long var; 38 volatile int var1; 39 40 var1 = *((aliasing_int *) (((char *) (&var)) + 1)); 37 volatile long long var = 0; 38 volatile int var1 = *((aliasing_int *) (((char *) (&var)) + 1)); 41 39 printf("Read %d\n", var1); 42 40 -
uspace/app/tester/hw/serial/serial1.c
r2cc7f16 rc6588ce 42 42 #include <async.h> 43 43 #include <ipc/services.h> 44 #include <ipc/devman.h> 45 #include <devman.h> 44 #include <loc.h> 46 45 #include <device/char_dev.h> 47 46 #include <str.h> … … 71 70 } 72 71 73 devman_handle_t handle;74 int res = devman_fun_get_handle("/hw/pci0/00:01.0/com1/a", &handle,75 IPC_FLAG_BLOCKING);72 service_id_t svc_id; 73 int res = loc_service_get_id("devices/\\hw\\pci0\\00:01.0\\com1\\a", 74 &svc_id, IPC_FLAG_BLOCKING); 76 75 if (res != EOK) 77 return " Could not get serial device handle";78 79 async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, handle,76 return "Failed getting serial port service ID"; 77 78 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id, 80 79 IPC_FLAG_BLOCKING); 81 80 if (!sess) 82 return " Unable to connectto serial device";81 return "Failed connecting to serial device"; 83 82 84 83 char *buf = (char *) malloc(cnt + 1); 85 84 if (buf == NULL) { 86 85 async_hangup(sess); 87 return "Failed to allocateinput buffer";86 return "Failed allocating input buffer"; 88 87 } 89 88 … … 112 111 free(buf); 113 112 async_hangup(sess); 114 return "Failed to setserial communication parameters";115 } 116 117 TPRINTF("Trying to read%zu characters from serial device "118 "( handle=%" PRIun ")\n", cnt, handle);113 return "Failed setting serial communication parameters"; 114 } 115 116 TPRINTF("Trying reading %zu characters from serial device " 117 "(svc_id=%" PRIun ")\n", cnt, svc_id); 119 118 120 119 size_t total = 0; … … 130 129 free(buf); 131 130 async_hangup(sess); 132 return "Failed read from serial device";131 return "Failed reading from serial device"; 133 132 } 134 133 … … 165 164 free(buf); 166 165 async_hangup(sess); 167 return "Failed writ eto serial device";166 return "Failed writing to serial device"; 168 167 } 169 168 -
uspace/app/tester/ipc/starve.c
r2cc7f16 rc6588ce 1 1 /* 2 * Copyright (c) 20 09 Lukas Mejdrech2 * Copyright (c) 2012 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup libc 30 * @{ 31 */ 29 #include <stdio.h> 30 #include <stdlib.h> 31 #include <sys/time.h> 32 #include <io/console.h> 33 #include <async.h> 34 #include "../tester.h" 32 35 33 /** @file 34 * ICMP common interface implementation. 35 * @see icmp_common.h 36 */ 36 #define DURATION_SECS 30 37 37 38 #include <net/modules.h> 39 #include <net/icmp_common.h> 40 #include <ipc/services.h> 41 #include <ipc/icmp.h> 42 #include <sys/time.h> 43 #include <async.h> 38 const char *test_starve_ipc(void) 39 { 40 const char *err = NULL; 41 console_ctrl_t *console = console_init(stdin, stdout); 42 if (console == NULL) { 43 return "Failed to init connection with console."; 44 } 45 46 struct timeval start; 47 if (gettimeofday(&start, NULL) != 0) { 48 err = "Failed getting the time"; 49 goto leave; 50 } 51 52 TPRINTF("Intensive computation shall be imagined (for %ds)...\n", DURATION_SECS); 53 TPRINTF("Press a key to terminate prematurely...\n"); 54 while (true) { 55 struct timeval now; 56 if (gettimeofday(&now, NULL) != 0) { 57 err = "Failed getting the time"; 58 goto leave; 59 } 60 61 if (tv_sub(&now, &start) >= DURATION_SECS * 1000000L) 62 break; 63 64 kbd_event_t ev; 65 suseconds_t timeout = 0; 66 bool has_event = console_get_kbd_event_timeout(console, &ev, &timeout); 67 if (has_event && (ev.type == KEY_PRESS)) { 68 TPRINTF("Key %d pressed, terminating.\n", ev.key); 69 break; 70 } 71 } 44 72 45 /** Connect to the ICMP module. 46 * 47 * @return ICMP module session. 48 * 49 */ 50 async_sess_t *icmp_connect_module(void) 51 { 52 return connect_to_service(SERVICE_ICMP); 73 // FIXME - unless a key was pressed, the answer leaked as no one 74 // will wait for it. 75 // We cannot use async_forget() directly, though. Something like 76 // console_forget_pending_kbd_event() shall come here. 77 78 TPRINTF("Terminating...\n"); 79 80 leave: 81 console_done(console); 82 83 return err; 53 84 } 54 55 /** @}56 */ -
uspace/app/tester/print/print1.c
r2cc7f16 rc6588ce 42 42 43 43 TPRINTF("Testing printf(\"%%8.10s\", \"text\"):\n"); 44 TPRINTF("Expected output: \" text\"\n");44 TPRINTF("Expected output: \" text\"\n"); 45 45 TPRINTF("Real output: \"%8.10s\"\n\n", "text"); 46 46 … … 49 49 TPRINTF("Real output: \"%8.10s\"\n\n", "very long text"); 50 50 51 TPRINTF("Testing printf(\"%%-*.*s\", 7, 7, \"text\"):\n"); 52 TPRINTF("Expected output: \"text \"\n"); 53 TPRINTF("Real output: \"%-*.*s\"\n\n", 7, 7, "text"); 54 51 55 return NULL; 52 56 } -
uspace/app/tester/tester.c
r2cc7f16 rc6588ce 60 60 #include "vfs/vfs1.def" 61 61 #include "ipc/ping_pong.def" 62 #include "ipc/starve.def" 62 63 #include "loop/loop1.def" 63 64 #include "mm/malloc1.def" -
uspace/app/tester/tester.h
r2cc7f16 rc6588ce 93 93 extern const char *test_vfs1(void); 94 94 extern const char *test_ping_pong(void); 95 extern const char *test_starve_ipc(void); 95 96 extern const char *test_loop1(void); 96 97 extern const char *test_malloc1(void); -
uspace/app/top/screen.c
r2cc7f16 rc6588ce 37 37 38 38 #include <stdio.h> 39 #include <stdlib.h> 39 40 #include <io/console.h> 40 41 #include <io/style.h> … … 43 44 #include <stats.h> 44 45 #include <inttypes.h> 46 #include <macros.h> 45 47 #include "screen.h" 46 48 #include "top.h" … … 48 50 #define USEC_COUNT 1000000 49 51 50 static sysarg_t warn_col = 0;51 static sysarg_t warn_row = 0;52 52 static suseconds_t timeleft = 0; 53 53 54 54 console_ctrl_t *console; 55 55 56 static sysarg_t warning_col = 0; 57 static sysarg_t warning_row = 0; 58 static suseconds_t warning_timeleft = 0; 59 static char *warning_text = NULL; 60 56 61 static void screen_style_normal(void) 57 62 { … … 64 69 console_flush(console); 65 70 console_set_style(console, STYLE_INVERTED); 71 } 72 73 static void screen_style_emphasis(void) 74 { 75 console_flush(console); 76 console_set_style(console, STYLE_EMPHASIS); 66 77 } 67 78 … … 126 137 void screen_done(void) 127 138 { 139 free(warning_text); 140 warning_text = NULL; 141 128 142 screen_restart(true); 129 143 … … 277 291 } 278 292 279 static inline void print_ tasks_head(void)293 static inline void print_help_head(void) 280 294 { 281 295 screen_style_inverted(); 282 printf("[taskid] [thrds] [resident] [%%resi] [virtual] [%%virt]" 283 " [%%user] [%%kern] [name"); 296 printf("Help"); 284 297 screen_newline(); 285 298 screen_style_normal(); 286 299 } 287 300 288 static inline void print_tasks(data_t *data) 289 { 290 sysarg_t cols; 291 sysarg_t rows; 292 screen_get_size(&cols, &rows); 301 static inline void print_help(void) 302 { 303 sysarg_t cols; 304 sysarg_t rows; 305 screen_get_size(&cols, &rows); 306 307 screen_newline(); 308 309 printf("Operation modes:"); 310 screen_newline(); 311 312 printf(" t .. tasks statistics"); 313 screen_newline(); 314 315 printf(" i .. IPC statistics"); 316 screen_newline(); 317 318 printf(" e .. exceptions statistics"); 319 screen_newline(); 320 321 printf(" a .. toggle display of all/hot exceptions"); 322 screen_newline(); 323 324 printf(" h .. toggle this help screen"); 325 screen_newline(); 326 327 screen_newline(); 328 329 printf("Other keys:"); 330 screen_newline(); 331 332 printf(" s .. choose column to sort by"); 333 screen_newline(); 334 335 printf(" r .. toggle reversed sorting"); 336 screen_newline(); 337 338 printf(" q .. quit"); 339 screen_newline(); 293 340 294 341 sysarg_t col; … … 296 343 screen_get_pos(&col, &row); 297 344 298 size_t i;299 for (i = 0; (i < data->tasks_count) && (row < rows); i++, row++) {300 stats_task_t *task = data->tasks + data->tasks_map[i];301 perc_task_t *perc = data->tasks_perc + data->tasks_map[i];302 303 uint64_t resmem;304 const char *resmem_suffix;305 bin_order_suffix(task->resmem, &resmem, &resmem_suffix, true);306 307 uint64_t virtmem;308 const char *virtmem_suffix;309 bin_order_suffix(task->virtmem, &virtmem, &virtmem_suffix, true);310 311 printf("%-8" PRIu64 " %7zu %7" PRIu64 "%s ",312 task->task_id, task->threads, resmem, resmem_suffix);313 print_percent(perc->resmem, 2);314 printf(" %6" PRIu64 "%s ", virtmem, virtmem_suffix);315 print_percent(perc->virtmem, 2);316 puts(" ");317 print_percent(perc->ucycles, 2);318 puts(" ");319 print_percent(perc->kcycles, 2);320 puts(" ");321 print_string(task->name);322 323 screen_newline();324 }325 326 345 while (row < rows) { 327 346 screen_newline(); … … 330 349 } 331 350 332 static inline void print_ipc_head(void) 333 { 351 static inline void print_table_head(const table_t *table) 352 { 353 sysarg_t cols; 354 sysarg_t rows; 355 screen_get_size(&cols, &rows); 356 334 357 screen_style_inverted(); 335 printf("[taskid] [cls snt] [cls rcv] [ans snt]" 336 " [ans rcv] [irq rcv] [forward] [name"); 358 for (size_t i = 0; i < table->num_columns; i++) { 359 const char *name = table->columns[i].name; 360 int width = table->columns[i].width; 361 if (i != 0) { 362 puts(" "); 363 } 364 if (width == 0) { 365 sysarg_t col; 366 sysarg_t row; 367 screen_get_pos(&col, &row); 368 width = cols - col - 1; 369 } 370 printf("[%-*.*s]", width - 2, width - 2, name); 371 } 337 372 screen_newline(); 338 373 screen_style_normal(); 339 374 } 340 375 341 static inline void print_ ipc(data_t *data)376 static inline void print_table(const table_t *table) 342 377 { 343 378 sysarg_t cols; … … 350 385 351 386 size_t i; 352 for (i = 0; (i < data->tasks_count) && (row < rows); i++, row++) { 353 uint64_t call_sent; 354 uint64_t call_received; 355 uint64_t answer_sent; 356 uint64_t answer_received; 357 uint64_t irq_notif_received; 358 uint64_t forwarded; 359 360 char call_sent_suffix; 361 char call_received_suffix; 362 char answer_sent_suffix; 363 char answer_received_suffix; 364 char irq_notif_received_suffix; 365 char forwarded_suffix; 366 367 order_suffix(data->tasks[i].ipc_info.call_sent, &call_sent, 368 &call_sent_suffix); 369 order_suffix(data->tasks[i].ipc_info.call_received, 370 &call_received, &call_received_suffix); 371 order_suffix(data->tasks[i].ipc_info.answer_sent, 372 &answer_sent, &answer_sent_suffix); 373 order_suffix(data->tasks[i].ipc_info.answer_received, 374 &answer_received, &answer_received_suffix); 375 order_suffix(data->tasks[i].ipc_info.irq_notif_received, 376 &irq_notif_received, &irq_notif_received_suffix); 377 order_suffix(data->tasks[i].ipc_info.forwarded, &forwarded, 378 &forwarded_suffix); 379 380 printf("%-8" PRIu64 " %8" PRIu64 "%c %8" PRIu64 "%c" 381 " %8" PRIu64 "%c %8" PRIu64 "%c %8" PRIu64 "%c" 382 " %8" PRIu64 "%c ", data->tasks[i].task_id, 383 call_sent, call_sent_suffix, 384 call_received, call_received_suffix, 385 answer_sent, answer_sent_suffix, 386 answer_received, answer_received_suffix, 387 irq_notif_received, irq_notif_received_suffix, 388 forwarded, forwarded_suffix); 389 print_string(data->tasks[i].name); 390 391 screen_newline(); 387 for (i = 0; (i < table->num_fields) && (row < rows); i++) { 388 size_t column_index = i % table->num_columns; 389 int width = table->columns[column_index].width; 390 field_t *field = &table->fields[i]; 391 392 if (column_index != 0) { 393 puts(" "); 394 } 395 396 if (width == 0) { 397 screen_get_pos(&col, &row); 398 width = cols - col - 1; 399 } 400 401 switch (field->type) { 402 case FIELD_EMPTY: 403 printf("%*s", width, ""); 404 break; 405 case FIELD_UINT: 406 printf("%*" PRIu64, width, field->uint); 407 break; 408 case FIELD_UINT_SUFFIX_BIN: { 409 uint64_t val = field->uint; 410 const char *suffix; 411 width -= 3; 412 bin_order_suffix(val, &val, &suffix, true); 413 printf("%*" PRIu64 "%s", width, val, suffix); 414 break; 415 } 416 case FIELD_UINT_SUFFIX_DEC: { 417 uint64_t val = field->uint; 418 char suffix; 419 width -= 1; 420 order_suffix(val, &val, &suffix); 421 printf("%*" PRIu64 "%c", width, val, suffix); 422 break; 423 } 424 case FIELD_PERCENT: 425 width -= 5; /* nnn.% */ 426 if (width > 2) { 427 printf("%*s", width - 2, ""); 428 width = 2; 429 } 430 print_percent(field->fixed, width); 431 break; 432 case FIELD_STRING: 433 printf("%-*.*s", width, width, field->string); 434 break; 435 } 436 437 if (column_index == table->num_columns - 1) { 438 screen_newline(); 439 row++; 440 } 392 441 } 393 442 … … 398 447 } 399 448 400 static inline void print_excs_head(void) 401 { 402 screen_style_inverted(); 403 printf("[exc ] [count ] [%%count] [cycles ] [%%cycles] [description"); 404 screen_newline(); 405 screen_style_normal(); 406 } 407 408 static inline void print_excs(data_t *data) 449 static inline void print_sort(table_t *table) 409 450 { 410 451 sysarg_t cols; … … 415 456 sysarg_t row; 416 457 screen_get_pos(&col, &row); 417 418 size_t i; 419 for (i = 0; (i < data->exceptions_count) && (row < rows); i++) { 420 /* Filter-out cold exceptions if not instructed otherwise */ 421 if ((!excs_all) && (!data->exceptions[i].hot)) 422 continue; 423 424 uint64_t count; 425 uint64_t cycles; 426 427 char count_suffix; 428 char cycles_suffix; 429 430 order_suffix(data->exceptions[i].count, &count, &count_suffix); 431 order_suffix(data->exceptions[i].cycles, &cycles, &cycles_suffix); 432 433 printf("%-8u %9" PRIu64 "%c ", 434 data->exceptions[i].id, count, count_suffix); 435 print_percent(data->exceptions_perc[i].count, 2); 436 printf(" %9" PRIu64 "%c ", cycles, cycles_suffix); 437 print_percent(data->exceptions_perc[i].cycles, 2); 438 puts(" "); 439 print_string(data->exceptions[i].desc); 440 458 459 size_t num = min(table->num_columns, rows - row); 460 for (size_t i = 0; i < num; i++) { 461 printf("%c - %s", table->columns[i].key, table->columns[i].name); 441 462 screen_newline(); 442 463 row++; … … 449 470 } 450 471 451 static void print_help(void) 452 { 453 sysarg_t cols; 454 sysarg_t rows; 455 screen_get_size(&cols, &rows); 456 457 sysarg_t col; 458 sysarg_t row; 459 screen_get_pos(&col, &row); 460 461 screen_newline(); 462 463 printf("Operation modes:"); 464 screen_newline(); 465 466 printf(" t .. tasks statistics"); 467 screen_newline(); 468 469 printf(" i .. IPC statistics"); 470 screen_newline(); 471 472 printf(" e .. exceptions statistics"); 473 screen_newline(); 474 475 printf(" a .. toggle display of all/hot exceptions"); 476 screen_newline(); 477 478 row += 6; 479 480 while (row < rows) { 481 screen_newline(); 482 row++; 483 } 472 static inline void print_warning(void) 473 { 474 screen_get_pos(&warning_col, &warning_row); 475 if (warning_timeleft > 0) { 476 screen_style_emphasis(); 477 print_string(warning_text); 478 screen_style_normal(); 479 } else { 480 free(warning_text); 481 warning_text = NULL; 482 } 483 screen_newline(); 484 484 } 485 485 … … 492 492 print_cpu_info(data); 493 493 print_physmem_info(data); 494 495 /* Empty row for warnings */ 496 screen_get_pos(&warn_col, &warn_row); 497 screen_newline(); 498 499 switch (op_mode) { 500 case OP_TASKS: 501 print_tasks_head(); 502 print_tasks(data); 494 print_warning(); 495 496 switch (screen_mode) { 497 case SCREEN_TABLE: 498 print_table_head(&data->table); 499 print_table(&data->table); 503 500 break; 504 case OP_IPC: 505 print_ipc_head(); 506 print_ipc(data); 501 case SCREEN_SORT: 502 print_sort(&data->table); 507 503 break; 508 case OP_EXCS: 509 print_excs_head(); 510 print_excs(data); 511 break; 512 case OP_HELP: 513 print_tasks_head(); 504 case SCREEN_HELP: 505 print_help_head(); 514 506 print_help(); 515 507 } … … 518 510 } 519 511 520 void print_warning(const char *fmt, ...) 521 { 522 screen_moveto(warn_col, warn_row); 523 512 void show_warning(const char *fmt, ...) 513 { 514 sysarg_t cols; 515 sysarg_t rows; 516 screen_get_size(&cols, &rows); 517 518 size_t warning_text_size = 1 + cols * sizeof(*warning_text); 519 free(warning_text); 520 warning_text = malloc(warning_text_size); 521 if (!warning_text) 522 return; 523 524 524 va_list args; 525 525 va_start(args, fmt); 526 v printf(fmt, args);526 vsnprintf(warning_text, warning_text_size, fmt, args); 527 527 va_end(args); 528 528 529 screen_newline(); 529 warning_timeleft = 2 * USEC_COUNT; 530 531 screen_moveto(warning_col, warning_row); 532 print_warning(); 530 533 console_flush(console); 531 534 } … … 555 558 kbd_event_t event; 556 559 560 warning_timeleft -= timeleft; 557 561 if (!console_get_kbd_event_timeout(console, &event, &timeleft)) { 558 562 timeleft = 0; 559 563 return -1; 560 564 } 565 warning_timeleft += timeleft; 561 566 562 567 if (event.type == KEY_PRESS) -
uspace/app/top/screen.h
r2cc7f16 rc6588ce 43 43 extern void screen_done(void); 44 44 extern void print_data(data_t *); 45 extern void print_warning(const char *, ...);45 extern void show_warning(const char *, ...); 46 46 47 47 extern int tgetchar(unsigned int); -
uspace/app/top/top.c
r2cc7f16 rc6588ce 55 55 #define MINUTE 60 56 56 57 op_mode_t op_mode = OP_TASKS; 58 sort_mode_t sort_mode = SORT_TASK_CYCLES; 59 bool excs_all = false; 57 typedef enum { 58 OP_TASKS, 59 OP_IPC, 60 OP_EXCS, 61 } op_mode_t; 62 63 static const column_t task_columns[] = { 64 {"taskid", 't', 8}, 65 {"thrds", 'h', 7}, 66 {"resident", 'r', 10}, 67 {"%resi", 'R', 7}, 68 {"virtual", 'v', 9}, 69 {"%virt", 'V', 7}, 70 {"%user", 'U', 7}, 71 {"%kern", 'K', 7}, 72 {"name", 'd', 0}, 73 }; 74 75 enum { 76 TASK_COL_ID = 0, 77 TASK_COL_NUM_THREADS, 78 TASK_COL_RESIDENT, 79 TASK_COL_PERCENT_RESIDENT, 80 TASK_COL_VIRTUAL, 81 TASK_COL_PERCENT_VIRTUAL, 82 TASK_COL_PERCENT_USER, 83 TASK_COL_PERCENT_KERNEL, 84 TASK_COL_NAME, 85 TASK_NUM_COLUMNS, 86 }; 87 88 static const column_t ipc_columns[] = { 89 {"taskid", 't', 8}, 90 {"cls snt", 'c', 9}, 91 {"cls rcv", 'C', 9}, 92 {"ans snt", 'a', 9}, 93 {"ans rcv", 'A', 9}, 94 {"forward", 'f', 9}, 95 {"name", 'd', 0}, 96 }; 97 98 enum { 99 IPC_COL_TASKID = 0, 100 IPC_COL_CLS_SNT, 101 IPC_COL_CLS_RCV, 102 IPC_COL_ANS_SNT, 103 IPC_COL_ANS_RCV, 104 IPC_COL_FORWARD, 105 IPC_COL_NAME, 106 IPC_NUM_COLUMNS, 107 }; 108 109 static const column_t exception_columns[] = { 110 {"exc", 'e', 8}, 111 {"count", 'n', 10}, 112 {"%count", 'N', 8}, 113 {"cycles", 'c', 10}, 114 {"%cycles", 'C', 9}, 115 {"description", 'd', 0}, 116 }; 117 118 enum { 119 EXCEPTION_COL_ID = 0, 120 EXCEPTION_COL_COUNT, 121 EXCEPTION_COL_PERCENT_COUNT, 122 EXCEPTION_COL_CYCLES, 123 EXCEPTION_COL_PERCENT_CYCLES, 124 EXCEPTION_COL_DESCRIPTION, 125 EXCEPTION_NUM_COLUMNS, 126 }; 127 128 screen_mode_t screen_mode = SCREEN_TABLE; 129 static op_mode_t op_mode = OP_TASKS; 130 static size_t sort_column = TASK_COL_PERCENT_USER; 131 static int sort_reverse = -1; 132 static bool excs_all = false; 60 133 61 134 static const char *read_data(data_t *target) … … 67 140 target->tasks = NULL; 68 141 target->tasks_perc = NULL; 69 target->tasks_map = NULL;70 142 target->threads = NULL; 71 143 target->exceptions = NULL; … … 76 148 target->ecycles_diff = NULL; 77 149 target->ecount_diff = NULL; 150 target->table.name = NULL; 151 target->table.num_columns = 0; 152 target->table.columns = NULL; 153 target->table.num_fields = 0; 154 target->table.fields = NULL; 78 155 79 156 /* Get current time */ … … 117 194 if (target->tasks_perc == NULL) 118 195 return "Not enough memory for task utilization"; 119 120 target->tasks_map =121 (size_t *) calloc(target->tasks_count, sizeof(size_t));122 if (target->tasks_map == NULL)123 return "Not enough memory for task map";124 196 125 197 /* Get threads */ … … 289 361 static int cmp_data(void *a, void *b, void *arg) 290 362 { 291 size_t ia = *((size_t *) a); 292 size_t ib = *((size_t *) b); 293 data_t *data = (data_t *) arg; 294 295 uint64_t acycles = data->ucycles_diff[ia] + data->kcycles_diff[ia]; 296 uint64_t bcycles = data->ucycles_diff[ib] + data->kcycles_diff[ib]; 297 298 if (acycles > bcycles) 299 return -1; 300 301 if (acycles < bcycles) 302 return 1; 303 363 field_t *fa = (field_t *)a + sort_column; 364 field_t *fb = (field_t *)b + sort_column; 365 366 if (fa->type > fb->type) 367 return 1 * sort_reverse; 368 369 if (fa->type < fb->type) 370 return -1 * sort_reverse; 371 372 switch (fa->type) { 373 case FIELD_EMPTY: 374 return 0; 375 case FIELD_UINT_SUFFIX_BIN: /* fallthrough */ 376 case FIELD_UINT_SUFFIX_DEC: /* fallthrough */ 377 case FIELD_UINT: 378 if (fa->uint > fb->uint) 379 return 1 * sort_reverse; 380 if (fa->uint < fb->uint) 381 return -1 * sort_reverse; 382 return 0; 383 case FIELD_PERCENT: 384 if (fa->fixed.upper * fb->fixed.lower 385 > fb->fixed.upper * fa->fixed.lower) 386 return 1 * sort_reverse; 387 if (fa->fixed.upper * fb->fixed.lower 388 < fb->fixed.upper * fa->fixed.lower) 389 return -1 * sort_reverse; 390 return 0; 391 case FIELD_STRING: 392 return str_cmp(fa->string, fb->string) * sort_reverse; 393 } 394 304 395 return 0; 305 396 } 306 397 307 static void sort_data(data_t *data) 308 { 309 size_t i; 310 311 for (i = 0; i < data->tasks_count; i++) 312 data->tasks_map[i] = i; 313 314 qsort((void *) data->tasks_map, data->tasks_count, 315 sizeof(size_t), cmp_data, (void *) data); 398 static void sort_table(table_t *table) 399 { 400 if (sort_column >= table->num_columns) 401 sort_column = 0; 402 /* stable sort is probably best, so we use gsort */ 403 gsort((void *) table->fields, table->num_fields / table->num_columns, 404 sizeof(field_t) * table->num_columns, cmp_data, NULL); 405 } 406 407 static const char *fill_task_table(data_t *data) 408 { 409 data->table.name = "Tasks"; 410 data->table.num_columns = TASK_NUM_COLUMNS; 411 data->table.columns = task_columns; 412 data->table.num_fields = data->tasks_count * TASK_NUM_COLUMNS; 413 data->table.fields = calloc(data->table.num_fields, 414 sizeof(field_t)); 415 if (data->table.fields == NULL) 416 return "Not enough memory for table fields"; 417 418 field_t *field = data->table.fields; 419 for (size_t i = 0; i < data->tasks_count; i++) { 420 stats_task_t *task = &data->tasks[i]; 421 perc_task_t *perc = &data->tasks_perc[i]; 422 field[TASK_COL_ID].type = FIELD_UINT; 423 field[TASK_COL_ID].uint = task->task_id; 424 field[TASK_COL_NUM_THREADS].type = FIELD_UINT; 425 field[TASK_COL_NUM_THREADS].uint = task->threads; 426 field[TASK_COL_RESIDENT].type = FIELD_UINT_SUFFIX_BIN; 427 field[TASK_COL_RESIDENT].uint = task->resmem; 428 field[TASK_COL_PERCENT_RESIDENT].type = FIELD_PERCENT; 429 field[TASK_COL_PERCENT_RESIDENT].fixed = perc->resmem; 430 field[TASK_COL_VIRTUAL].type = FIELD_UINT_SUFFIX_BIN; 431 field[TASK_COL_VIRTUAL].uint = task->virtmem; 432 field[TASK_COL_PERCENT_VIRTUAL].type = FIELD_PERCENT; 433 field[TASK_COL_PERCENT_VIRTUAL].fixed = perc->virtmem; 434 field[TASK_COL_PERCENT_USER].type = FIELD_PERCENT; 435 field[TASK_COL_PERCENT_USER].fixed = perc->ucycles; 436 field[TASK_COL_PERCENT_KERNEL].type = FIELD_PERCENT; 437 field[TASK_COL_PERCENT_KERNEL].fixed = perc->kcycles; 438 field[TASK_COL_NAME].type = FIELD_STRING; 439 field[TASK_COL_NAME].string = task->name; 440 field += TASK_NUM_COLUMNS; 441 } 442 443 return NULL; 444 } 445 446 static const char *fill_ipc_table(data_t *data) 447 { 448 data->table.name = "IPC"; 449 data->table.num_columns = IPC_NUM_COLUMNS; 450 data->table.columns = ipc_columns; 451 data->table.num_fields = data->tasks_count * IPC_NUM_COLUMNS; 452 data->table.fields = calloc(data->table.num_fields, 453 sizeof(field_t)); 454 if (data->table.fields == NULL) 455 return "Not enough memory for table fields"; 456 457 field_t *field = data->table.fields; 458 for (size_t i = 0; i < data->tasks_count; i++) { 459 field[IPC_COL_TASKID].type = FIELD_UINT; 460 field[IPC_COL_TASKID].uint = data->tasks[i].task_id; 461 field[IPC_COL_CLS_SNT].type = FIELD_UINT_SUFFIX_DEC; 462 field[IPC_COL_CLS_SNT].uint = data->tasks[i].ipc_info.call_sent; 463 field[IPC_COL_CLS_RCV].type = FIELD_UINT_SUFFIX_DEC; 464 field[IPC_COL_CLS_RCV].uint = data->tasks[i].ipc_info.call_received; 465 field[IPC_COL_ANS_SNT].type = FIELD_UINT_SUFFIX_DEC; 466 field[IPC_COL_ANS_SNT].uint = data->tasks[i].ipc_info.answer_sent; 467 field[IPC_COL_ANS_RCV].type = FIELD_UINT_SUFFIX_DEC; 468 field[IPC_COL_ANS_RCV].uint = data->tasks[i].ipc_info.answer_received; 469 field[IPC_COL_FORWARD].type = FIELD_UINT_SUFFIX_DEC; 470 field[IPC_COL_FORWARD].uint = data->tasks[i].ipc_info.forwarded; 471 field[IPC_COL_NAME].type = FIELD_STRING; 472 field[IPC_COL_NAME].string = data->tasks[i].name; 473 field += IPC_NUM_COLUMNS; 474 } 475 476 return NULL; 477 } 478 479 static const char *fill_exception_table(data_t *data) 480 { 481 data->table.name = "Exceptions"; 482 data->table.num_columns = EXCEPTION_NUM_COLUMNS; 483 data->table.columns = exception_columns; 484 data->table.num_fields = data->exceptions_count * 485 EXCEPTION_NUM_COLUMNS; 486 data->table.fields = calloc(data->table.num_fields, sizeof(field_t)); 487 if (data->table.fields == NULL) 488 return "Not enough memory for table fields"; 489 490 field_t *field = data->table.fields; 491 for (size_t i = 0; i < data->exceptions_count; i++) { 492 if (!excs_all && !data->exceptions[i].hot) 493 continue; 494 field[EXCEPTION_COL_ID].type = FIELD_UINT; 495 field[EXCEPTION_COL_ID].uint = data->exceptions[i].id; 496 field[EXCEPTION_COL_COUNT].type = FIELD_UINT_SUFFIX_DEC; 497 field[EXCEPTION_COL_COUNT].uint = data->exceptions[i].count; 498 field[EXCEPTION_COL_PERCENT_COUNT].type = FIELD_PERCENT; 499 field[EXCEPTION_COL_PERCENT_COUNT].fixed = data->exceptions_perc[i].count; 500 field[EXCEPTION_COL_CYCLES].type = FIELD_UINT_SUFFIX_DEC; 501 field[EXCEPTION_COL_CYCLES].uint = data->exceptions[i].cycles; 502 field[EXCEPTION_COL_PERCENT_CYCLES].type = FIELD_PERCENT; 503 field[EXCEPTION_COL_PERCENT_CYCLES].fixed = data->exceptions_perc[i].cycles; 504 field[EXCEPTION_COL_DESCRIPTION].type = FIELD_STRING; 505 field[EXCEPTION_COL_DESCRIPTION].string = data->exceptions[i].desc; 506 field += EXCEPTION_NUM_COLUMNS; 507 } 508 509 /* in case any cold exceptions were ignored */ 510 data->table.num_fields = field - data->table.fields; 511 512 return NULL; 513 } 514 515 static const char *fill_table(data_t *data) 516 { 517 if (data->table.fields != NULL) { 518 free(data->table.fields); 519 data->table.fields = NULL; 520 } 521 522 switch (op_mode) { 523 case OP_TASKS: 524 return fill_task_table(data); 525 case OP_IPC: 526 return fill_ipc_table(data); 527 case OP_EXCS: 528 return fill_exception_table(data); 529 } 530 return NULL; 316 531 } 317 532 … … 356 571 if (target->ecount_diff != NULL) 357 572 free(target->ecount_diff); 573 574 if (target->table.fields != NULL) 575 free(target->table.fields); 358 576 } 359 577 … … 367 585 printf("Reading initial data...\n"); 368 586 369 if ((ret = read_data(&data _prev)) != NULL)587 if ((ret = read_data(&data)) != NULL) 370 588 goto out; 371 589 372 590 /* Compute some rubbish to have initialised values */ 373 compute_percentages(&data _prev, &data_prev);591 compute_percentages(&data, &data); 374 592 375 593 /* And paint screen until death */ 376 594 while (true) { 377 595 int c = tgetchar(UPDATE_INTERVAL); 378 if (c < 0) { 596 597 if (c < 0) { /* timeout */ 598 data_prev = data; 379 599 if ((ret = read_data(&data)) != NULL) { 380 free_data(&data );600 free_data(&data_prev); 381 601 goto out; 382 602 } 383 603 384 604 compute_percentages(&data_prev, &data); 385 sort_data(&data);386 print_data(&data);387 605 free_data(&data_prev); 388 data_prev = data; 389 390 continue; 391 } 392 606 607 c = -1; 608 } 609 610 if (screen_mode == SCREEN_HELP && c >= 0) { 611 if (c == 'h' || c == '?') 612 c = -1; 613 /* go back to table and handle the key */ 614 screen_mode = SCREEN_TABLE; 615 } 616 617 if (screen_mode == SCREEN_SORT && c >= 0) { 618 for (size_t i = 0; i < data.table.num_columns; i++) { 619 if (data.table.columns[i].key == c) { 620 sort_column = i; 621 screen_mode = SCREEN_TABLE; 622 } 623 } 624 625 c = -1; 626 } 627 393 628 switch (c) { 394 case 't': 395 print_warning("Showing task statistics"); 396 op_mode = OP_TASKS; 629 case -1: /* do nothing */ 630 break; 631 case 't': 632 op_mode = OP_TASKS; 633 break; 634 case 'i': 635 op_mode = OP_IPC; 636 break; 637 case 'e': 638 op_mode = OP_EXCS; 639 break; 640 case 's': 641 screen_mode = SCREEN_SORT; 642 break; 643 case 'r': 644 sort_reverse = -sort_reverse; 645 break; 646 case 'h': 647 case '?': 648 screen_mode = SCREEN_HELP; 649 break; 650 case 'q': 651 goto out; 652 case 'a': 653 if (op_mode == OP_EXCS) { 654 excs_all = !excs_all; 655 if (excs_all) 656 show_warning("Showing all exceptions"); 657 else 658 show_warning("Showing only hot exceptions"); 397 659 break; 398 case 'i': 399 print_warning("Showing IPC statistics"); 400 op_mode = OP_IPC; 401 break; 402 case 'e': 403 print_warning("Showing exception statistics"); 404 op_mode = OP_EXCS; 405 break; 406 case 'h': 407 print_warning("Showing help"); 408 op_mode = OP_HELP; 409 break; 410 case 'q': 411 goto out; 412 case 'a': 413 if (op_mode == OP_EXCS) { 414 excs_all = !excs_all; 415 if (excs_all) 416 print_warning("Showing all exceptions"); 417 else 418 print_warning("Showing only hot exceptions"); 419 break; 420 } 421 default: 422 print_warning("Unknown command \"%c\", use \"h\" for help", c); 423 break; 424 } 660 } 661 /* fallthrough */ 662 default: 663 show_warning("Unknown command \"%c\", use \"h\" for help", c); 664 continue; /* don't redraw */ 665 } 666 667 if ((ret = fill_table(&data)) != NULL) { 668 goto out; 669 } 670 sort_table(&data.table); 671 print_data(&data); 425 672 } 426 673 427 674 out: 428 675 screen_done(); 429 free_data(&data _prev);676 free_data(&data); 430 677 431 678 if (ret != NULL) { -
uspace/app/top/top.h
r2cc7f16 rc6588ce 51 51 52 52 typedef enum { 53 OP_TASKS, 54 OP_IPC, 55 OP_EXCS, 56 OP_HELP 57 } op_mode_t; 53 SCREEN_TABLE, 54 SCREEN_SORT, 55 SCREEN_HELP, 56 } screen_mode_t; 58 57 59 typedef enum { 60 SORT_TASK_CYCLES 61 } sort_mode_t; 62 63 extern op_mode_t op_mode; 64 extern sort_mode_t sort_mode; 65 extern bool excs_all; 58 extern screen_mode_t screen_mode; 66 59 67 60 typedef struct { … … 87 80 } perc_exc_t; 88 81 82 typedef enum { 83 FIELD_EMPTY, FIELD_UINT, FIELD_UINT_SUFFIX_BIN, FIELD_UINT_SUFFIX_DEC, 84 FIELD_PERCENT, FIELD_STRING 85 } field_type_t; 86 87 typedef struct { 88 field_type_t type; 89 union { 90 fixed_float fixed; 91 uint64_t uint; 92 const char *string; 93 }; 94 } field_t; 95 96 typedef struct { 97 const char *name; 98 char key; 99 int width; 100 } column_t; 101 102 typedef struct { 103 const char *name; 104 size_t num_columns; 105 const column_t *columns; 106 size_t num_fields; 107 field_t *fields; 108 } table_t; 109 89 110 typedef struct { 90 111 time_t hours; … … 107 128 stats_task_t *tasks; 108 129 perc_task_t *tasks_perc; 109 size_t *tasks_map;110 130 111 131 size_t threads_count; … … 122 142 uint64_t *ecycles_diff; 123 143 uint64_t *ecount_diff; 144 145 table_t table; 124 146 } data_t; 125 147 -
uspace/app/trace/ipc_desc.c
r2cc7f16 rc6588ce 39 39 ipc_m_desc_t ipc_methods[] = { 40 40 /* System methods */ 41 { IPC_M_PHONE_HUNGUP, "PHONE_HUNGUP" }, 42 { IPC_M_CONNECT_ME, "CONNECT_ME" }, 43 { IPC_M_CONNECT_ME_TO, "CONNECT_ME_TO" }, 44 { IPC_M_CONNECT_TO_ME, "CONNECT_TO_ME" }, 45 { IPC_M_SHARE_OUT, "SHARE_OUT" }, 46 { IPC_M_SHARE_IN, "SHARE_IN" }, 47 { IPC_M_DATA_WRITE, "DATA_WRITE" }, 48 { IPC_M_DATA_READ, "DATA_READ" }, 49 { IPC_M_DEBUG, "DEBUG" }, 41 { IPC_M_PHONE_HUNGUP, "PHONE_HUNGUP" }, 42 { IPC_M_CONNECTION_CLONE, "CONNECTION_CLONE" }, 43 { IPC_M_CLONE_ESTABLISH, "CLONE_ESTABLISH" }, 44 { IPC_M_CONNECT_ME_TO, "CONNECT_ME_TO" }, 45 { IPC_M_CONNECT_TO_ME, "CONNECT_TO_ME" }, 46 { IPC_M_SHARE_OUT, "SHARE_OUT" }, 47 { IPC_M_SHARE_IN, "SHARE_IN" }, 48 { IPC_M_DATA_WRITE, "DATA_WRITE" }, 49 { IPC_M_DATA_READ, "DATA_READ" }, 50 { IPC_M_DEBUG, "DEBUG" }, 50 51 51 52 /* Terminating entry */ -
uspace/app/websrv/websrv.c
r2cc7f16 rc6588ce 200 200 { 201 201 if (str_cmp(uri, "/") == 0) 202 uri = "/index.htm ";202 uri = "/index.html"; 203 203 204 204 char *fname;
Note:
See TracChangeset
for help on using the changeset viewer.
