Changeset b19e892 in mainline for uspace/app
- Timestamp:
- 2017-04-02T10:39:13Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9c4cf0d
- Parents:
- 80743a1
- Location:
- uspace/app
- Files:
-
- 22 edited
-
bdsh/cmds/modules/cat/cat.c (modified) (2 diffs)
-
bdsh/cmds/modules/cmp/cmp.c (modified) (2 diffs)
-
bdsh/cmds/modules/cp/cp.c (modified) (2 diffs)
-
bdsh/cmds/modules/ls/ls.c (modified) (1 diff)
-
bdsh/cmds/modules/mkdir/mkdir.c (modified) (1 diff)
-
bdsh/cmds/modules/mkfile/mkfile.c (modified) (3 diffs)
-
bdsh/cmds/modules/rm/rm.c (modified) (2 diffs)
-
bdsh/cmds/modules/touch/touch.c (modified) (2 diffs)
-
bdsh/exec.c (modified) (2 diffs)
-
fontviewer/fontviewer.c (modified) (1 diff)
-
getterm/getterm.c (modified) (5 diffs)
-
init/init.c (modified) (1 diff)
-
redir/redir.c (modified) (7 diffs)
-
sysinst/futil.c (modified) (3 diffs)
-
taskdump/elf_core.c (modified) (3 diffs)
-
taskdump/symtab.c (modified) (2 diffs)
-
tester/hw/misc/virtchar1.c (modified) (2 diffs)
-
tester/mm/pager1.c (modified) (2 diffs)
-
tester/vfs/vfs1.c (modified) (2 diffs)
-
tetris/scores.c (modified) (1 diff)
-
viewer/viewer.c (modified) (2 diffs)
-
websrv/websrv.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r80743a1 rb19e892 33 33 #include <getopt.h> 34 34 #include <str.h> 35 #include <fcntl.h>36 35 #include <io/console.h> 37 36 #include <io/color.h> … … 196 195 blen = STR_BOUNDS(1); 197 196 } else 198 fd = open(fname, O_RDONLY);197 fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ); 199 198 200 199 if (fd < 0) { -
uspace/app/bdsh/cmds/modules/cmp/cmp.c
r80743a1 rb19e892 28 28 29 29 #include <errno.h> 30 #include <fcntl.h>31 30 #include <getopt.h> 32 31 #include <mem.h> … … 82 81 83 82 for (int i = 0; i < 2; i++) { 84 fd[i] = open(fn[i], O_RDONLY);83 fd[i] = vfs_lookup_open(fn[i], WALK_REGULAR, MODE_READ); 85 84 if (fd[i] < 0) { 86 rc = errno;85 rc = fd[i]; 87 86 printf("Unable to open %s\n", fn[i]); 88 87 goto end; -
uspace/app/bdsh/cmds/modules/cp/cp.c
r80743a1 rb19e892 35 35 #include <getopt.h> 36 36 #include <str.h> 37 #include <fcntl.h>38 37 #include <vfs/vfs.h> 39 38 #include <dirent.h> … … 383 382 printf("Copying %s to %s\n", src, dest); 384 383 385 if (-1 == (fd1 = open(src, O_RDONLY))) { 384 fd1 = vfs_lookup_open(src, WALK_REGULAR, MODE_READ); 385 if (fd1 < 0) { 386 386 printf("Unable to open source file %s\n", src); 387 387 return -1; 388 388 } 389 389 390 if (-1 == (fd2 = open(dest, O_WRONLY | O_CREAT))) { 390 fd2 = vfs_lookup_open(dest, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE); 391 if (fd2 < 0) { 391 392 printf("Unable to open destination file %s\n", dest); 392 393 close(fd1); -
uspace/app/bdsh/cmds/modules/ls/ls.c
r80743a1 rb19e892 36 36 #include <unistd.h> 37 37 #include <dirent.h> 38 #include <fcntl.h>39 38 #include <getopt.h> 40 39 #include <sys/types.h> -
uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
r80743a1 rb19e892 30 30 #include <stdlib.h> 31 31 #include <dirent.h> 32 #include <fcntl.h>33 32 #include <sys/types.h> 34 33 #include <getopt.h> -
uspace/app/bdsh/cmds/modules/mkfile/mkfile.c
r80743a1 rb19e892 31 31 #include <stdlib.h> 32 32 #include <dirent.h> 33 #include <fcntl.h>34 33 #include <sys/types.h> 35 34 #include <macros.h> … … 38 37 #include <str.h> 39 38 #include <ctype.h> 39 #include <vfs/vfs.h> 40 40 41 41 #include "config.h" … … 156 156 file_name = argv[optind]; 157 157 158 fd = open(file_name, O_CREAT | O_EXCL | O_WRONLY, 0666);158 fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MUST_CREATE, MODE_WRITE); 159 159 if (fd < 0) { 160 160 printf("%s: failed to create file %s.\n", cmdname, file_name); -
uspace/app/bdsh/cmds/modules/rm/rm.c
r80743a1 rb19e892 31 31 #include <stdlib.h> 32 32 #include <unistd.h> 33 #include <fcntl.h>34 33 #include <dirent.h> 35 34 #include <getopt.h> … … 151 150 } 152 151 153 fd = open(path, O_RDONLY);152 fd = vfs_lookup(path, WALK_REGULAR); 154 153 if (fd >= 0) { 155 154 close(fd); -
uspace/app/bdsh/cmds/modules/touch/touch.c
r80743a1 rb19e892 35 35 #include <stdlib.h> 36 36 #include <unistd.h> 37 #include <fcntl.h>38 37 #include <dirent.h> 39 38 #include <sys/types.h> … … 125 124 if ((!no_create) || 126 125 ((no_create) && (vfs_stat_path(buff, &file_stat) == EOK))) { 127 fd = open(buff, O_RDWR | O_CREAT);126 fd = vfs_lookup(buff, WALK_REGULAR | WALK_MAY_CREATE); 128 127 } 129 128 -
uspace/app/bdsh/exec.c
r80743a1 rb19e892 37 37 #include <unistd.h> 38 38 #include <str.h> 39 #include <fcntl.h>40 39 #include <str_error.h> 41 40 #include <errno.h> … … 60 59 int fd; 61 60 62 fd = open(f, O_RDONLY);61 fd = vfs_lookup_open(f, WALK_REGULAR, MODE_READ); 63 62 if (fd >= 0) { 64 63 close(fd); -
uspace/app/fontviewer/fontviewer.c
r80743a1 rb19e892 35 35 #include <stdio.h> 36 36 #include <unistd.h> 37 #include <fcntl.h>38 37 #include <errno.h> 39 38 #include <malloc.h> -
uspace/app/getterm/getterm.c
r80743a1 rb19e892 36 36 37 37 #include <sys/types.h> 38 #include <fcntl.h>39 38 #include <unistd.h> 40 39 #include <stdio.h> … … 59 58 } 60 59 61 static void reopen(FILE **stream, int fd, const char *path, int flags,62 const char * mode)60 static void reopen(FILE **stream, int fd, const char *path, int mode, 61 const char *fmode) 63 62 { 64 63 if (fclose(*stream)) … … 67 66 *stream = NULL; 68 67 69 int oldfd = open(path, flags);68 int oldfd = vfs_lookup_open(path, WALK_REGULAR, mode); 70 69 if (oldfd < 0) 71 70 return; … … 79 78 } 80 79 81 *stream = fdopen(fd, mode);80 *stream = fdopen(fd, fmode); 82 81 } 83 82 … … 142 141 snprintf(term_node, LOC_NAME_MAXLEN, "%s/%s", locfs, term); 143 142 144 reopen(&stdin, 0, term_node, O_RDONLY, "r");145 reopen(&stdout, 1, term_node, O_WRONLY, "w");146 reopen(&stderr, 2, term_node, O_WRONLY, "w");143 reopen(&stdin, 0, term_node, MODE_READ, "r"); 144 reopen(&stdout, 1, term_node, MODE_WRITE, "w"); 145 reopen(&stderr, 2, term_node, MODE_WRITE, "w"); 147 146 148 147 if (stdin == NULL) -
uspace/app/init/init.c
r80743a1 rb19e892 41 41 #include <stdbool.h> 42 42 #include <errno.h> 43 #include <fcntl.h>44 43 #include <task.h> 45 44 #include <malloc.h> -
uspace/app/redir/redir.c
r80743a1 rb19e892 37 37 #include <sys/types.h> 38 38 #include <stdlib.h> 39 #include <fcntl.h>40 39 #include <unistd.h> 41 40 #include <str.h> … … 54 53 } 55 54 56 static void reopen(FILE **stream, int fd, const char *path, int flags, const char *mode) 55 static void reopen(FILE **stream, int fd, const char *path, int flags, int mode, 56 const char *fmode) 57 57 { 58 58 if (fclose(*stream)) … … 61 61 *stream = NULL; 62 62 63 int oldfd = open(path, flags);63 int oldfd = vfs_lookup_open(path, WALK_REGULAR | flags, mode); 64 64 if (oldfd < 0) 65 65 return; … … 73 73 } 74 74 75 *stream = fdopen(fd, mode);75 *stream = fdopen(fd, fmode); 76 76 } 77 77 … … 122 122 return -2; 123 123 } 124 reopen(&stdin, 0, argv[i], O_RDONLY, "r");124 reopen(&stdin, 0, argv[i], 0, MODE_READ, "r"); 125 125 } else if (str_cmp(argv[i], "-o") == 0) { 126 126 i++; … … 129 129 return -3; 130 130 } 131 reopen(&stdout, 1, argv[i], O_WRONLY | O_CREAT, "w"); 131 reopen(&stdout, 1, argv[i], WALK_MAY_CREATE, MODE_WRITE, 132 "w"); 132 133 } else if (str_cmp(argv[i], "-e") == 0) { 133 134 i++; … … 136 137 return -4; 137 138 } 138 reopen(&stderr, 2, argv[i], O_WRONLY | O_CREAT, "w"); 139 reopen(&stderr, 2, argv[i], WALK_MAY_CREATE, MODE_WRITE, 140 "w"); 139 141 } else if (str_cmp(argv[i], "--") == 0) { 140 142 i++; -
uspace/app/sysinst/futil.c
r80743a1 rb19e892 35 35 #include <dirent.h> 36 36 #include <errno.h> 37 #include <fcntl.h>38 37 #include <stdbool.h> 39 38 #include <stdio.h> … … 64 63 printf("Copy '%s' to '%s'.\n", srcp, destp); 65 64 66 sf = open(srcp, O_RDONLY);65 sf = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ); 67 66 if (sf < 0) 68 67 return EIO; 69 68 70 df = open(destp, O_CREAT | O_WRONLY, 0);69 df = vfs_lookup_open(destp, WALK_REGULAR | WALK_MAY_CREATE, MODE_WRITE); 71 70 if (df < 0) 72 71 return EIO; … … 162 161 struct stat st; 163 162 164 sf = open(srcp, O_RDONLY);163 sf = vfs_lookup_open(srcp, WALK_REGULAR, MODE_READ); 165 164 if (sf < 0) 166 165 return ENOENT; -
uspace/app/taskdump/elf_core.c
r80743a1 rb19e892 55 55 #include <sys/types.h> 56 56 #include <unistd.h> 57 #include <fcntl.h>58 57 #include <mem.h> 59 58 #include <stdint.h> … … 62 61 #include <macros.h> 63 62 #include <libarch/istate.h> 63 #include <vfs/vfs.h> 64 64 65 65 #include "elf_core.h" … … 123 123 } 124 124 125 fd = open(file_name, O_CREAT | O_WRONLY, 0644); 125 fd = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE, 126 MODE_WRITE); 126 127 if (fd < 0) { 127 128 printf("Failed opening file.\n"); -
uspace/app/taskdump/symtab.c
r80743a1 rb19e892 41 41 #include <errno.h> 42 42 #include <sys/types.h> 43 #include < fcntl.h>43 #include <vfs/vfs.h> 44 44 45 45 #include "include/symtab.h" … … 81 81 return ENOMEM; 82 82 83 fd = open(file_name, O_RDONLY);83 fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ); 84 84 if (fd < 0) { 85 85 printf("failed opening file\n"); -
uspace/app/tester/hw/misc/virtchar1.c
r80743a1 rb19e892 45 45 #include <vfs/vfs.h> 46 46 #include <vfs/vfs_sess.h> 47 #include <fcntl.h>48 47 #include "../../tester.h" 49 48 … … 55 54 { 56 55 TPRINTF("Opening `%s'...\n", path); 57 int fd = open(path, O_RDONLY);56 int fd = vfs_lookup(path, WALK_REGULAR); 58 57 if (fd < 0) { 59 58 TPRINTF(" ...error: %s\n", str_error(errno)); -
uspace/app/tester/mm/pager1.c
r80743a1 rb19e892 29 29 #include <stdio.h> 30 30 #include <vfs/vfs.h> 31 #include <fcntl.h>32 31 #include <stdlib.h> 33 32 #include <malloc.h> … … 48 47 TPRINTF("Creating temporary file...\n"); 49 48 50 fd = open(TEST_FILE, O_RDWR | O_CREAT); 49 fd = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE, 50 MODE_READ | MODE_WRITE); 51 51 if (fd < 0) 52 52 return NULL; -
uspace/app/tester/vfs/vfs1.c
r80743a1 rb19e892 33 33 #include <vfs/vfs.h> 34 34 #include <unistd.h> 35 #include <fcntl.h>36 35 #include <dirent.h> 37 36 #include <loc.h> … … 79 78 TPRINTF("Created directory %s\n", TEST_DIRECTORY); 80 79 81 int fd0 = open(TEST_FILE, O_RDWR | O_CREAT); 80 int fd0 = vfs_lookup_open(TEST_FILE, WALK_REGULAR | WALK_MAY_CREATE, 81 MODE_READ | MODE_WRITE); 82 82 if (fd0 < 0) 83 return " open() failed";83 return "vfs_lookup_open() failed"; 84 84 TPRINTF("Created file %s (fd=%d)\n", TEST_FILE, fd0); 85 85 -
uspace/app/tetris/scores.c
r80743a1 rb19e892 65 65 #include <vfs/vfs.h> 66 66 #include <stdlib.h> 67 #include <fcntl.h>68 67 #include <err.h> 69 68 #include <time.h> -
uspace/app/viewer/viewer.c
r80743a1 rb19e892 35 35 #include <stdio.h> 36 36 #include <unistd.h> 37 #include <fcntl.h>38 37 #include <vfs/vfs.h> 39 38 #include <errno.h> … … 110 109 static bool img_load(const char *fname, surface_t **p_local_surface) 111 110 { 112 int fd = open(fname, O_RDONLY);111 int fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ); 113 112 if (fd < 0) 114 113 return false; -
uspace/app/websrv/websrv.c
r80743a1 rb19e892 40 40 #include <sys/types.h> 41 41 #include <stdlib.h> 42 #include <fcntl.h>43 42 #include <task.h> 43 44 #include <vfs/vfs.h> 44 45 45 46 #include <inet/addr.h> … … 224 225 return ENOMEM; 225 226 226 int fd = open(fname, O_RDONLY);227 int fd = vfs_lookup_open(fname, WALK_REGULAR, MODE_READ); 227 228 if (fd < 0) { 228 229 rc = send_response(conn, msg_not_found);
Note:
See TracChangeset
for help on using the changeset viewer.
