Changes in / [8ad5470:15b794d] in mainline
- Files:
-
- 32 added
- 49 deleted
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
r8ad5470 r15b794d 573 573 ! CONFIG_BINUTILS (n/y) 574 574 575 % Build MSIM binary576 ! CONFIG_MSIM (n/y)577 578 575 % Line debugging information 579 576 ! [CONFIG_STRIP_BINARIES!=y] CONFIG_LINE_DEBUG (n/y) -
boot/Makefile.common
r8ad5470 r15b794d 72 72 $(USPACE_PATH)/srv/loader/loader \ 73 73 $(USPACE_PATH)/app/init/init \ 74 $(USPACE_PATH)/srv/loc srv/locsrv\74 $(USPACE_PATH)/srv/loc/loc \ 75 75 $(USPACE_PATH)/srv/bd/rd/rd \ 76 76 $(USPACE_PATH)/srv/vfs/vfs \ … … 111 111 $(USPACE_PATH)/srv/hid/remcons/remcons \ 112 112 $(USPACE_PATH)/srv/net/ethip/ethip \ 113 $(USPACE_PATH)/srv/net/inet srv/inetsrv\113 $(USPACE_PATH)/srv/net/inet/inet \ 114 114 $(USPACE_PATH)/srv/net/loopip/loopip \ 115 115 $(USPACE_PATH)/srv/net/tcp/tcp \ … … 161 161 $(USPACE_PATH)/app/edit/edit \ 162 162 $(USPACE_PATH)/app/ext2info/ext2info \ 163 $(USPACE_PATH)/app/inet /inet\163 $(USPACE_PATH)/app/inetcfg/inetcfg \ 164 164 $(USPACE_PATH)/app/kill/kill \ 165 165 $(USPACE_PATH)/app/killall/killall \ 166 $(USPACE_PATH)/app/loc /loc\166 $(USPACE_PATH)/app/locinfo/locinfo \ 167 167 $(USPACE_PATH)/app/mkfat/mkfat \ 168 168 $(USPACE_PATH)/app/mkexfat/mkexfat \ … … 206 206 endif 207 207 208 ifeq ($(CONFIG_MSIM),y)209 RD_APPS_NON_ESSENTIAL += \210 $(USPACE_PATH)/app/msim/msim211 endif212 213 208 COMPONENTS = \ 214 209 $(KERNEL_PATH)/kernel.bin \ -
tools/checkers/clang.py
r8ad5470 r15b794d 114 114 for job in jobs: 115 115 if (not clang(rootdir, job)): 116 print ()116 print 117 117 print("Failed job: %s" % job) 118 118 return -
tools/checkers/stanse.py
r8ad5470 r15b794d 127 127 for job in jobs: 128 128 if (not stanse(rootdir, job)): 129 print ()129 print 130 130 print("Failed job: %s" % job) 131 131 return -
tools/checkers/vcc.py
r8ad5470 r15b794d 204 204 for job in jobs: 205 205 if (not vcc(vcc_path, rootdir, job)): 206 print ()206 print 207 207 print("Failed job: %s" % job) 208 208 return 209 209 210 print ()210 print 211 211 print("All jobs passed") 212 212 -
tools/filldir.py
r8ad5470 r15b794d 37 37 38 38 if len(sys.argv) < 3: 39 print ('Usage: filldir <parent-dir> <count>')39 print 'Usage: filldir <parent-dir> <count>' 40 40 exit(2) 41 41 -
tools/gentestfile.py
r8ad5470 r15b794d 36 36 37 37 if len(sys.argv) < 2: 38 print ("Usage: gentestfile.py <count of 64-bit numbers to output>")38 print "Usage: gentestfile.py <count of 64-bit numbers to output>" 39 39 exit() 40 40 41 m = int(sys.argv[1])41 m = long(sys.argv[1]) 42 42 i = 0 43 43 pow_2_64 = 2 ** 64 -
tools/mkfat.py
r8ad5470 r15b794d 189 189 "Filter FAT legal characters" 190 190 191 filtered_name = b''191 filtered_name = '' 192 192 filtered = False 193 193 … … 205 205 206 206 ascii_name, lfn = fat_lchars(name) 207 # Splitting works only on strings, not on bytes 208 ascii_parts = ascii_name.decode('utf8').split('.') 207 ascii_parts = ascii_name.split('.') 209 208 210 209 short_name = '' … … 445 444 extra_bytes = int(sys.argv[1]) 446 445 447 path = os.path.abspath(sys.argv[2] )446 path = os.path.abspath(sys.argv[2].decode()) 448 447 if (not os.path.isdir(path)): 449 448 print("<PATH> must be a directory") -
tools/mkuimage.py
r8ad5470 r15b794d 124 124 header.img_type = 2 # Kernel 125 125 header.compression = 0 # None 126 header.img_name = image_name .encode('ascii')126 header.img_name = image_name 127 127 128 128 header_crc = calc_crc32(header.pack()) … … 140 140 signed_crc = zlib.crc32(byteseq, 0) 141 141 if signed_crc < 0: 142 return signed_crc + (1 << 32)142 return (long(signed_crc) + (long(2) ** long(32))) # 2^32L 143 143 else: 144 144 return signed_crc … … 148 148 def print_syntax(cmd): 149 149 print("syntax: " + cmd + " [<options>] <raw_image> <uImage>") 150 print ()150 print 151 151 print("\traw_image\tInput image name (raw binary data)") 152 152 print("\tuImage\t\tOutput uImage name (U-Boot image)") 153 print ()153 print 154 154 print("options:") 155 155 print("\t-name <name>\tImage name (default: 'Noname')") -
tools/xstruct.py
r8ad5470 r15b794d 32 32 33 33 import struct 34 import sys35 34 import types 36 35 37 # Handle long integer conversions nicely in both Python 2 and Python 338 integer_types = (int, long) if sys.version < '3' else (int,)39 40 # Ensure that 's' format for struct receives correct data type depending41 # on Python version (needed due to different way to encode into bytes)42 ensure_string = \43 (lambda value: value if type(value) is str else bytes(value)) \44 if sys.version < '3' else \45 (lambda value: bytes(value, 'ascii') if type(value) is str else value)46 47 36 ranges = { 48 'B': ( integer_types, 0x00, 0xff),49 'H': ( integer_types, 0x0000, 0xffff),50 'L': ( integer_types, 0x00000000, 0xffffffff),51 'Q': ( integer_types, 0x0000000000000000, 0xffffffffffffffff),52 'b': ( integer_types, -0x80, 0x7f),53 'h': ( integer_types, -0x8000, 0x7fff),54 'l': ( integer_types, -0x80000000, 0x7fffffff) ,55 'q': ( integer_types, -0x8000000000000000, 0x7fffffffffffffff),37 'B': ((int, long), 0x00, 0xff), 38 'H': ((int, long), 0x0000, 0xffff), 39 'L': ((int, long), 0x00000000, 0xffffffff), 40 'Q': ((int, long), 0x0000000000000000, 0xffffffffffffffff), 41 'b': ((int, long), -0x80, 0x7f), 42 'h': ((int, long), -0x8000, 0x7fff), 43 'l': ((int, long), -0x80000000, 0x7fffffff) , 44 'q': ((int, long), -0x8000000000000000, 0x7fffffffffffffff), 56 45 } 57 46 … … 85 74 args.append(item) 86 75 else: 87 if (fmt == "s"):88 value = ensure_string(value)89 76 check_range(variable, fmt, value) 90 77 args.append(value) -
uspace/Makefile
r8ad5470 r15b794d 42 42 app/getterm \ 43 43 app/init \ 44 app/inet \44 app/inetcfg \ 45 45 app/kill \ 46 46 app/killall \ 47 47 app/klog \ 48 app/loc \48 app/locinfo \ 49 49 app/lsusb \ 50 50 app/mkfat \ … … 70 70 app/nettest3 \ 71 71 app/ping \ 72 app/websrv \ 72 73 app/sysinfo \ 73 74 app/mkbd \ 74 app/websrv \75 75 srv/clipboard \ 76 srv/loc srv\76 srv/loc \ 77 77 srv/devman \ 78 78 srv/loader \ 79 79 srv/net/ethip \ 80 srv/net/inet srv\80 srv/net/inet \ 81 81 srv/net/loopip \ 82 82 srv/net/tcp \ … … 140 140 endif 141 141 142 ifeq ($(CONFIG_MSIM),y)143 DIRS += \144 app/msim145 endif146 147 142 ## Platform-specific hardware support 148 143 # -
uspace/app/bdsh/Makefile
r8ad5470 r15b794d 48 48 cmds/modules/cp/cp.c \ 49 49 cmds/modules/mv/mv.c \ 50 cmds/modules/printf/printf.c \51 cmds/modules/echo/echo.c \52 50 cmds/modules/mount/mount.c \ 53 51 cmds/modules/unmount/unmount.c \ -
uspace/app/bdsh/TODO
r8ad5470 r15b794d 30 30 * Add wrappers for signal, sigaction to make ports to modules easier 31 31 32 * Add 'echo' and 'printf' modules. 33 32 34 Regarding POSIX: 33 35 ---------------- -
uspace/app/bdsh/cmds/builtins/cd/cd.c
r8ad5470 r15b794d 41 41 static const char *cmdname = "cd"; 42 42 43 /* Previous directory variables.44 *45 * Declaring them static to avoid many "== NULL" checks.46 * PATH_MAX is not that big to cause any problems with memory overhead.47 */48 static char previous_directory[PATH_MAX] = "";49 static char previous_directory_tmp[PATH_MAX];50 static bool previous_directory_valid = true;51 static bool previous_directory_set = false;52 53 static int chdir_and_remember(const char *new_dir) {54 55 char *ok = getcwd(previous_directory_tmp, PATH_MAX);56 previous_directory_valid = ok != NULL;57 previous_directory_set = true;58 59 int rc = chdir(new_dir);60 if (rc != EOK) {61 return rc;62 }63 64 str_cpy(previous_directory, PATH_MAX, previous_directory_tmp);65 return EOK;66 }67 68 43 void help_cmd_cd(unsigned int level) 69 44 { … … 80 55 } 81 56 82 83 57 /* This is a very rudamentary 'cd' command. It is not 'link smart' (yet) */ 84 58 … … 88 62 89 63 argc = cli_count_args(argv); 90 91 /* Handle cd -- -. Override to switch to a directory named '-' */92 bool hyphen_override = false;93 char *target_directory = argv[1];94 if (argc == 3) {95 if (!str_cmp(argv[1], "--")) {96 hyphen_override = true;97 argc--;98 target_directory = argv[2];99 }100 }101 64 102 65 /* We don't yet play nice with whitespace, a getopt implementation should … … 116 79 } 117 80 118 /* We have the correct # of arguments */119 //TODO: handle tidle (~) expansion? */81 /* We have the correct # of arguments 82 * TODO: handle tidle (~) expansion? */ 120 83 121 /* Handle 'cd -' first. */ 122 if (!str_cmp(target_directory, "-") && !hyphen_override) { 123 if (!previous_directory_valid) { 124 cli_error(CL_EFAIL, "Cannot switch to previous directory"); 125 return CMD_FAILURE; 126 } 127 if (!previous_directory_set) { 128 cli_error(CL_EFAIL, "No previous directory to switch to"); 129 return CMD_FAILURE; 130 } 131 char *prev_dup = str_dup(previous_directory); 132 if (prev_dup == NULL) { 133 cli_error(CL_ENOMEM, "Cannot switch to previous directory"); 134 return CMD_FAILURE; 135 } 136 rc = chdir_and_remember(prev_dup); 137 free(prev_dup); 138 } else { 139 rc = chdir_and_remember(target_directory); 140 } 84 rc = chdir(argv[1]); 141 85 142 86 if (rc == 0) { … … 149 93 break; 150 94 case ENOENT: 151 cli_error(CL_ENOENT, "Invalid directory `%s'", target_directory);95 cli_error(CL_ENOENT, "Invalid directory `%s'", argv[1]); 152 96 break; 153 97 default: 154 cli_error(CL_EFAIL, "Unable to change to `%s'", target_directory);98 cli_error(CL_EFAIL, "Unable to change to `%s'", argv[1]); 155 99 break; 156 100 } -
uspace/app/bdsh/cmds/modules/cat/cat.h
r8ad5470 r15b794d 4 4 /* Prototypes for the cat command, excluding entry points */ 5 5 6 static unsigned int cat_file(const char *, size_t, bool, off64_t, off64_t, bool); 7 6 8 #endif /* CAT_H */ 7 9 -
uspace/app/bdsh/cmds/modules/cp/cp.c
r8ad5470 r15b794d 30 30 #include <stdlib.h> 31 31 #include <unistd.h> 32 #include <io/console.h>33 #include <io/keycode.h>34 32 #include <getopt.h> 35 33 #include <str.h> … … 48 46 49 47 static const char *cmdname = "cp"; 50 static console_ctrl_t *con;51 48 52 49 static struct option const long_options[] = { 53 50 { "buffer", required_argument, 0, 'b' }, 54 51 { "force", no_argument, 0, 'f' }, 55 { "interactive", no_argument, 0, 'i'},56 52 { "recursive", no_argument, 0, 'r' }, 57 53 { "help", no_argument, 0, 'h' }, … … 143 139 } 144 140 145 static bool get_user_decision(bool bdefault, const char *message, ...)146 {147 va_list args;148 149 va_start(args, message);150 vprintf(message, args);151 va_end(args);152 153 while (true) {154 kbd_event_t ev;155 console_flush(con);156 console_get_kbd_event(con, &ev);157 if ((ev.type != KEY_PRESS)158 || (ev.mods & (KM_CTRL | KM_ALT)) != 0) {159 continue;160 }161 162 switch(ev.key) {163 case KC_Y:164 printf("y\n");165 return true;166 case KC_N:167 printf("n\n");168 return false;169 case KC_ENTER:170 printf("%c\n", bdefault ? 'Y' : 'N');171 return bdefault;172 default:173 break;174 }175 }176 }177 178 141 static int64_t do_copy(const char *src, const char *dest, 179 size_t blen, int vb, int recursive, int force , int interactive)142 size_t blen, int vb, int recursive, int force) 180 143 { 181 144 int r = -1; … … 229 192 /* e.g. cp file_name existing_file */ 230 193 231 /* dest already exists, 232 * if force is set we will try to remove it. 233 * if interactive is set user input is required. 194 /* dest already exists, if force is set we will 195 * try to remove it. 234 196 */ 235 if (force && !interactive) {197 if (force) { 236 198 if (unlink(dest_path)) { 237 199 printf("Unable to remove %s\n", … … 239 201 goto exit; 240 202 } 241 } else if (!force && interactive) {242 bool overwrite = get_user_decision(false,243 "File already exists: %s. Overwrite? [y/N]: ",244 dest_path);245 if (overwrite) {246 printf("Overwriting file: %s\n", dest_path);247 if (unlink(dest_path)) {248 printf("Unable to remove %s\n", dest_path);249 goto exit;250 }251 } else {252 printf("Not overwriting file: %s\n", dest_path);253 r = 0;254 goto exit;255 }256 203 } else { 257 printf(" File already exists: %s\n", dest_path);204 printf("file already exists: %s\n", dest_path); 258 205 goto exit; 259 206 } … … 355 302 /* Recursively call do_copy() */ 356 303 r = do_copy(src_dent, dest_dent, blen, vb, recursive, 357 force , interactive);304 force); 358 305 if (r) 359 306 goto exit; … … 368 315 return r; 369 316 } 317 370 318 371 319 static int64_t copy_file(const char *src, const char *dest, … … 432 380 " -v, --version Print version information and exit\n" 433 381 " -V, --verbose Be annoyingly noisy about what's being done\n" 434 " -f, --force Do not complain when <dest> exists (overrides a previous -i)\n" 435 " -i, --interactive Ask what to do when <dest> exists (overrides a previous -f)\n" 382 " -f, --force Do not complain when <dest> exists\n" 436 383 " -r, --recursive Copy entire directories\n" 437 384 " -b, --buffer ## Set the read buffer size to ##\n"; … … 450 397 unsigned int argc, verbose = 0; 451 398 int buffer = 0, recursive = 0; 452 int force = 0 , interactive = 0;399 int force = 0; 453 400 int c, opt_ind; 454 401 int64_t ret; 455 402 456 con = console_init(stdin, stdout);457 403 argc = cli_count_args(argv); 458 404 459 405 for (c = 0, optind = 0, opt_ind = 0; c != -1;) { 460 c = getopt_long(argc, argv, "hvVf irb:", long_options, &opt_ind);406 c = getopt_long(argc, argv, "hvVfrb:", long_options, &opt_ind); 461 407 switch (c) { 462 408 case 'h': … … 470 416 break; 471 417 case 'f': 472 interactive = 0;473 418 force = 1; 474 break;475 case 'i':476 force = 0;477 interactive = 1;478 419 break; 479 420 case 'r': … … 485 426 "(should be a number greater than zero)\n", 486 427 cmdname); 487 console_done(con);488 428 return CMD_FAILURE; 489 429 } … … 502 442 printf("%s: invalid number of arguments. Try %s --help\n", 503 443 cmdname, cmdname); 504 console_done(con);505 444 return CMD_FAILURE; 506 445 } 507 446 508 447 ret = do_copy(argv[optind], argv[optind + 1], buffer, verbose, 509 recursive, force, interactive); 510 511 console_done(con); 448 recursive, force); 512 449 513 450 if (ret == 0) -
uspace/app/bdsh/cmds/modules/help/help.h
r8ad5470 r15b794d 3 3 4 4 /* Prototypes for the help command (excluding entry points) */ 5 static int is_mod_or_builtin(char *); 5 6 6 7 #endif -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
r8ad5470 r15b794d 36 36 #include <stdarg.h> 37 37 #include <str.h> 38 #include <errno.h>39 #include <str_error.h>40 #include <vfs/vfs.h>41 38 42 39 #include "config.h" … … 86 83 /* This is kind of clunky, but effective for now */ 87 84 static unsigned int 88 create_directory(const char * user_path, bool create_parents)85 create_directory(const char *path, unsigned int p) 89 86 { 90 /* Ensure we would always work with absolute and canonified path. */ 91 char *path = absolutize(user_path, NULL); 92 if (path == NULL) { 87 DIR *dirp; 88 char *tmp = NULL, *buff = NULL, *wdp = NULL; 89 char *dirs[255]; 90 unsigned int absolute = 0, i = 0, ret = 0; 91 92 /* Its a good idea to allocate path, plus we (may) need a copy of 93 * path to tokenize if parents are specified */ 94 if (NULL == (tmp = str_dup(path))) { 93 95 cli_error(CL_ENOMEM, "%s: path too big?", cmdname); 94 96 return 1; 95 97 } 96 98 97 int rc; 98 int ret = 0; 99 100 if (!create_parents) { 101 rc = mkdir(path, 0); 102 if (rc != EOK) { 103 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 104 cmdname, path, str_error(rc)); 105 ret = 1; 106 } 99 if (NULL == (wdp = (char *) malloc(PATH_MAX))) { 100 cli_error(CL_ENOMEM, "%s: could not alloc cwd", cmdname); 101 free(tmp); 102 return 1; 103 } 104 105 /* The only reason for wdp is to be (optionally) verbose */ 106 getcwd(wdp, PATH_MAX); 107 108 /* Typical use without specifying the creation of parents */ 109 if (p == 0) { 110 dirp = opendir(tmp); 111 if (dirp) { 112 cli_error(CL_EEXISTS, "%s: can not create %s, try -p", cmdname, path); 113 closedir(dirp); 114 goto finit; 115 } 116 if (-1 == (mkdir(tmp, 0))) { 117 cli_error(CL_EFAIL, "%s: could not create %s", cmdname, path); 118 goto finit; 119 } 120 } 121 122 /* Parents need to be created, path has to be broken up */ 123 124 /* See if path[0] is a slash, if so we have to remember to append it */ 125 if (tmp[0] == '/') 126 absolute = 1; 127 128 /* TODO: Canonify the path prior to tokenizing it, see below */ 129 dirs[i] = strtok(tmp, "/"); 130 while (dirs[i] && i < 255) 131 dirs[++i] = strtok(NULL, "/"); 132 133 if (NULL == dirs[0]) 134 return 1; 135 136 if (absolute == 1) { 137 asprintf(&buff, "/%s", dirs[0]); 138 mkdir(buff, 0); 139 chdir(buff); 140 free(buff); 141 getcwd(wdp, PATH_MAX); 142 i = 1; 107 143 } else { 108 /* Create the parent directories as well. */ 109 size_t off = 0; 110 while (1) { 111 size_t prev_off = off; 112 wchar_t cur_char = str_decode(path, &off, STR_NO_LIMIT); 113 if ((cur_char == 0) || (cur_char == U_SPECIAL)) { 144 i = 0; 145 } 146 147 while (dirs[i] != NULL) { 148 /* Sometimes make or scripts conjoin odd paths. Account for something 149 * like this: ../../foo/bar/../foo/foofoo/./bar */ 150 if (!str_cmp(dirs[i], "..") || !str_cmp(dirs[i], ".")) { 151 if (0 != (chdir(dirs[i]))) { 152 cli_error(CL_EFAIL, "%s: impossible path: %s", 153 cmdname, path); 154 ret ++; 155 goto finit; 156 } 157 getcwd(wdp, PATH_MAX); 158 } else { 159 if (-1 == (mkdir(dirs[i], 0))) { 160 cli_error(CL_EFAIL, 161 "%s: failed at %s/%s", wdp, dirs[i]); 162 ret ++; 163 goto finit; 164 } 165 if (0 != (chdir(dirs[i]))) { 166 cli_error(CL_EFAIL, "%s: failed creating %s\n", 167 cmdname, dirs[i]); 168 ret ++; 114 169 break; 115 170 } 116 if (cur_char != '/') { 117 continue; 118 } 119 if (prev_off == 0) { 120 continue; 121 } 122 /* 123 * If we are here, it means that: 124 * - we found / 125 * - it is not the first / (no need to create root 126 * directory) 127 * 128 * We would now overwrite the / with 0 to terminate the 129 * string (that shall be okay because we are 130 * overwriting at the beginning of UTF sequence). 131 * That would allow us to create the directories 132 * in correct nesting order. 133 * 134 * Notice that we ignore EEXIST errors as some of 135 * the parent directories may already exist. 136 */ 137 char slash_char = path[prev_off]; 138 path[prev_off] = 0; 139 rc = mkdir(path, 0); 140 if (rc == EEXIST) { 141 rc = EOK; 142 } 143 144 if (rc != EOK) { 145 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 146 cmdname, path, str_error(rc)); 147 ret = 1; 148 goto leave; 149 } 150 151 path[prev_off] = slash_char; 152 } 153 /* Create the final directory. */ 154 rc = mkdir(path, 0); 155 if (rc != EOK) { 156 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 157 cmdname, path, str_error(rc)); 158 ret = 1; 159 } 160 } 161 162 leave: 163 free(path); 171 } 172 i++; 173 } 174 goto finit; 175 176 finit: 177 free(wdp); 178 free(tmp); 164 179 return ret; 165 180 } … … 167 182 int cmd_mkdir(char **argv) 168 183 { 169 unsigned int argc, i, ret= 0;170 bool create_parents = false, follow = false, verbose = false;184 unsigned int argc, create_parents = 0, i, ret = 0, follow = 0; 185 unsigned int verbose = 0; 171 186 int c, opt_ind; 187 char *cwd; 172 188 173 189 argc = cli_count_args(argv); … … 177 193 switch (c) { 178 194 case 'p': 179 create_parents = true;195 create_parents = 1; 180 196 break; 181 197 case 'v': 182 verbose = true;198 verbose = 1; 183 199 break; 184 200 case 'h': … … 189 205 return CMD_SUCCESS; 190 206 case 'f': 191 follow = true;207 follow = 1; 192 208 break; 193 209 case 'm': … … 205 221 } 206 222 223 if (NULL == (cwd = (char *) malloc(PATH_MAX))) { 224 cli_error(CL_ENOMEM, "%s: could not allocate cwd", cmdname); 225 return CMD_FAILURE; 226 } 227 228 memset(cwd, 0, sizeof(cwd)); 229 getcwd(cwd, PATH_MAX); 230 207 231 for (i = optind; argv[i] != NULL; i++) { 208 if (verbose )232 if (verbose == 1) 209 233 printf("%s: creating %s%s\n", 210 234 cmdname, argv[i], … … 213 237 } 214 238 215 if (follow && (argv[optind] != NULL)) { 216 chdir(argv[optind]); 217 } 239 if (follow == 0) 240 chdir(cwd); 241 242 free(cwd); 218 243 219 244 if (ret) -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.h
r8ad5470 r15b794d 4 4 /* Prototypes for the mkdir command, excluding entry points */ 5 5 6 static unsigned int create_directory(const char *, unsigned int); 6 7 #endif /* MKDIR_H */ 7 8 -
uspace/app/bdsh/cmds/modules/modules.h
r8ad5470 r15b794d 61 61 #include "unmount/entry.h" 62 62 #include "kcon/entry.h" 63 #include "printf/entry.h"64 #include "echo/entry.h"65 63 66 64 /* Each .def function fills the module_t struct with the individual name, entry … … 84 82 #include "unmount/unmount_def.h" 85 83 #include "kcon/kcon_def.h" 86 #include "printf/printf_def.h"87 #include "echo/echo_def.h"88 84 89 85 {NULL, NULL, NULL, NULL} -
uspace/app/bdsh/cmds/modules/rm/rm.c
r8ad5470 r15b794d 46 46 #define RM_VERSION "0.0.1" 47 47 48 static rm_job_t rm; 49 48 50 static struct option const long_options[] = { 49 51 { "help", no_argument, 0, 'h' }, … … 55 57 }; 56 58 57 /* Return values for rm_scope() */58 #define RM_BOGUS 059 #define RM_FILE 160 #define RM_DIR 261 62 /* Flags for rm_update() */63 #define _RM_ENTRY 064 #define _RM_ADVANCE 165 #define _RM_REWIND 266 #define _RM_EXIT 367 68 /* A simple job structure */69 typedef struct {70 /* Options set at run time */71 unsigned int force; /* -f option */72 unsigned int recursive; /* -r option */73 unsigned int safe; /* -s option */74 75 /* Keeps track of the job in progress */76 int advance; /* How far deep we've gone since entering */77 DIR *entry; /* Entry point to the tree being removed */78 char *owd; /* Where we were when we invoked rm */79 char *cwd; /* Current directory being transversed */80 char *nwd; /* Next directory to be transversed */81 82 /* Counters */83 int f_removed; /* Number of files unlinked */84 int d_removed; /* Number of directories unlinked */85 } rm_job_t;86 87 static rm_job_t rm;88 89 static unsigned int rm_recursive(const char *);90 91 59 static unsigned int rm_start(rm_job_t *rm) 92 60 { … … 127 95 if (NULL != rm->cwd) 128 96 free(rm->cwd); 129 }130 131 static unsigned int rm_single(const char *path)132 {133 if (unlink(path)) {134 cli_error(CL_EFAIL, "rm: could not remove file %s", path);135 return 1;136 }137 return 0;138 }139 140 static unsigned int rm_scope(const char *path)141 {142 int fd;143 DIR *dirp;144 145 dirp = opendir(path);146 if (dirp) {147 closedir(dirp);148 return RM_DIR;149 }150 151 fd = open(path, O_RDONLY);152 if (fd > 0) {153 close(fd);154 return RM_FILE;155 }156 157 return RM_BOGUS;158 97 } 159 98 … … 215 154 216 155 return ret + 1; 156 } 157 158 static unsigned int rm_single(const char *path) 159 { 160 if (unlink(path)) { 161 cli_error(CL_EFAIL, "rm: could not remove file %s", path); 162 return 1; 163 } 164 return 0; 165 } 166 167 static unsigned int rm_scope(const char *path) 168 { 169 int fd; 170 DIR *dirp; 171 172 dirp = opendir(path); 173 if (dirp) { 174 closedir(dirp); 175 return RM_DIR; 176 } 177 178 fd = open(path, O_RDONLY); 179 if (fd > 0) { 180 close(fd); 181 return RM_FILE; 182 } 183 184 return RM_BOGUS; 217 185 } 218 186 -
uspace/app/bdsh/cmds/modules/rm/rm.h
r8ad5470 r15b794d 2 2 #define RM_H 3 3 4 /* Return values for rm_scope() */ 5 #define RM_BOGUS 0 6 #define RM_FILE 1 7 #define RM_DIR 2 8 9 /* Flags for rm_update() */ 10 #define _RM_ENTRY 0 11 #define _RM_ADVANCE 1 12 #define _RM_REWIND 2 13 #define _RM_EXIT 3 14 15 /* A simple job structure */ 16 typedef struct { 17 /* Options set at run time */ 18 unsigned int force; /* -f option */ 19 unsigned int recursive; /* -r option */ 20 unsigned int safe; /* -s option */ 21 22 /* Keeps track of the job in progress */ 23 int advance; /* How far deep we've gone since entering */ 24 DIR *entry; /* Entry point to the tree being removed */ 25 char *owd; /* Where we were when we invoked rm */ 26 char *cwd; /* Current directory being transversed */ 27 char *nwd; /* Next directory to be transversed */ 28 29 /* Counters */ 30 int f_removed; /* Number of files unlinked */ 31 int d_removed; /* Number of directories unlinked */ 32 } rm_job_t; 33 34 4 35 /* Prototypes for the rm command, excluding entry points */ 36 static unsigned int rm_start(rm_job_t *); 37 static void rm_end(rm_job_t *rm); 38 static unsigned int rm_recursive(const char *); 39 static unsigned int rm_single(const char *); 40 static unsigned int rm_scope(const char *); 5 41 6 42 #endif /* RM_H */ -
uspace/app/bdsh/cmds/modules/sleep/sleep.c
r8ad5470 r15b794d 27 27 */ 28 28 29 #include <errno.h>30 29 #include <stdio.h> 31 30 #include <stdlib.h> 32 #include <unistd.h>33 31 #include "config.h" 34 32 #include "util.h" … … 43 41 void help_cmd_sleep(unsigned int level) 44 42 { 45 if (level == HELP_SHORT) { 46 printf("`%s' pauses for a given time interval\n", cmdname); 47 } else { 48 help_cmd_sleep(HELP_SHORT); 49 printf( 50 "Usage: %s <duration>\n" 51 "The duration is a decimal number of seconds.\n", 52 cmdname); 53 } 54 43 printf("This is the %s help for '%s'.\n", 44 level ? EXT_HELP : SHORT_HELP, cmdname); 55 45 return; 56 }57 58 /** Convert string containing decimal seconds to useconds_t.59 *60 * @param nptr Pointer to string.61 * @param result Result of the conversion.62 * @return EOK if conversion was successful.63 */64 static int decimal_to_useconds(const char *nptr, useconds_t *result)65 {66 int ret;67 uint64_t whole_seconds;68 uint64_t frac_seconds;69 char *endptr;70 71 /* Check for whole seconds */72 if (*nptr == '.') {73 whole_seconds = 0;74 endptr = (char *)nptr;75 } else {76 ret = str_uint64_t(nptr, &endptr, 10, false, &whole_seconds);77 if (ret != EOK)78 return ret;79 }80 81 /* Check for fractional seconds */82 if (*endptr == '\0') {83 frac_seconds = 0;84 } else if (*endptr == '.' && endptr[1] == '\0') {85 frac_seconds = 0;86 } else if (*endptr == '.') {87 nptr = endptr + 1;88 ret = str_uint64_t(nptr, &endptr, 10, true, &frac_seconds);89 if (ret != EOK)90 return ret;91 92 int ndigits = endptr - nptr;93 for (; ndigits < 6; ndigits++)94 frac_seconds *= 10;95 for (; ndigits > 6; ndigits--)96 frac_seconds /= 10;97 } else {98 return EINVAL;99 }100 101 /* Check for overflow */102 useconds_t total = whole_seconds * 1000000 + frac_seconds;103 if (total / 1000000 != whole_seconds)104 return EOVERFLOW;105 106 *result = total;107 108 return EOK;109 46 } 110 47 … … 112 49 int cmd_sleep(char **argv) 113 50 { 114 int ret;115 51 unsigned int argc; 116 u seconds_t duration;52 unsigned int i; 117 53 118 54 /* Count the arguments */ 119 argc = cli_count_args(argv);55 for (argc = 0; argv[argc] != NULL; argc ++); 120 56 121 if (argc != 2) { 122 printf("%s - incorrect number of arguments. Try `help %s'\n", 123 cmdname, cmdname); 124 return CMD_FAILURE; 57 printf("%s %s\n", TEST_ANNOUNCE, cmdname); 58 printf("%d arguments passed to %s", argc - 1, cmdname); 59 60 if (argc < 2) { 61 printf("\n"); 62 return CMD_SUCCESS; 125 63 } 126 64 127 ret = decimal_to_useconds(argv[1], &duration); 128 if (ret != EOK) { 129 printf("%s - invalid duration.\n", cmdname); 130 return CMD_FAILURE; 131 } 132 133 (void) usleep(duration); 65 printf(":\n"); 66 for (i = 1; i < argc; i++) 67 printf("[%d] -> %s\n", i, argv[i]); 134 68 135 69 return CMD_SUCCESS; -
uspace/app/edit/edit.c
r8ad5470 r15b794d 118 118 static void key_handle_ctrl(kbd_event_t const *ev); 119 119 static void key_handle_shift(kbd_event_t const *ev); 120 static void key_handle_shift_ctrl(kbd_event_t const *ev);121 120 static void key_handle_movement(unsigned int key, bool shift); 122 121 … … 140 139 static void caret_update(void); 141 140 static void caret_move(int drow, int dcolumn, enum dir_spec align_dir); 142 static void caret_move_word_left(void);143 static void caret_move_word_right(void);144 141 145 142 static bool selection_active(void); 146 143 static void selection_sel_all(void); 147 static void selection_sel_range(spt_t pa, spt_t pb);148 static void selection_sel_prev_word(void);149 static void selection_sel_next_word(void);150 144 static void selection_get_points(spt_t *pa, spt_t *pb); 151 145 static void selection_delete(void); … … 155 149 static void pt_get_sof(spt_t *pt); 156 150 static void pt_get_eof(spt_t *pt); 157 static void pt_get_sol(spt_t *cpt, spt_t *spt);158 static void pt_get_eol(spt_t *cpt, spt_t *ept);159 static bool pt_is_word_beginning(spt_t *pt);160 static bool pt_is_delimiter(spt_t *pt);161 static bool pt_is_punctuation(spt_t *pt);162 151 static int tag_cmp(tag_t const *a, tag_t const *b); 163 152 static int spt_cmp(spt_t const *a, spt_t const *b); … … 243 232 (ev.mods & KM_SHIFT) != 0) { 244 233 key_handle_shift(&ev); 245 } else if (((ev.mods & KM_ALT) == 0) &&246 ((ev.mods & KM_CTRL) != 0) &&247 (ev.mods & KM_SHIFT) != 0) {248 key_handle_shift_ctrl(&ev);249 234 } else if ((ev.mods & (KM_CTRL | KM_ALT | KM_SHIFT)) == 0) { 250 235 key_handle_unmod(&ev); … … 391 376 case KC_A: 392 377 selection_sel_all(); 393 break;394 case KC_W:395 if (selection_active())396 break;397 selection_sel_prev_word();398 selection_delete();399 break;400 case KC_RIGHT:401 caret_move_word_right();402 break;403 case KC_LEFT:404 caret_move_word_left();405 break;406 default:407 break;408 }409 }410 411 static void key_handle_shift_ctrl(kbd_event_t const *ev)412 {413 switch(ev->key) {414 case KC_LEFT:415 selection_sel_prev_word();416 break;417 case KC_RIGHT:418 selection_sel_next_word();419 378 break; 420 379 default: … … 1011 970 /* Clamp coordinates. */ 1012 971 if (drow < 0 && coord.row < 1) coord.row = 1; 1013 if (dcolumn < 0 && coord.column < 1) { 1014 if (coord.row < 2) 1015 coord.column = 1; 1016 else { 1017 coord.row--; 1018 sheet_get_row_width(&doc.sh, coord.row, &coord.column); 1019 } 1020 } 972 if (dcolumn < 0 && coord.column < 1) coord.column = 1; 1021 973 if (drow > 0) { 1022 974 sheet_get_num_rows(&doc.sh, &num_rows); … … 1046 998 } 1047 999 1048 static void caret_move_word_left(void)1049 {1050 spt_t pt;1051 1052 do {1053 caret_move(0, -1, dir_before);1054 1055 tag_get_pt(&pane.caret_pos, &pt);1056 1057 sheet_remove_tag(&doc.sh, &pane.sel_start);1058 sheet_place_tag(&doc.sh, &pt, &pane.sel_start);1059 } while (!pt_is_word_beginning(&pt));1060 1061 pane.rflags |= REDRAW_TEXT;1062 }1063 1064 static void caret_move_word_right(void)1065 {1066 spt_t pt;1067 1068 do {1069 caret_move(0, 0, dir_after);1070 1071 tag_get_pt(&pane.caret_pos, &pt);1072 1073 sheet_remove_tag(&doc.sh, &pane.sel_start);1074 sheet_place_tag(&doc.sh, &pt, &pane.sel_start);1075 } while (!pt_is_word_beginning(&pt));1076 1077 pane.rflags |= REDRAW_TEXT;1078 }1079 1080 1000 /** Check for non-empty selection. */ 1081 1001 static bool selection_active(void) … … 1125 1045 } 1126 1046 1127 /** Select all text in the editor */1128 1047 static void selection_sel_all(void) 1129 1048 { … … 1132 1051 pt_get_sof(&spt); 1133 1052 pt_get_eof(&ept); 1134 1135 selection_sel_range(spt, ept);1136 }1137 1138 /** Select select all text in a given range with the given direction */1139 static void selection_sel_range(spt_t pa, spt_t pb)1140 {1141 1053 sheet_remove_tag(&doc.sh, &pane.sel_start); 1142 sheet_place_tag(&doc.sh, & pa, &pane.sel_start);1054 sheet_place_tag(&doc.sh, &spt, &pane.sel_start); 1143 1055 sheet_remove_tag(&doc.sh, &pane.caret_pos); 1144 sheet_place_tag(&doc.sh, & pb, &pane.caret_pos);1056 sheet_place_tag(&doc.sh, &ept, &pane.caret_pos); 1145 1057 1146 1058 pane.rflags |= REDRAW_TEXT; 1147 1059 caret_update(); 1148 }1149 1150 /** Add the previous word to the selection */1151 static void selection_sel_prev_word(void)1152 {1153 spt_t cpt, wpt, spt, ept;1154 1155 selection_get_points(&spt, &ept);1156 1157 tag_get_pt(&pane.caret_pos, &cpt);1158 caret_move_word_left();1159 tag_get_pt(&pane.caret_pos, &wpt);1160 1161 if (spt_cmp(&spt, &cpt) == 0)1162 selection_sel_range(ept, wpt);1163 else1164 selection_sel_range(spt, wpt);1165 }1166 1167 /** Add the next word to the selection */1168 static void selection_sel_next_word(void)1169 {1170 spt_t cpt, wpt, spt, ept;1171 1172 selection_get_points(&spt, &ept);1173 1174 tag_get_pt(&pane.caret_pos, &cpt);1175 caret_move_word_right();1176 tag_get_pt(&pane.caret_pos, &wpt);1177 1178 if (spt_cmp(&ept, &cpt) == 0)1179 selection_sel_range(spt, wpt);1180 else1181 selection_sel_range(ept, wpt);1182 1060 } 1183 1061 … … 1239 1117 1240 1118 sheet_get_cell_pt(&doc.sh, &coord, dir_after, pt); 1241 }1242 1243 /** Get start-of-line s-point for given s-point cpt */1244 static void pt_get_sol(spt_t *cpt, spt_t *spt)1245 {1246 coord_t coord;1247 1248 spt_get_coord(cpt, &coord);1249 coord.column = 1;1250 1251 sheet_get_cell_pt(&doc.sh, &coord, dir_before, spt);1252 }1253 1254 /** Get end-of-line s-point for given s-point cpt */1255 static void pt_get_eol(spt_t *cpt, spt_t *ept)1256 {1257 coord_t coord;1258 int row_width;1259 1260 spt_get_coord(cpt, &coord);1261 sheet_get_row_width(&doc.sh, coord.row, &row_width);1262 coord.column = row_width - 1;1263 1264 sheet_get_cell_pt(&doc.sh, &coord, dir_after, ept);1265 }1266 1267 /** Check whether the spt is at a beginning of a word */1268 static bool pt_is_word_beginning(spt_t *pt)1269 {1270 spt_t lp, sfp, efp, slp, elp;1271 coord_t coord;1272 1273 pt_get_sof(&sfp);1274 pt_get_eof(&efp);1275 pt_get_sol(pt, &slp);1276 pt_get_eol(pt, &elp);1277 1278 /* the spt is at the beginning or end of the file or line */1279 if ((spt_cmp(&sfp, pt) == 0) || (spt_cmp(&efp, pt) == 0)1280 || (spt_cmp(&slp, pt) == 0) || (spt_cmp(&elp, pt) == 0))1281 return true;1282 1283 /* the spt is a delimiter */1284 if (pt_is_delimiter(pt))1285 return false;1286 1287 spt_get_coord(pt, &coord);1288 1289 coord.column -= 1;1290 sheet_get_cell_pt(&doc.sh, &coord, dir_before, &lp);1291 1292 return pt_is_delimiter(&lp)1293 || (pt_is_punctuation(pt) && !pt_is_punctuation(&lp))1294 || (pt_is_punctuation(&lp) && !pt_is_punctuation(pt));1295 }1296 1297 static wchar_t get_first_wchar(const char *str)1298 {1299 size_t offset = 0;1300 return str_decode(str, &offset, str_size(str));1301 }1302 1303 static bool pt_is_delimiter(spt_t *pt)1304 {1305 spt_t rp;1306 coord_t coord;1307 char *ch = NULL;1308 1309 spt_get_coord(pt, &coord);1310 1311 coord.column += 1;1312 sheet_get_cell_pt(&doc.sh, &coord, dir_after, &rp);1313 1314 ch = range_get_str(pt, &rp);1315 if (ch == NULL)1316 return false;1317 1318 wchar_t first_char = get_first_wchar(ch);1319 switch(first_char) {1320 case ' ':1321 case '\t':1322 case '\n':1323 return true;1324 default:1325 return false;1326 }1327 }1328 1329 static bool pt_is_punctuation(spt_t *pt)1330 {1331 spt_t rp;1332 coord_t coord;1333 char *ch = NULL;1334 1335 spt_get_coord(pt, &coord);1336 1337 coord.column += 1;1338 sheet_get_cell_pt(&doc.sh, &coord, dir_after, &rp);1339 1340 ch = range_get_str(pt, &rp);1341 if (ch == NULL)1342 return false;1343 1344 wchar_t first_char = get_first_wchar(ch);1345 switch(first_char) {1346 case ',':1347 case '.':1348 case ';':1349 case ':':1350 case '/':1351 case '?':1352 case '\\':1353 case '|':1354 case '_':1355 case '+':1356 case '-':1357 case '*':1358 case '=':1359 case '<':1360 case '>':1361 return true;1362 default:1363 return false;1364 }1365 1119 } 1366 1120 -
uspace/app/edit/sheet.c
r8ad5470 r15b794d 264 264 sheet_get_cell_pt(sh, &coord, dir_before, &pt); 265 265 spt_get_coord(&pt, &coord); 266 *length = coord.column ;266 *length = coord.column - 1; 267 267 } 268 268 -
uspace/app/init/init.c
r8ad5470 r15b794d 307 307 spawn("/srv/loopip"); 308 308 spawn("/srv/ethip"); 309 spawn("/srv/inet srv");309 spawn("/srv/inet"); 310 310 spawn("/srv/tcp"); 311 311 spawn("/srv/udp"); -
uspace/app/killall/killall.c
r8ad5470 r15b794d 36 36 #include <errno.h> 37 37 #include <stdio.h> 38 #include <unistd.h>39 38 #include <task.h> 40 39 #include <stats.h> -
uspace/app/nettest1/nettest1.c
r8ad5470 r15b794d 40 40 #include <malloc.h> 41 41 #include <stdio.h> 42 #include <unistd.h>43 42 #include <str.h> 44 43 #include <task.h> -
uspace/app/nettest2/nettest2.c
r8ad5470 r15b794d 40 40 #include <malloc.h> 41 41 #include <stdio.h> 42 #include <unistd.h>43 42 #include <str.h> 44 43 #include <task.h> -
uspace/app/sbi/src/mytypes.h
r8ad5470 r15b794d 51 51 /** Error return codes. */ 52 52 #include <errno.h> 53 /** We need NULL defined. */54 #include <unistd.h>55 53 #define EOK 0 56 54 -
uspace/app/sbi/src/stype.c
r8ad5470 r15b794d 652 652 assert(iface_ti->tic == tic_tobject); 653 653 iface = iface_ti->u.tobject->csi; 654 assert(iface->cc = =csi_interface);654 assert(iface->cc = csi_interface); 655 655 656 656 #ifdef DEBUG_TYPE_TRACE -
uspace/app/sysinfo/sysinfo.c
r8ad5470 r15b794d 36 36 #include <errno.h> 37 37 #include <stdio.h> 38 #include <unistd.h>39 38 #include <sysinfo.h> 40 39 #include <malloc.h> -
uspace/app/websrv/websrv.c
r8ad5470 r15b794d 1 1 /* 2 * Copyright (c) 201 2Jiri Svoboda2 * Copyright (c) 2011 Jiri Svoboda 3 3 * All rights reserved. 4 4 * … … 36 36 #include <bool.h> 37 37 #include <errno.h> 38 #include <assert.h>39 38 #include <stdio.h> 40 39 #include <sys/types.h> … … 42 41 #include <stdlib.h> 43 42 #include <fcntl.h> 44 #include <task.h>45 43 46 44 #include <net/in.h> … … 73 71 74 72 static char fbuf[BUFFER_SIZE]; 75 76 static bool verbose = false;77 73 78 74 /** Responses to send to client. */ … … 191 187 size_t response_size = str_size(msg); 192 188 193 if (verbose) 194 fprintf(stderr, "Sending response\n"); 195 189 fprintf(stderr, "Sending response\n"); 196 190 ssize_t rc = send(conn_sd, (void *) msg, response_size, 0); 197 191 if (rc < 0) { … … 257 251 } 258 252 259 if (verbose) 260 fprintf(stderr, "Request: %s", lbuf); 253 fprintf(stderr, "Request: %s", lbuf); 261 254 262 255 if (str_lcmp(lbuf, "GET ", 4) != 0) { … … 273 266 274 267 *end_uri = '\0'; 275 if (verbose) 276 fprintf(stderr, "Requested URI: %s\n", uri); 268 fprintf(stderr, "Requested URI: %s\n", uri); 277 269 278 270 if (!uri_is_valid(uri)) { … … 295 287 "\n" 296 288 "-h | --help\n" 297 "\tShow this application help.\n" 298 "-v | --verbose\n" 299 "\tVerbose mode\n"); 289 "\tShow this application help.\n"); 300 290 } 301 291 … … 316 306 317 307 port = (uint16_t) value; 318 break;319 case 'v':320 verbose = true;321 308 break; 322 309 /* Long options with double dash */ … … 331 318 332 319 port = (uint16_t) value; 333 } else if (str_cmp(argv[*index] +2, "verbose") == 0) {334 verbose = true;335 320 } else { 336 321 usage(); … … 373 358 } 374 359 375 printf("%s: HelenOS web server\n", NAME); 376 377 if (verbose) 378 fprintf(stderr, "Creating socket\n"); 360 fprintf(stderr, "Creating socket\n"); 379 361 380 362 int listen_sd = socket(PF_INET, SOCK_STREAM, 0); … … 398 380 } 399 381 400 fprintf(stderr, "%s: Listening for connections at port %" PRIu16 "\n", 401 NAME, port); 402 403 task_retval(0); 404 382 fprintf(stderr, "Listening for connections at port %" PRIu16 "\n", 383 port); 405 384 while (true) { 406 385 struct sockaddr_in raddr; … … 414 393 } 415 394 416 if (verbose) { 417 fprintf(stderr, "Connection accepted (sd=%d), " 418 "waiting for request\n", conn_sd); 419 } 395 fprintf(stderr, "Connection accepted (sd=%d), " 396 "waiting for request\n", conn_sd); 420 397 421 398 rbuf_out = 0; … … 435 412 } 436 413 437 if (verbose) 438 fprintf(stderr, "Connection closed\n"); 414 fprintf(stderr, "Connection closed\n"); 439 415 } 440 416 -
uspace/drv/bus/usb/ohci/utils/malloc32.h
r8ad5470 r15b794d 37 37 #include <assert.h> 38 38 #include <malloc.h> 39 #include <unistd.h>40 39 #include <errno.h> 41 40 #include <mem.h> -
uspace/drv/bus/usb/uhci/utils/malloc32.h
r8ad5470 r15b794d 36 36 37 37 #include <assert.h> 38 #include <unistd.h>39 38 #include <errno.h> 40 39 #include <malloc.h> -
uspace/lib/c/generic/stacktrace.c
r8ad5470 r15b794d 38 38 #include <sys/types.h> 39 39 #include <errno.h> 40 #include <unistd.h>41 40 42 41 static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data); -
uspace/lib/c/generic/stats.c
r8ad5470 r15b794d 40 40 #include <inttypes.h> 41 41 #include <malloc.h> 42 #include <unistd.h>43 42 44 43 #define SYSINFO_STATS_MAX_PATH 64 -
uspace/lib/c/generic/sysinfo.c
r8ad5470 r15b794d 39 39 #include <malloc.h> 40 40 #include <bool.h> 41 #include <unistd.h>42 41 43 42 /** Get sysinfo keys size -
uspace/lib/c/generic/time.c
r8ad5470 r15b794d 43 43 #include <ddi.h> 44 44 #include <libc.h> 45 #include <unistd.h>46 45 47 46 /** Pointer to kernel shared variables with time */ -
uspace/lib/c/include/errno.h
r8ad5470 r15b794d 37 37 38 38 #include <abi/errno.h> 39 #include <fibril.h> 39 40 40 41 #define errno (*(__errno())) -
uspace/lib/c/include/stdarg.h
r8ad5470 r15b794d 43 43 #define va_arg(ap, type) __builtin_va_arg(ap, type) 44 44 #define va_end(ap) __builtin_va_end(ap) 45 #define va_copy(dst, src) __builtin_va_copy(dst, src)46 45 47 46 #endif -
uspace/lib/c/include/stdio.h
r8ad5470 r15b794d 39 39 #include <stdarg.h> 40 40 #include <str.h> 41 #include <adt/list.h> 41 42 42 43 #ifndef NVERIFY_PRINTF -
uspace/lib/c/include/unistd.h
r8ad5470 r15b794d 58 58 #define getpagesize() (PAGE_SIZE) 59 59 60 extern int dup2(int , int);60 extern int dup2(int oldfd, int newfd); 61 61 62 62 extern ssize_t write(int, const void *, size_t); … … 73 73 extern int unlink(const char *); 74 74 75 extern char *getcwd(char * , size_t);75 extern char *getcwd(char *buf, size_t); 76 76 extern int rmdir(const char *); 77 77 extern int chdir(const char *); -
uspace/lib/clui/tinput.h
r8ad5470 r15b794d 37 37 #define LIBCLUI_TINPUT_H_ 38 38 39 #include <adt/list.h> 40 #include <async.h> 39 41 #include <inttypes.h> 40 42 #include <io/console.h> -
uspace/lib/drv/generic/logbuf.c
r8ad5470 r15b794d 35 35 #include <ddf/log.h> 36 36 #include <assert.h> 37 #include <unistd.h>38 37 39 38 /** Formatting string for printing number of not-printed items. */ -
uspace/lib/drv/include/ddf/interrupt.h
r8ad5470 r15b794d 36 36 #define DDF_INTERRUPT_H_ 37 37 38 #include <libarch/common.h>39 #include <libarch/types.h>40 38 #include <abi/ddi/irq.h> 41 39 #include <adt/list.h> -
uspace/lib/posix/Makefile
r8ad5470 r15b794d 43 43 fcntl.c \ 44 44 fnmatch.c \ 45 getopt.c \46 45 locale.c \ 47 46 math.c \ -
uspace/lib/posix/errno.h
r8ad5470 r15b794d 66 66 #undef errno 67 67 #define errno (*__posix_errno()) 68 69 #include "unistd.h"70 68 71 69 extern int *__posix_errno(void); -
uspace/lib/posix/pwd.c
r8ad5470 r15b794d 38 38 #include "string.h" 39 39 #include "errno.h" 40 #include "assert.h"41 40 42 41 static bool entry_read = false; -
uspace/lib/posix/stdbool.h
r8ad5470 r15b794d 37 37 38 38 #ifdef LIBC_BOOL_H_ 39 #if (!defined(POSIX_STDIO_H_)) \ 40 && (!defined(POSIX_STDLIB_H_)) \ 41 && (!defined(POSIX_STRING_H_)) 42 #error "You can't include bool.h and stdbool.h at the same time." 39 #error "You can't include bool.h and stdbool.h at the same time." 43 40 #endif 44 #endif45 46 41 #define LIBC_BOOL_H_ 47 42 -
uspace/lib/posix/stdio.h
r8ad5470 r15b794d 37 37 #define POSIX_STDIO_H_ 38 38 39 #include "stddef.h"40 #include "unistd.h"41 39 #include "libc/stdio.h" 42 40 #include "sys/types.h" -
uspace/lib/posix/time.c
r8ad5470 r15b794d 45 45 #include "errno.h" 46 46 #include "signal.h" 47 #include "assert.h"48 47 49 48 #include "libc/malloc.h" -
uspace/lib/posix/unistd.c
r8ad5470 r15b794d 49 49 /* Array of environment variable strings (NAME=VALUE). */ 50 50 char **posix_environ = NULL; 51 char *posix_optarg;52 51 53 52 /** -
uspace/lib/posix/unistd.h
r8ad5470 r15b794d 43 43 #define _exit exit 44 44 45 extern char *posix_optarg; 45 /* Option Arguments */ 46 extern char *optarg; 46 47 extern int optind, opterr, optopt; 47 extern int posix_getopt(int, char * const [], const char *);48 extern int getopt(int, char * const [], const char *); 48 49 49 50 /* Environment */ … … 143 144 144 145 #ifndef LIBPOSIX_INTERNAL 145 #define getopt posix_getopt146 #define optarg posix_optarg147 148 146 #define environ posix_environ 149 147 -
uspace/srv/fs/fat/fat_dentry.c
r8ad5470 r15b794d 43 43 #include <byteorder.h> 44 44 #include <assert.h> 45 #include <unistd.h>46 45 47 46 /** Compare path component with the name read from the dentry.
Note:
See TracChangeset
for help on using the changeset viewer.