Changeset ff381a7 in mainline for uspace/app
- Timestamp:
- 2015-11-02T20:54:19Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d8513177
- Parents:
- 3feeab2 (diff), 5265eea4 (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:
-
- 45 edited
-
barber/barber.c (modified) (1 diff)
-
bdsh/cmds/builtins/cd/cd.c (modified) (1 diff)
-
bdsh/cmds/modules/cat/cat.c (modified) (1 diff)
-
bdsh/cmds/modules/cp/cp.c (modified) (8 diffs)
-
bdsh/cmds/modules/ls/ls.c (modified) (4 diffs)
-
bdsh/cmds/modules/mkdir/mkdir.c (modified) (5 diffs)
-
bdsh/cmds/modules/mkfile/mkfile.c (modified) (4 diffs)
-
bdsh/cmds/modules/mount/mount.c (modified) (2 diffs)
-
bdsh/cmds/modules/mv/mv.c (modified) (1 diff)
-
bdsh/cmds/modules/pwd/pwd.c (modified) (1 diff)
-
bdsh/cmds/modules/rm/rm.c (modified) (4 diffs)
-
bdsh/cmds/modules/touch/touch.c (modified) (1 diff)
-
bdsh/cmds/modules/unmount/unmount.c (modified) (1 diff)
-
bdsh/compl.c (modified) (1 diff)
-
bdsh/config.h (modified) (1 diff)
-
bdsh/errors.h (modified) (1 diff)
-
bdsh/exec.c (modified) (2 diffs)
-
blkdump/blkdump.c (modified) (1 diff)
-
date/date.c (modified) (1 diff)
-
df/df.c (modified) (1 diff)
-
hdisk/hdisk.c (modified) (1 diff)
-
init/init.c (modified) (4 diffs)
-
mixerctl/mixerctl.c (modified) (1 diff)
-
mkbd/main.c (modified) (1 diff)
-
mkexfat/mkexfat.c (modified) (1 diff)
-
mkfat/mkfat.c (modified) (1 diff)
-
mkmfs/mkmfs.c (modified) (1 diff)
-
nic/nic.c (modified) (2 diffs)
-
sportdmp/sportdmp.c (modified) (1 diff)
-
taskdump/elf_core.c (modified) (6 diffs)
-
taskdump/symtab.c (modified) (3 diffs)
-
tester/float/float2.c (modified) (5 diffs)
-
tester/hw/misc/virtchar1.c (modified) (2 diffs)
-
tester/hw/serial/serial1.c (modified) (1 diff)
-
tester/mm/common.c (modified) (1 diff)
-
tester/tester.h (modified) (1 diff)
-
tester/vfs/vfs1.c (modified) (3 diffs)
-
tetris/scores.c (modified) (1 diff)
-
trace/errors.c (modified) (1 diff)
-
trace/ipcp.c (modified) (1 diff)
-
trace/trace.c (modified) (2 diffs)
-
untar/main.c (modified) (1 diff)
-
viewer/viewer.c (modified) (2 diffs)
-
vuhid/device.c (modified) (1 diff)
-
wifi_supplicant/wifi_supplicant.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/barber/barber.c
r3feeab2 rff381a7 267 267 link_initialize(&dev->link); 268 268 dev->svc_id = svcs[i]; 269 dev->sess = loc_service_connect( EXCHANGE_SERIALIZE, svcs[i], 0);269 dev->sess = loc_service_connect(svcs[i], INTERFACE_DDF, 0); 270 270 271 271 list_append(&dev->link, &led_devs); -
uspace/app/bdsh/cmds/builtins/cd/cd.c
r3feeab2 rff381a7 57 57 previous_directory_set = true; 58 58 59 int rc = chdir(new_dir); 60 if (rc != EOK) { 61 return rc; 62 } 59 if (chdir(new_dir) != 0) 60 return errno; 63 61 64 62 str_cpy(previous_directory, PATH_MAX, previous_directory_tmp); -
uspace/app/bdsh/cmds/modules/cat/cat.c
r3feeab2 rff381a7 244 244 245 245 bytes = read(fd, buff + copied_bytes, bytes_to_read); 246 bytes += copied_bytes;247 246 copied_bytes = 0; 248 247 -
uspace/app/bdsh/cmds/modules/cp/cp.c
r3feeab2 rff381a7 27 27 */ 28 28 29 #include <errno.h> 29 30 #include <stdio.h> 30 31 #include <stdlib.h> … … 84 85 int r = stat(path, &s); 85 86 86 if (r )87 if (r != 0) 87 88 return TYPE_NONE; 88 89 else if (s.is_directory) … … 234 235 */ 235 236 if (force && !interactive) { 236 if (unlink(dest_path) ) {237 if (unlink(dest_path) != 0) { 237 238 printf("Unable to remove %s\n", 238 239 dest_path); … … 245 246 if (overwrite) { 246 247 printf("Overwriting file: %s\n", dest_path); 247 if (unlink(dest_path) ) {248 if (unlink(dest_path) != 0) { 248 249 printf("Unable to remove %s\n", dest_path); 249 250 goto exit; … … 294 295 merge_paths(dest_path, PATH_MAX, src_dirname); 295 296 296 if (mkdir(dest_path, 0) == -1) {297 if (mkdir(dest_path, 0) != 0) { 297 298 printf("Unable to create " 298 299 "dest directory %s\n", dest_path); … … 308 309 * e.g. cp -r /src /data/new_dir_src 309 310 */ 310 if (mkdir(dest_path, 0) ) {311 if (mkdir(dest_path, 0) != 0) { 311 312 printf("Unable to create " 312 313 "dest directory %s\n", dest_path); … … 405 406 } 406 407 407 while ((bytes = read _all(fd1, buff, blen)) > 0) {408 if ((bytes = write _all(fd2, buff, bytes)) < 0)408 while ((bytes = read(fd1, buff, blen)) > 0) { 409 if ((bytes = write(fd2, buff, bytes)) < 0) 409 410 break; 410 411 copied += bytes; … … 412 413 413 414 if (bytes < 0) { 414 printf("\nError copying %s, (%d)\n", src, bytes);415 printf("\nError copying %s, (%d)\n", src, errno); 415 416 copied = bytes; 416 417 } -
uspace/app/bdsh/cmds/modules/ls/ls.c
r3feeab2 rff381a7 31 31 * As more stuff is completed and exposed in libc, this will improve */ 32 32 33 #include <errno.h> 33 34 #include <stdio.h> 34 35 #include <stdlib.h> … … 187 188 if (rc != 0) { 188 189 printf("ls: skipping bogus node %s\n", buff); 189 printf(" rc=%d\n", rc);190 printf("error=%d\n", errno); 190 191 goto out; 191 192 } … … 314 315 static unsigned int ls_scope(const char *path, struct dir_elem_t *de) 315 316 { 316 if (stat(path, &de->s) ) {317 if (stat(path, &de->s) != 0) { 317 318 cli_error(CL_ENOENT, "%s", path); 318 319 return LS_BOGUS; … … 376 377 } 377 378 } 378 379 379 380 argc -= optind; 380 381 381 382 de.name = (char *) malloc(PATH_MAX); 382 383 if (!de.name) { 383 cli_error(CL_ENOMEM, "%s: ", cmdname);384 cli_error(CL_ENOMEM, "%s: Out of memory", cmdname); 384 385 return CMD_FAILURE; 385 386 } 386 387 memset(de.name, 0, PATH_MAX); 387 388 if (argc == 0) 389 getcwd(de.name, PATH_MAX); 390 else 388 389 if (argc == 0) { 390 if (getcwd(de.name, PATH_MAX) == NULL) { 391 cli_error(CL_EFAIL, "%s: Failed determining working " 392 "directory", cmdname); 393 return CMD_FAILURE; 394 } 395 } else { 391 396 str_cpy(de.name, PATH_MAX, argv[optind]); 397 } 392 398 393 399 scope = ls_scope(de.name, &de); -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
r3feeab2 rff381a7 89 89 { 90 90 /* Ensure we would always work with absolute and canonified path. */ 91 char *path = absolutize(user_path, NULL);91 char *path = vfs_absolutize(user_path, NULL); 92 92 if (path == NULL) { 93 93 cli_error(CL_ENOMEM, "%s: path too big?", cmdname); … … 95 95 } 96 96 97 int rc;98 97 int ret = 0; 99 98 100 99 if (!create_parents) { 101 rc = mkdir(path, 0); 102 if (rc != EOK) { 100 if (mkdir(path, 0) != 0) { 103 101 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 104 cmdname, path, str_error( rc));102 cmdname, path, str_error(errno)); 105 103 ret = 1; 106 104 } … … 137 135 char slash_char = path[prev_off]; 138 136 path[prev_off] = 0; 139 rc = mkdir(path, 0); 140 if (rc == EEXIST) { 141 rc = EOK; 142 } 143 144 if (rc != EOK) { 137 138 if (mkdir(path, 0) != 0 && errno != EEXIST) { 145 139 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 146 cmdname, path, str_error( rc));140 cmdname, path, str_error(errno)); 147 141 ret = 1; 148 142 goto leave; … … 152 146 } 153 147 /* Create the final directory. */ 154 rc = mkdir(path, 0); 155 if (rc != EOK) { 148 if (mkdir(path, 0) != 0) { 156 149 cli_error(CL_EFAIL, "%s: could not create %s (%s)", 157 cmdname, path, str_error( rc));150 cmdname, path, str_error(errno)); 158 151 ret = 1; 159 152 } … … 214 207 215 208 if (follow && (argv[optind] != NULL)) { 216 chdir(argv[optind]); 209 if (chdir(argv[optind]) != 0) 210 printf("%s: Error switching to directory.", cmdname); 217 211 } 218 212 -
uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
r3feeab2 rff381a7 27 27 */ 28 28 29 #include <errno.h> 29 30 #include <stdio.h> 30 31 #include <stdlib.h> … … 166 167 167 168 if ((rc2 = lseek(fd, file_size - 1, SEEK_SET)) < 0) 168 goto e xit;169 goto error; 169 170 170 171 rc2 = write(fd, &byte, sizeof(char)); 171 goto exit; 172 if (rc2 < 0) 173 goto error; 174 return CMD_SUCCESS; 172 175 } 173 176 … … 183 186 rc = write(fd, buffer, to_write); 184 187 if (rc <= 0) { 185 printf("%s: Error writing file (% zd).\n", cmdname, rc);188 printf("%s: Error writing file (%d).\n", cmdname, errno); 186 189 close(fd); 187 190 return CMD_FAILURE; … … 191 194 192 195 free(buffer); 193 exit: 194 rc = close(fd); 195 196 if (rc != 0 || rc2 < 0) { 197 printf("%s: Error writing file (%zd).\n", cmdname, rc); 198 return CMD_FAILURE; 199 } 196 197 if (close(fd) < 0) 198 goto error; 200 199 201 200 return CMD_SUCCESS; 201 error: 202 printf("%s: Error writing file (%d).\n", cmdname, errno); 203 return CMD_FAILURE; 202 204 } -
uspace/app/bdsh/cmds/modules/mount/mount.c
r3feeab2 rff381a7 72 72 int rc; 73 73 74 get_mtab_list(&mtab_list);74 vfs_get_mtab_list(&mtab_list); 75 75 76 76 list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) { … … 150 150 mopts = t_argv[4]; 151 151 152 rc = mount(t_argv[1], t_argv[2], dev, mopts, 0, instance);152 rc = vfs_mount(t_argv[1], t_argv[2], dev, mopts, 0, instance); 153 153 if (rc != EOK) { 154 154 printf("Unable to mount %s filesystem to %s on %s (rc=%d)\n", -
uspace/app/bdsh/cmds/modules/mv/mv.c
r3feeab2 rff381a7 60 60 61 61 rc = rename(argv[1], argv[2]); 62 if (rc != EOK) {63 printf("Unable to rename %s to %s ( rc=%d)\n",64 argv[1], argv[2], rc);62 if (rc != 0) { 63 printf("Unable to rename %s to %s (error=%d)\n", 64 argv[1], argv[2], errno); 65 65 return CMD_FAILURE; 66 66 } -
uspace/app/bdsh/cmds/modules/pwd/pwd.c
r3feeab2 rff381a7 56 56 57 57 memset(buff, 0, PATH_MAX); 58 getcwd(buff, PATH_MAX);59 58 60 if ( ! buff) {59 if (getcwd(buff, PATH_MAX) == NULL) { 61 60 cli_error(CL_EFAIL, 62 61 "Unable to determine the current working directory"); -
uspace/app/bdsh/cmds/modules/rm/rm.c
r3feeab2 rff381a7 27 27 */ 28 28 29 #include <errno.h> 29 30 #include <stdio.h> 30 31 #include <stdlib.h> … … 131 132 static unsigned int rm_single(const char *path) 132 133 { 133 if (unlink(path) ) {134 if (unlink(path) != 0) { 134 135 cli_error(CL_EFAIL, "rm: could not remove file %s", path); 135 136 return 1; … … 150 151 151 152 fd = open(path, O_RDONLY); 152 if (fd > 0) {153 if (fd >= 0) { 153 154 close(fd); 154 155 return RM_FILE; … … 210 211 rc = rmdir(path); 211 212 if (rc == 0) 212 return ret;213 return errno; 213 214 214 215 cli_error(CL_ENOTSUP, "Can not remove %s", path); -
uspace/app/bdsh/cmds/modules/touch/touch.c
r3feeab2 rff381a7 123 123 124 124 /* Check whether file exists if -c (--no-create) option is given */ 125 if ((!no_create) || ((no_create) && (stat(buff, &file_stat) == EOK)))125 if ((!no_create) || ((no_create) && (stat(buff, &file_stat) == 0))) 126 126 fd = open(buff, O_RDWR | O_CREAT); 127 127 -
uspace/app/bdsh/cmds/modules/unmount/unmount.c
r3feeab2 rff381a7 66 66 } 67 67 68 rc = unmount(argv[1]);68 rc = vfs_unmount(argv[1]); 69 69 if (rc != EOK) { 70 70 printf("Unable to unmount %s (rc=%d)\n", argv[1], rc); -
uspace/app/bdsh/compl.c
r3feeab2 rff381a7 360 360 asprintf(&ent_path, "%s/%s", *cs->path, dent->d_name); 361 361 struct stat ent_stat; 362 if (stat(ent_path, &ent_stat) != EOK) {362 if (stat(ent_path, &ent_stat) != 0) { 363 363 /* Error */ 364 364 free(ent_path); -
uspace/app/bdsh/config.h
r3feeab2 rff381a7 46 46 /* How many words (arguments) are permitted, how big can a whole 47 47 * sentence be? Similar to ARG_MAX */ 48 #define WORD_MAX 25549 #define INPUT_MAX 102448 #define WORD_MAX 1023 49 #define INPUT_MAX 4096 50 50 51 51 /* Leftovers from Autoconf */ -
uspace/app/bdsh/errors.h
r3feeab2 rff381a7 42 42 #define CL_ENOTSUP 6 43 43 #define CL_EEXEC 7 44 #define CL_EEXIST S844 #define CL_EEXIST 8 45 45 #define CL_ETOOBIG 9 46 46 -
uspace/app/bdsh/exec.c
r3feeab2 rff381a7 61 61 62 62 fd = open(f, O_RDONLY); 63 if (fd > -1) {63 if (fd >= 0) { 64 64 close(fd); 65 65 return 0; … … 113 113 114 114 for (i = 0; i < 3 && files[i] != NULL; i++) { 115 if ( fhandle(files[i], &file_handles[i]) == EOK) {115 if (vfs_fhandle(files[i], &file_handles[i]) == EOK) { 116 116 file_handles_p[i] = &file_handles[i]; 117 117 } -
uspace/app/blkdump/blkdump.c
r3feeab2 rff381a7 142 142 } 143 143 144 rc = block_init( EXCHANGE_SERIALIZE,service_id, 2048);144 rc = block_init(service_id, 2048); 145 145 if (rc != EOK) { 146 146 printf(NAME ": Error initializing libblock.\n"); -
uspace/app/date/date.c
r3feeab2 rff381a7 136 136 137 137 /* Connect to the device */ 138 async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, 139 svc_id, 0); 138 async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF, 0); 140 139 if (!sess) { 141 140 printf(NAME ": Cannot connect to the device\n"); -
uspace/app/df/df.c
r3feeab2 rff381a7 119 119 120 120 LIST_INITIALIZE(mtab_list); 121 get_mtab_list(&mtab_list);121 vfs_get_mtab_list(&mtab_list); 122 122 123 123 print_header(); 124 124 list_foreach(mtab_list, link, mtab_ent_t, mtab_ent) { 125 statfs(mtab_ent->mp, &st); 126 print_statfs(&st, mtab_ent->fs_name, mtab_ent->mp); 125 if (statfs(mtab_ent->mp, &st) == 0) { 126 print_statfs(&st, mtab_ent->fs_name, mtab_ent->mp); 127 } else { 128 fprintf(stderr, "Cannot get information for '%s' (%d).\n", 129 mtab_ent->mp, errno); 130 } 127 131 } 128 132 -
uspace/app/hdisk/hdisk.c
r3feeab2 rff381a7 82 82 label.device = dev_handle; 83 83 84 rc = block_init( EXCHANGE_ATOMIC,dev_handle, 512);84 rc = block_init(dev_handle, 512); 85 85 if (rc != EOK) { 86 86 printf("Error during libblock init: %d - %s.\n", rc, str_error(rc)); -
uspace/app/init/init.c
r3feeab2 rff381a7 126 126 opts = "restore"; 127 127 128 int rc = mount(fstype, ROOT_MOUNT_POINT, ROOT_DEVICE, opts,128 int rc = vfs_mount(fstype, ROOT_MOUNT_POINT, ROOT_DEVICE, opts, 129 129 IPC_FLAG_BLOCKING, 0); 130 130 return mount_report("Root filesystem", ROOT_MOUNT_POINT, fstype, … … 143 143 static bool mount_locfs(void) 144 144 { 145 int rc = mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "",145 int rc = vfs_mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "", 146 146 IPC_FLAG_BLOCKING, 0); 147 147 return mount_report("Location service filesystem", LOCFS_MOUNT_POINT, … … 152 152 { 153 153 struct stat s; 154 if (stat(path, &s) == ENOENT) {154 if (stat(path, &s) != 0) { 155 155 printf("%s: Unable to stat %s\n", NAME, path); 156 156 return ENOENT; … … 299 299 static bool mount_tmpfs(void) 300 300 { 301 int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0, 0);301 int rc = vfs_mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0, 0); 302 302 return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT, 303 303 TMPFS_FS_TYPE, NULL, rc); -
uspace/app/mixerctl/mixerctl.c
r3feeab2 rff381a7 155 155 } 156 156 157 async_sess_t *session = loc_service_connect( 158 EXCHANGE_ATOMIC, mixer_sid, 0); 157 async_sess_t *session = loc_service_connect(mixer_sid, INTERFACE_DDF, 0); 159 158 if (!session) { 160 159 printf("Failed connecting mixer service '%s'.\n", service); -
uspace/app/mkbd/main.c
r3feeab2 rff381a7 231 231 } 232 232 233 async_sess_t *sess = devman_device_connect(EXCHANGE_SERIALIZE, 234 dev_handle, 0); 233 async_sess_t *sess = devman_device_connect(dev_handle, 0); 235 234 if (!sess) { 236 235 printf(NAME ": failed to connect to the device (handle %" -
uspace/app/mkexfat/mkexfat.c
r3feeab2 rff381a7 803 803 } 804 804 805 rc = block_init( EXCHANGE_SERIALIZE,service_id, 2048);805 rc = block_init(service_id, 2048); 806 806 if (rc != EOK) { 807 807 printf(NAME ": Error initializing libblock.\n"); -
uspace/app/mkfat/mkfat.c
r3feeab2 rff381a7 162 162 } 163 163 164 rc = block_init( EXCHANGE_SERIALIZE,service_id, 2048);164 rc = block_init(service_id, 2048); 165 165 if (rc != EOK) { 166 166 printf(NAME ": Error initializing libblock.\n"); -
uspace/app/mkmfs/mkmfs.c
r3feeab2 rff381a7 209 209 } 210 210 211 rc = block_init( EXCHANGE_SERIALIZE,service_id, 2048);211 rc = block_init(service_id, 2048); 212 212 if (rc != EOK) { 213 213 printf(NAME ": Error initializing libblock.\n"); -
uspace/app/nic/nic.c
r3feeab2 rff381a7 99 99 printf("Using device: %s\n", svc_name); 100 100 101 sess = loc_service_connect( EXCHANGE_SERIALIZE, nics[i], 0);101 sess = loc_service_connect(nics[i], INTERFACE_DDF, 0); 102 102 if (sess == NULL) { 103 103 printf("Error connecting to service.\n"); … … 117 117 int rc; 118 118 119 sess = loc_service_connect( EXCHANGE_SERIALIZE, svc_id, 0);119 sess = loc_service_connect(svc_id, INTERFACE_DDF, 0); 120 120 if (sess == NULL) { 121 121 printf("Error connecting to service.\n"); 122 122 goto error; 123 123 } 124 124 125 125 rc = nic_get_address(sess, &info->address); 126 126 if (rc != EOK) { -
uspace/app/sportdmp/sportdmp.c
r3feeab2 rff381a7 111 111 112 112 113 async_sess_t *sess = loc_service_connect( EXCHANGE_SERIALIZE, svc_id,113 async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF, 114 114 IPC_FLAG_BLOCKING); 115 115 if (!sess) { -
uspace/app/taskdump/elf_core.c
r3feeab2 rff381a7 207 207 } 208 208 209 rc = write _all(fd, &elf_hdr, sizeof(elf_hdr));209 rc = write(fd, &elf_hdr, sizeof(elf_hdr)); 210 210 if (rc != sizeof(elf_hdr)) { 211 211 printf("Failed writing ELF header.\n"); … … 215 215 216 216 for (i = 0; i < n_ph; ++i) { 217 rc = write _all(fd, &p_hdr[i], sizeof(p_hdr[i]));217 rc = write(fd, &p_hdr[i], sizeof(p_hdr[i])); 218 218 if (rc != sizeof(p_hdr[i])) { 219 219 printf("Failed writing program header.\n"); … … 236 236 note.type = NT_PRSTATUS; 237 237 238 rc = write _all(fd, ¬e, sizeof(elf_note_t));238 rc = write(fd, ¬e, sizeof(elf_note_t)); 239 239 if (rc != sizeof(elf_note_t)) { 240 240 printf("Failed writing note header.\n"); … … 243 243 } 244 244 245 rc = write _all(fd, "CORE", note.namesz);245 rc = write(fd, "CORE", note.namesz); 246 246 if (rc != (ssize_t) note.namesz) { 247 247 printf("Failed writing note header.\n"); … … 257 257 } 258 258 259 rc = write _all(fd, &pr_status, sizeof(elf_prstatus_t));259 rc = write(fd, &pr_status, sizeof(elf_prstatus_t)); 260 260 if (rc != sizeof(elf_prstatus_t)) { 261 261 printf("Failed writing register data.\n"); … … 321 321 } 322 322 323 rc = write _all(fd, buffer, to_copy);323 rc = write(fd, buffer, to_copy); 324 324 if (rc != (ssize_t) to_copy) { 325 325 printf("Failed writing memory contents.\n"); -
uspace/app/taskdump/symtab.c
r3feeab2 rff381a7 88 88 } 89 89 90 rc = read _all(fd, &elf_hdr, sizeof(elf_header_t));90 rc = read(fd, &elf_hdr, sizeof(elf_header_t)); 91 91 if (rc != sizeof(elf_header_t)) { 92 92 printf("failed reading elf header\n"); … … 310 310 return EIO; 311 311 312 rc = read _all(fd, sec_hdr, sizeof(elf_section_header_t));312 rc = read(fd, sec_hdr, sizeof(elf_section_header_t)); 313 313 if (rc != sizeof(elf_section_header_t)) 314 314 return EIO; … … 346 346 } 347 347 348 rc = read _all(fd, *ptr, size);348 rc = read(fd, *ptr, size); 349 349 if (rc != (ssize_t) size) { 350 350 printf("failed reading chunk\n"); -
uspace/app/tester/float/float2.c
r3feeab2 rff381a7 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 27 28 */ 28 29 30 #include <stdbool.h> 29 31 #include <stdio.h> 30 32 #include <stdlib.h> … … 32 34 #include "../tester.h" 33 35 34 #define OPERANDS 10 35 #define PRECISION 100000000 36 #define OPERANDS 10 37 #define PRECISIONF 10000 38 #define PRECISION 100000000 36 39 37 40 static double arguments[OPERANDS] = { … … 39 42 }; 40 43 41 static double results_trunc[OPERANDS] = { 42 3.0, -2.0, 100.0, 50.0, -1024.0, 0.0, 768.0, 1080.0, -600.0, 1.0 44 static double arguments_acos[OPERANDS] = { 45 -0.936456687291, -0.504846104600, 0.862318872288, 0.964966028492, 46 0.987353618220, 1.0, -0.194939922623, 0.978471923925, -0.999023478833, 47 0.540302305868 48 }; 49 50 static double arguments_asin[OPERANDS] = { 51 -0.350783227690, -0.863209366649, -0.506365641110, -0.262374853704, 52 0.158533380044, 0.0, 0.980815184715, -0.206379975025, -0.044182448332, 53 0.841470984808 54 }; 55 56 static double arguments_atan[OPERANDS] = { 57 3.5, 100.0, 50.0, 768.3156, 1080.499999, 1.0, 66.0, 58 2.718281828459045, 9.9, 0.001 59 }; 60 61 static double arguments_exp[OPERANDS] = { 62 3.5, -2.1, 50.0, 0.0, 1.0, 13.2, -1.1, -5.5, 0.1, -66.0 63 }; 64 65 static double arguments_log[OPERANDS] = { 66 3.5, 100.0, 50.0, 768.3156, 1080.499999, 1.0, 66.0, 67 2.718281828459045, 9.9, 0.001 68 }; 69 70 static double arguments_sqrt[OPERANDS] = { 71 3.5, 100.0, 50.0, 768.3156, 1080.499999, 1.0, 66.0, 72 2.718281828459045, 9.9, 0.001 73 }; 74 75 static double arguments_tanh[OPERANDS] = { 76 3.5, -2.1, 50.0, 0.0, 1.0, 13.2, -1.1, -5.5, 0.000001, -66000000.0 77 }; 78 79 static double results_acos[OPERANDS] = { 80 2.783185307180, 2.100000000000, 0.530964914873, 0.265482457437, 81 0.159205070272, 0.000000000000, 1.766992524091, 0.207873834887, 82 3.097395817941, 1.000000000000 83 }; 84 85 static double results_asin[OPERANDS] = { 86 -0.358407346411, -1.041592653590, -0.530964914874, -0.265482457437, 87 0.159205070273, 0.000000000000, 1.374600129498, -0.207873834889, 88 -0.044196835651, 1.000000000000 89 }; 90 91 static double results_atan[OPERANDS] = { 92 1.292496667790, 1.560796660108, 1.550798992822, 1.569494779052, 93 1.569870829603, 0.785398163397, 1.555645970920, 1.218282905017, 94 1.470127674637, 0.000999999667 95 }; 96 97 static double results_ceil[OPERANDS] = { 98 4.0, -2.0, 100.0, 50.0, -1024.0, 0.0, 769.0, 1081.0, -600.0, 1.0 99 }; 100 101 static double results_cos[OPERANDS] = { 102 -0.936456687291, -0.504846104600, 0.862318872288, 0.964966028492, 103 0.987353618220, 1.0, -0.194939922623, 0.978471923925, -0.999023478833, 104 0.540302305868 105 }; 106 107 static double results_cosh[OPERANDS] = { 108 16.572824671057, 4.144313170410, 2592352764293536022528.000000000000, 109 1.000000000000, 1.543080634815, 270182.468624271103, 1.668518553822, 110 122.348009517829, 1.005004168056, 23035933171656458903220125696.0 111 }; 112 113 static double results_fabs[OPERANDS] = { 114 3.5, 2.1, 100.0, 50.0, 1024.0, 0.0, 768.3156, 1080.499999, 600.0, 1.0 115 }; 116 117 static double results_floor[OPERANDS] = { 118 3.0, -3.0, 100.0, 50.0, -1024.0, 0.0, 768.0, 1080.0, -600.0, 1.0 119 }; 120 121 static double results_exp[OPERANDS] = { 122 33.115451958692, 0.122456428253, 5184705528587072045056.0, 123 1.000000000000, 2.718281828459, 540364.937246691552, 0.332871083698, 124 0.004086771438, 1.105170918076, 0.000000000000 125 }; 126 127 static double results_log[OPERANDS] = { 128 1.252762968495, 4.605170185988, 3.912023005428, 6.644200586236, 129 6.985179175021, 0.000000000000, 4.189654742026, 1.000000000000, 130 2.292534757141, -6.907755278982 131 }; 132 133 static double results_log10[OPERANDS] = { 134 0.544068044350, 2.000000000000, 1.698970004336, 2.885539651261, 135 3.033624770817, 0.000000000000, 1.819543935542, 0.434294481903, 136 0.995635194598, -3.000000000000 43 137 }; 44 138 … … 49 143 }; 50 144 51 static double results_cos[OPERANDS] = { 52 -0.936456687291, -0.504846104600, 0.862318872288, 0.964966028492, 53 0.987353618220, 1.0, -0.194939922623, 0.978471923925, -0.999023478833, 54 0.540302305868 55 }; 145 static double results_sinh[OPERANDS] = { 146 16.542627287635, -4.021856742157, 2592352764293536022528.000000000000, 147 0.000000000000, 1.175201193644, 270182.468622420449, -1.335647470124, 148 -122.343922746391, 0.100166750020, -23035933171656458903220125696.0 149 }; 150 151 static double results_sqrt[OPERANDS] = { 152 1.870828693387, 10.000000000000, 7.071067811865, 27.718506453271, 153 32.870959812576, 1.000000000000, 8.124038404636, 1.648721270700, 154 3.146426544510, 0.031622776602 155 }; 156 157 static double results_tan[OPERANDS] = { 158 0.374585640159, 1.709846542905, -0.587213915157, -0.271900611998, 159 0.160563932839, 0.000000000000, -5.031371570891, -0.210920691722, 160 0.044225635601, 1.557407724655 161 }; 162 163 static double results_tanh[OPERANDS] = { 164 0.998177897611, -0.970451936613, 1.000000000000, 0.000000000000, 165 0.761594155956, 0.999999999993, -0.800499021761, -0.999966597156, 166 0.000001000000, -1.000000000000 167 }; 168 169 static double results_trunc[OPERANDS] = { 170 3.0, -2.0, 100.0, 50.0, -1024.0, 0.0, 768.0, 1080.0, -600.0, 1.0 171 }; 172 173 static bool cmp_float(float a, float b) 174 { 175 float r; 176 177 /* XXX Need fabsf() */ 178 if (b < 1.0 / PRECISIONF && b > -1.0 / PRECISIONF) 179 r = a; 180 else 181 r = a / b - 1.0; 182 183 /* XXX Need fabsf() */ 184 if (r < 0.0) 185 r = -r; 186 187 return r < 1.0 / PRECISIONF; 188 } 189 190 static bool cmp_double(double a, double b) 191 { 192 double r; 193 194 /* XXX Need fabs() */ 195 if (b < 1.0 / PRECISION && b > -1.0 / PRECISION) 196 r = a; 197 else 198 r = a / b - 1.0; 199 200 /* XXX Need fabs() */ 201 if (r < 0.0) 202 r = -r; 203 204 return r < 1.0 / PRECISION; 205 } 56 206 57 207 const char *test_float2(void) 58 208 { 59 209 bool fail = false; 60 210 if (0) { 211 for (unsigned int i = 0; i < OPERANDS; i++) { 212 double res = acos(arguments_acos[i]); 213 214 if (!cmp_double(res, results_acos[i])) { 215 TPRINTF("Double precision acos failed " 216 "(%lf != %lf, arg %u)\n", res, results_acos[i], i); 217 fail = true; 218 } 219 } 220 221 for (unsigned int i = 0; i < OPERANDS; i++) { 222 float res = acosf(arguments_acos[i]); 223 224 if (!cmp_float(res, results_acos[i])) { 225 TPRINTF("Single precision acos failed " 226 "(%f != %lf, arg %u)\n", res, results_acos[i], i); 227 fail = true; 228 } 229 } 230 231 for (unsigned int i = 0; i < OPERANDS; i++) { 232 double res = asin(arguments_asin[i]); 233 234 if (!cmp_double(res, results_asin[i])) { 235 TPRINTF("Double precision asin failed " 236 "(%lf != %lf, arg %u)\n", res, results_asin[i], i); 237 fail = true; 238 } 239 } 240 241 for (unsigned int i = 0; i < OPERANDS; i++) { 242 float res = asinf(arguments_asin[i]); 243 244 if (!cmp_float(res, results_asin[i])) { 245 TPRINTF("Single precision asin failed " 246 "(%f != %lf, arg %u)\n", res, results_asin[i], i); 247 fail = true; 248 } 249 } 250 } 251 for (unsigned int i = 0; i < OPERANDS; i++) { 252 double res = atan(arguments_atan[i]); 253 254 if (!cmp_double(res, results_atan[i])) { 255 TPRINTF("Double precision atan failed " 256 "(%.12lf != %.12lf, arg %u)\n", res, results_atan[i], i); 257 fail = true; 258 } 259 } 260 261 for (unsigned int i = 0; i < OPERANDS; i++) { 262 float res = atanf(arguments_atan[i]); 263 264 if (!cmp_float(res, results_atan[i])) { 265 TPRINTF("Single precision atan failed " 266 "(%f != %lf, arg %u)\n", res, results_atan[i], i); 267 fail = true; 268 } 269 } 270 271 for (unsigned int i = 0; i < OPERANDS; i++) { 272 double res = ceil(arguments[i]); 273 274 if (!cmp_double(res, results_ceil[i])) { 275 TPRINTF("Double precision ceil failed " 276 "(%lf != %lf, arg %u)\n", res, results_ceil[i], i); 277 fail = true; 278 } 279 } 280 281 for (unsigned int i = 0; i < OPERANDS; i++) { 282 float res = ceilf(arguments[i]); 283 284 if (!cmp_float(res, results_ceil[i])) { 285 TPRINTF("Single precision ceil failed " 286 "(%f != %lf, arg %u)\n", res, results_ceil[i], i); 287 fail = true; 288 } 289 } 290 291 for (unsigned int i = 0; i < OPERANDS; i++) { 292 double res = cos(arguments[i]); 293 294 if (!cmp_double(res, results_cos[i])) { 295 TPRINTF("Double precision cos failed " 296 "(%lf != %lf, arg %u)\n", res, results_cos[i], i); 297 fail = true; 298 } 299 } 300 301 for (unsigned int i = 0; i < OPERANDS; i++) { 302 float res = cosf(arguments[i]); 303 304 if (!cmp_float(res, results_cos[i])) { 305 TPRINTF("Single precision cos failed " 306 "(%f != %lf, arg %u)\n", res, results_cos[i], i); 307 fail = true; 308 } 309 } 310 311 for (unsigned int i = 0; i < OPERANDS; i++) { 312 double res = cosh(arguments_exp[i]); 313 314 if (!cmp_double(res, results_cosh[i])) { 315 TPRINTF("Double precision cosh failed " 316 "(%lf != %lf, arg %u)\n", res, results_cosh[i], i); 317 fail = true; 318 } 319 } 320 321 for (unsigned int i = 0; i < OPERANDS; i++) { 322 float res = coshf(arguments_exp[i]); 323 324 if (!cmp_float(res, results_cosh[i])) { 325 TPRINTF("Single precision cosh failed " 326 "(%f != %lf, arg %u)\n", res, results_cosh[i], i); 327 fail = true; 328 } 329 } 330 331 for (unsigned int i = 0; i < OPERANDS; i++) { 332 double res = exp(arguments_exp[i]); 333 334 if (!cmp_double(res, results_exp[i])) { 335 TPRINTF("Double precision exp failed " 336 "(%lf != %lf, arg %u)\n", res, results_exp[i], i); 337 fail = true; 338 } 339 } 340 341 for (unsigned int i = 0; i < OPERANDS; i++) { 342 float res = expf(arguments_exp[i]); 343 344 if (!cmp_float(res, results_exp[i])) { 345 TPRINTF("Single precision exp failed " 346 "(%f != %lf, arg %u)\n", res, results_exp[i], i); 347 fail = true; 348 } 349 } 350 351 for (unsigned int i = 0; i < OPERANDS; i++) { 352 double res = fabs(arguments[i]); 353 354 if (!cmp_double(res, results_fabs[i])) { 355 TPRINTF("Double precision fabs failed " 356 "(%lf != %lf, arg %u)\n", res, results_fabs[i], i); 357 fail = true; 358 } 359 } 360 361 for (unsigned int i = 0; i < OPERANDS; i++) { 362 float res = fabsf(arguments[i]); 363 364 if (!cmp_float(res, results_fabs[i])) { 365 TPRINTF("Single precision fabs failed " 366 "(%f != %lf, arg %u)\n", res, results_fabs[i], i); 367 fail = true; 368 } 369 } 370 371 for (unsigned int i = 0; i < OPERANDS; i++) { 372 double res = floor(arguments[i]); 373 374 if (!cmp_double(res, results_floor[i])) { 375 TPRINTF("Double precision floor failed " 376 "(%lf != %lf, arg %u)\n", res, results_floor[i], i); 377 fail = true; 378 } 379 } 380 381 for (unsigned int i = 0; i < OPERANDS; i++) { 382 float res = floorf(arguments[i]); 383 384 if (!cmp_float(res, results_floor[i])) { 385 TPRINTF("Single precision floor failed " 386 "(%f != %lf, arg %u)\n", res, results_floor[i], i); 387 fail = true; 388 } 389 } 390 391 for (unsigned int i = 0; i < OPERANDS; i++) { 392 double res = log(arguments_log[i]); 393 394 if (!cmp_double(res, results_log[i])) { 395 TPRINTF("Double precision log failed " 396 "(%lf != %lf, arg %u)\n", res, results_log[i], i); 397 fail = true; 398 } 399 } 400 401 for (unsigned int i = 0; i < OPERANDS; i++) { 402 float res = logf(arguments_log[i]); 403 404 if (!cmp_float(res, results_log[i])) { 405 TPRINTF("Single precision log failed " 406 "(%f != %lf, arg %u)\n", res, results_log[i], i); 407 fail = true; 408 } 409 } 410 411 for (unsigned int i = 0; i < OPERANDS; i++) { 412 double res = log10(arguments_log[i]); 413 414 if (!cmp_double(res, results_log10[i])) { 415 TPRINTF("Double precision log10 failed " 416 "(%lf != %lf, arg %u)\n", res, results_log10[i], i); 417 fail = true; 418 } 419 } 420 421 for (unsigned int i = 0; i < OPERANDS; i++) { 422 float res = log10f(arguments_log[i]); 423 424 if (!cmp_float(res, results_log10[i])) { 425 TPRINTF("Single precision log10 failed " 426 "(%f != %lf, arg %u)\n", res, results_log10[i], i); 427 fail = true; 428 } 429 } 430 431 for (unsigned int i = 0; i < OPERANDS; i++) { 432 double res = sin(arguments[i]); 433 434 if (!cmp_double(res, results_sin[i])) { 435 TPRINTF("Double precision sin failed " 436 "(%lf != %lf, arg %u)\n", res, results_sin[i], i); 437 fail = true; 438 } 439 } 440 441 for (unsigned int i = 0; i < OPERANDS; i++) { 442 float res = sinf(arguments[i]); 443 444 if (!cmp_float(res, results_sin[i])) { 445 TPRINTF("Single precision sin failed " 446 "(%f != %lf, arg %u)\n", res, results_sin[i], i); 447 fail = true; 448 } 449 } 450 ; 451 for (unsigned int i = 0; i < OPERANDS; i++) { 452 double res = sinh(arguments_exp[i]); 453 454 if (!cmp_double(res, results_sinh[i])) { 455 TPRINTF("Double precision sinh failed " 456 "(%lf != %lf, arg %u)\n", res, results_sinh[i], i); 457 fail = true; 458 } 459 } 460 461 for (unsigned int i = 0; i < OPERANDS; i++) { 462 float res = sinhf(arguments_exp[i]); 463 464 if (!cmp_float(res, results_sinh[i])) { 465 TPRINTF("Single precision sinh failed " 466 "(%f != %lf, arg %u)\n", res, results_sinh[i], i); 467 fail = true; 468 } 469 } 470 471 for (unsigned int i = 0; i < OPERANDS; i++) { 472 double res = sqrt(arguments_sqrt[i]); 473 474 if (!cmp_double(res, results_sqrt[i])) { 475 TPRINTF("Double precision sqrt failed " 476 "(%lf != %lf, arg %u)\n", res, results_sqrt[i], i); 477 fail = true; 478 } 479 } 480 481 for (unsigned int i = 0; i < OPERANDS; i++) { 482 float res = sqrtf(arguments_sqrt[i]); 483 484 if (!cmp_float(res, results_sqrt[i])) { 485 TPRINTF("Single precision sqrt failed " 486 "(%f != %lf, arg %u)\n", res, results_sqrt[i], i); 487 fail = true; 488 } 489 } 490 491 for (unsigned int i = 0; i < OPERANDS; i++) { 492 double res = tan(arguments[i]); 493 494 if (!cmp_double(res, results_tan[i])) { 495 TPRINTF("Double precision tan failed " 496 "(%lf != %lf, arg %u)\n", res, results_tan[i], i); 497 fail = true; 498 } 499 } 500 501 for (unsigned int i = 0; i < OPERANDS; i++) { 502 float res = tanf(arguments[i]); 503 504 if (!cmp_float(res, results_tan[i])) { 505 TPRINTF("Single precision tan failed " 506 "(%f != %lf, arg %u)\n", res, results_tan[i], i); 507 fail = true; 508 } 509 } 510 511 for (unsigned int i = 0; i < OPERANDS; i++) { 512 double res = tanh(arguments_tanh[i]); 513 514 if (!cmp_double(res, results_tanh[i])) { 515 TPRINTF("Double precision tanh failed " 516 "(%lf != %lf, arg %u)\n", res, results_tanh[i], i); 517 fail = true; 518 } 519 } 520 521 for (unsigned int i = 0; i < OPERANDS; i++) { 522 float res = tanhf(arguments_tanh[i]); 523 524 if (!cmp_float(res, results_tanh[i])) { 525 TPRINTF("Single precision tanh failed " 526 "(%f != %lf, arg %u)\n", res, results_tanh[i], i); 527 fail = true; 528 } 529 } 530 61 531 for (unsigned int i = 0; i < OPERANDS; i++) { 62 532 double res = trunc(arguments[i]); 63 int64_t res_int = (int64_t) (res * PRECISION); 64 int64_t corr_int = (int64_t) (results_trunc[i] * PRECISION); 65 66 if (res_int != corr_int) { 67 TPRINTF("Double truncation failed (%" PRId64 " != %" PRId64 68 ", arg %u)\n", res_int, corr_int, i); 69 fail = true; 70 } 71 } 72 73 for (unsigned int i = 0; i < OPERANDS; i++) { 74 double res = sin(arguments[i]); 75 int64_t res_int = (int64_t) (res * PRECISION); 76 int64_t corr_int = (int64_t) (results_sin[i] * PRECISION); 77 78 if (res_int != corr_int) { 79 TPRINTF("Double sine failed (%" PRId64 " != %" PRId64 80 ", arg %u)\n", res_int, corr_int, i); 81 fail = true; 82 } 83 } 84 85 for (unsigned int i = 0; i < OPERANDS; i++) { 86 double res = cos(arguments[i]); 87 int64_t res_int = (int64_t) (res * PRECISION); 88 int64_t corr_int = (int64_t) (results_cos[i] * PRECISION); 89 90 if (res_int != corr_int) { 91 TPRINTF("Double cosine failed (%" PRId64 " != %" PRId64 92 ", arg %u)\n", res_int, corr_int, i); 93 fail = true; 94 } 95 } 96 533 534 if (!cmp_double(res, results_trunc[i])) { 535 TPRINTF("Double precision trunc failed " 536 "(%lf != %lf, arg %u)\n", res, results_trunc[i], i); 537 fail = true; 538 } 539 } 540 541 for (unsigned int i = 0; i < OPERANDS; i++) { 542 float res = truncf(arguments[i]); 543 544 if (!cmp_float(res, results_trunc[i])) { 545 TPRINTF("Single precision trunc failed " 546 "(%f != %lf, arg %u)\n", res, results_trunc[i], i); 547 fail = true; 548 } 549 } 550 97 551 if (fail) 98 552 return "Floating point imprecision"; 99 553 100 554 return NULL; 101 555 } -
uspace/app/tester/hw/misc/virtchar1.c
r3feeab2 rff381a7 58 58 int fd = open(path, O_RDONLY); 59 59 if (fd < 0) { 60 TPRINTF(" ...error: %s\n", str_error( fd));60 TPRINTF(" ...error: %s\n", str_error(errno)); 61 61 if (fd == ENOENT) { 62 62 TPRINTF(" (error was ENOENT: " \ … … 69 69 70 70 TPRINTF(" Asking for session...\n"); 71 async_sess_t *sess = fd_session(EXCHANGE_SERIALIZE, fd);71 async_sess_t *sess = vfs_fd_session(fd, INTERFACE_DDF); 72 72 if (!sess) { 73 73 close(fd); -
uspace/app/tester/hw/serial/serial1.c
r3feeab2 rff381a7 76 76 return "Failed getting serial port service ID"; 77 77 78 async_sess_t *sess = loc_service_connect( EXCHANGE_SERIALIZE, svc_id,78 async_sess_t *sess = loc_service_connect(svc_id, INTERFACE_DDF, 79 79 IPC_FLAG_BLOCKING); 80 80 if (!sess) -
uspace/app/tester/mm/common.c
r3feeab2 rff381a7 309 309 return NULL; 310 310 311 unsigned intidx = rand() % mem_blocks_count;311 unsigned long idx = rand() % mem_blocks_count; 312 312 link_t *entry = list_nth(&mem_blocks, idx); 313 313 -
uspace/app/tester/tester.h
r3feeab2 rff381a7 60 60 do { \ 61 61 if (!test_quiet) { \ 62 fprintf(std err, (format), ##__VA_ARGS__); \62 fprintf(stdout, (format), ##__VA_ARGS__); \ 63 63 } \ 64 64 } while (0) -
uspace/app/tester/vfs/vfs1.c
r3feeab2 rff381a7 70 70 const char *test_vfs1(void) 71 71 { 72 int rc; 73 if ((rc = mkdir(TEST_DIRECTORY, 0)) != 0) { 74 TPRINTF("rc=%d\n", rc); 72 if (mkdir(TEST_DIRECTORY, 0) != 0) { 73 TPRINTF("rc=%d\n", errno); 75 74 return "mkdir() failed"; 76 75 } … … 93 92 94 93 char buf[BUF_SIZE]; 94 TPRINTF("read..\n"); 95 95 while ((cnt = read(fd0, buf, BUF_SIZE))) { 96 TPRINTF("read returns %zd\n", cnt); 96 97 if (cnt < 0) 97 98 return "read() failed"; … … 112 113 return rv; 113 114 114 if (rename(TEST_FILE, TEST_FILE2) )115 if (rename(TEST_FILE, TEST_FILE2) != 0) 115 116 return "rename() failed"; 116 117 TPRINTF("Renamed %s to %s\n", TEST_FILE, TEST_FILE2); 117 118 118 if (unlink(TEST_FILE2) )119 if (unlink(TEST_FILE2) != 0) 119 120 return "unlink() failed"; 120 121 TPRINTF("Unlinked %s\n", TEST_FILE2); 121 122 122 if (rmdir(TEST_DIRECTORY) )123 if (rmdir(TEST_DIRECTORY) != 0) 123 124 return "rmdir() failed"; 124 125 TPRINTF("Removed directory %s\n", TEST_DIRECTORY); -
uspace/app/tetris/scores.c
r3feeab2 rff381a7 233 233 234 234 f = fopen("/data/tetris.sco", "wb"); 235 if (f == NULL) { 236 printf("Error creating table\n"); 237 return; 238 } 239 235 240 cnt = fwrite(scores, sizeof(struct highscore), NUMSPOTS, f); 236 241 rc = fclose(f); -
uspace/app/trace/errors.c
r3feeab2 rff381a7 46 46 [-EPERM] = { "EPERM", "Permission denied" }, 47 47 [-EHANGUP] = { "EHANGUP", "Answerbox closed connection" }, 48 [-EEXIST S] = { "EEXISTS", "Entry already exists" },48 [-EEXIST] = { "EEXIST", "Entry already exists" }, 49 49 [-EBADMEM] = { "EBADMEM", "Bad memory pointer" }, 50 50 -
uspace/app/trace/ipcp.c
r3feeab2 rff381a7 303 303 (retval == 0)) { 304 304 /* Connected to a service (through NS) */ 305 service = IPC_GET_ARG 1(pcall->question);305 service = IPC_GET_ARG2(pcall->question); 306 306 proto = proto_get_by_srv(service); 307 307 if (proto == NULL) -
uspace/app/trace/trace.c
r3feeab2 rff381a7 57 57 #include "proto.h" 58 58 #include <ipc/services.h> 59 #include "../../srv/vfs/vfs.h"59 #include <ipc/vfs.h> 60 60 #include <ipc/console.h> 61 61 … … 528 528 int fd_stderr; 529 529 530 if ((stdin != NULL) && ( fhandle(stdin, &fd_stdin) == EOK))530 if ((stdin != NULL) && (vfs_fhandle(stdin, &fd_stdin) == EOK)) 531 531 files[0] = &fd_stdin; 532 532 else 533 533 files[0] = NULL; 534 534 535 if ((stdout != NULL) && ( fhandle(stdout, &fd_stdout) == EOK))535 if ((stdout != NULL) && (vfs_fhandle(stdout, &fd_stdout) == EOK)) 536 536 files[1] = &fd_stdout; 537 537 else 538 538 files[1] = NULL; 539 539 540 if ((stderr != NULL) && ( fhandle(stderr, &fd_stderr) == EOK))540 if ((stderr != NULL) && (vfs_fhandle(stderr, &fd_stderr) == EOK)) 541 541 files[2] = &fd_stderr; 542 542 else -
uspace/app/untar/main.c
r3feeab2 rff381a7 103 103 static int handle_directory(const tar_header_t *header, FILE *tarfile) 104 104 { 105 int rc = mkdir(header->filename, 0755); 106 if ((rc == EEXIST) || (rc == EEXISTS)) { 107 // printf("Note: directory %s already exists.\n", header->filename); 108 rc = EOK; 109 } 110 if (rc != EOK) { 111 fprintf(stderr, "Failed to create directory %s: %s.\n", 112 header->filename, str_error(rc)); 113 return rc; 105 if (mkdir(header->filename, 0755) != 0) { 106 if (errno != EEXIST) { 107 fprintf(stderr, "Failed to create directory %s: %s.\n", 108 header->filename, str_error(errno)); 109 return errno; 110 } 114 111 } 115 112 -
uspace/app/viewer/viewer.c
r3feeab2 rff381a7 98 98 { 99 99 int fd = open(fname, O_RDONLY); 100 if (fd <0)100 if (fd != 0) 101 101 return false; 102 102 103 103 struct stat stat; 104 104 int rc = fstat(fd, &stat); 105 if (rc != EOK) {105 if (rc != 0) { 106 106 close(fd); 107 107 return false; … … 114 114 } 115 115 116 ssize_t rd = read _all(fd, tga, stat.size);116 ssize_t rd = read(fd, tga, stat.size); 117 117 if ((rd < 0) || (rd != (ssize_t) stat.size)) { 118 118 free(tga); -
uspace/app/vuhid/device.c
r3feeab2 rff381a7 123 123 /* Already used interface. */ 124 124 if (iface->vuhid_data != NULL) { 125 return EEXIST S;125 return EEXIST; 126 126 } 127 127 -
uspace/app/wifi_supplicant/wifi_supplicant.c
r3feeab2 rff381a7 121 121 122 122 async_sess_t *sess = 123 loc_service_connect( EXCHANGE_SERIALIZE, wifis[i], 0);123 loc_service_connect(wifis[i], INTERFACE_DDF, 0); 124 124 if (sess == NULL) { 125 125 printf("Error connecting to service.\n");
Note:
See TracChangeset
for help on using the changeset viewer.
