Changeset 9c4cf0d in mainline for uspace/lib/c
- Timestamp:
- 2017-04-02T11:24:06Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 151f1cc
- Parents:
- b19e892
- Location:
- uspace/lib/c
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/elf/elf_mod.c
rb19e892 r9c4cf0d 108 108 rc = elf_load_module(&elf, so_bias); 109 109 110 close(ofile);110 vfs_put(ofile); 111 111 return rc; 112 112 } … … 117 117 int file = vfs_lookup(path, 0); 118 118 int rc = elf_load_file(file, so_bias, flags, info); 119 close(file);119 vfs_put(file); 120 120 return rc; 121 121 } -
uspace/lib/c/generic/io/io.c
rb19e892 r9c4cf0d 305 305 if (rc != EOK) { 306 306 errno = rc; 307 close(file);307 vfs_put(file); 308 308 free(stream); 309 309 return NULL; … … 314 314 if (rc != EOK) { 315 315 errno = rc; 316 close(file);316 vfs_put(file); 317 317 free(stream); 318 318 return NULL; … … 370 370 371 371 if (stream->fd >= 0) 372 rc = close(stream->fd);372 rc = vfs_put(stream->fd); 373 373 374 374 list_remove(&stream->link); -
uspace/lib/c/generic/loader.c
rb19e892 r9c4cf0d 204 204 205 205 int rc = loader_set_program(ldr, name, fd); 206 close(fd);206 vfs_put(fd); 207 207 return rc; 208 208 } -
uspace/lib/c/generic/task.c
rb19e892 r9c4cf0d 181 181 if (root >= 0) { 182 182 rc = loader_add_inbox(ldr, "root", root); 183 close(root);183 vfs_put(root); 184 184 if (rc != EOK) 185 185 goto error; -
uspace/lib/c/generic/vfs/inbox.c
rb19e892 r9c4cf0d 1 1 2 2 #include <vfs/inbox.h> 3 #include <vfs/vfs.h> 3 4 4 5 #include <adt/list.h> … … 126 127 int original = inbox_set(entries[i].name, entries[i].file); 127 128 if (original >= 0) { 128 close(original);129 vfs_put(original); 129 130 } 130 131 } -
uspace/lib/c/generic/vfs/vfs.c
rb19e892 r9c4cf0d 82 82 fibril_mutex_lock(&root_mutex); 83 83 if (root_fd >= 0) 84 close(root_fd);84 vfs_put(root_fd); 85 85 root_fd = vfs_clone(nroot, -1, true); 86 86 fibril_mutex_unlock(&root_mutex); … … 149 149 } 150 150 int rc = _vfs_walk(root, p, flags); 151 close(root);151 vfs_put(root); 152 152 free(p); 153 153 return rc; … … 171 171 int rc = vfs_open(file, mode); 172 172 if (rc != EOK) { 173 close(file);173 vfs_put(file); 174 174 return rc; 175 175 } … … 342 342 rc = vfs_mount(mpfd, fs_name, service_id, opts, flags, 343 343 instance, NULL); 344 close(mpfd);344 vfs_put(mpfd); 345 345 } else { 346 346 rc = mpfd; … … 363 363 364 364 int rc = vfs_unmount(mp); 365 close(mp);365 vfs_put(mp); 366 366 return rc; 367 367 } … … 370 370 * 371 371 * @param fildes File descriptor 372 * @return Zero on success. On error -1 is returned and errno is set.373 */ 374 int close(int fildes)372 * @return EOK on success or a negative error code otherwise. 373 */ 374 int vfs_put(int fildes) 375 375 { 376 376 sysarg_t rc; 377 377 378 378 async_exch_t *exch = vfs_exchange_begin(); 379 rc = async_req_1_0(exch, VFS_IN_ CLOSE, fildes);379 rc = async_req_1_0(exch, VFS_IN_PUT, fildes); 380 380 vfs_exchange_end(exch); 381 381 … … 631 631 int rc = vfs_stat(file, stat); 632 632 633 close(file);633 vfs_put(file); 634 634 635 635 return rc; … … 660 660 if (rc < 0) { 661 661 free(dirp); 662 close(fd);662 vfs_put(fd); 663 663 errno = rc; 664 664 return NULL; … … 711 711 int rc; 712 712 713 rc = close(dirp->fd);713 rc = vfs_put(dirp->fd); 714 714 free(dirp); 715 715 … … 726 726 return file; 727 727 728 close(file);728 vfs_put(file); 729 729 730 730 return EOK; … … 762 762 763 763 free(pa); 764 close(parent);764 vfs_put(parent); 765 765 return rc; 766 766 } … … 816 816 if (parent < 0) { 817 817 free(pa); 818 close(expect);818 vfs_put(expect); 819 819 return parent; 820 820 } … … 823 823 824 824 free(pa); 825 close(parent);826 close(expect);825 vfs_put(parent); 826 vfs_put(expect); 827 827 return rc; 828 828 } … … 871 871 free(olda); 872 872 free(newa); 873 close(root);873 vfs_put(root); 874 874 async_wait_for(req, &rc_orig); 875 875 if (rc_orig != EOK) … … 886 886 free(olda); 887 887 free(newa); 888 close(root);888 vfs_put(root); 889 889 async_wait_for(req, &rc_orig); 890 890 if (rc_orig != EOK) … … 899 899 free(olda); 900 900 free(newa); 901 close(root);901 vfs_put(root); 902 902 async_wait_for(req, &rc); 903 903 … … 934 934 935 935 if (cwd_fd >= 0) 936 close(cwd_fd);936 vfs_put(cwd_fd); 937 937 938 938 if (cwd_path) … … 1124 1124 int rc = vfs_statfs(file, st); 1125 1125 1126 close(file);1126 vfs_put(file); 1127 1127 1128 1128 return rc; -
uspace/lib/c/include/ipc/vfs.h
rb19e892 r9c4cf0d 67 67 VFS_IN_RESIZE, 68 68 VFS_IN_STAT, 69 VFS_IN_CLOSE,70 69 VFS_IN_MOUNT, 70 VFS_IN_PUT, 71 71 VFS_IN_UNMOUNT, 72 72 VFS_IN_SYNC, -
uspace/lib/c/include/unistd.h
rb19e892 r9c4cf0d 61 61 extern ssize_t read(int, aoff64_t *, void *, size_t); 62 62 63 extern int close(int);64 65 63 extern char *getcwd(char *, size_t); 66 64 extern int chdir(const char *); -
uspace/lib/c/include/vfs/vfs.h
rb19e892 r9c4cf0d 97 97 unsigned, int *); 98 98 extern int vfs_open(int, int); 99 extern int vfs_put(int); 99 100 extern int vfs_resize(int, aoff64_t); 100 101 extern int vfs_root(void);
Note:
See TracChangeset
for help on using the changeset viewer.