Changeset 0d0b319 in mainline for uspace/lib/posix/source/unistd.c
- Timestamp:
- 2018-01-04T20:03:02Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3c7702c0
- Parents:
- 10de842
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 19:18:29)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:03:02)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/source/unistd.c
r10de842 r0d0b319 40 40 #include "posix/unistd.h" 41 41 42 #include "posix/errno.h" 42 #include <errno.h> 43 43 44 #include "posix/string.h" 44 45 #include "posix/fcntl.h" … … 52 53 #include <libarch/config.h> 53 54 55 // FIXME: replace with a hash table 54 56 aoff64_t posix_pos[MAX_OPEN_FILES]; 55 57 … … 126 128 char *posix_getcwd(char *buf, size_t size) 127 129 { 128 int rc = rcerrno(vfs_cwd_get, buf, size); 129 if (rc != EOK) 130 if (failed(vfs_cwd_get(buf, size))) 130 131 return NULL; 131 132 return buf; … … 139 140 int posix_chdir(const char *path) 140 141 { 141 int rc = rcerrno(vfs_cwd_set, path); 142 if (rc != EOK) 142 if (failed(vfs_cwd_set(path))) 143 143 return -1; 144 144 return 0; … … 196 196 { 197 197 posix_pos[fildes] = 0; 198 int rc = rcerrno(vfs_put, fildes); 199 if (rc != EOK) 198 if (failed(vfs_put(fildes))) 200 199 return -1; 201 200 else … … 214 213 { 215 214 size_t nread; 216 int rc; 217 218 rc = rcerrno(vfs_read, fildes, &posix_pos[fildes], buf, nbyte, &nread); 219 if (rc != EOK) 215 if (failed(vfs_read(fildes, &posix_pos[fildes], buf, nbyte, &nread))) 220 216 return -1; 221 217 return (ssize_t) nread; … … 233 229 { 234 230 size_t nwr; 235 int rc; 236 237 rc = rcerrno(vfs_write, fildes, &posix_pos[fildes], buf, nbyte, &nwr); 238 if (rc != EOK) 231 if (failed(vfs_write(fildes, &posix_pos[fildes], buf, nbyte, &nwr))) 239 232 return -1; 240 233 return nwr; … … 253 246 { 254 247 struct stat st; 255 int rc;256 248 257 249 switch (whence) { … … 263 255 break; 264 256 case SEEK_END: 265 rc = rcerrno(vfs_stat, fildes, &st); 266 if (rc != EOK) 257 if (failed(vfs_stat(fildes, &st))) 267 258 return -1; 268 259 posix_pos[fildes] = st.size + offset; … … 285 276 int posix_fsync(int fildes) 286 277 { 287 if ( rcerrno(vfs_sync, fildes) != EOK)278 if (failed(vfs_sync(fildes))) 288 279 return -1; 289 280 else … … 300 291 int posix_ftruncate(int fildes, posix_off_t length) 301 292 { 302 if ( rcerrno(vfs_resize, fildes, (aoff64_t) length) != EOK)293 if (failed(vfs_resize(fildes, (aoff64_t) length))) 303 294 return -1; 304 295 else … … 314 305 int posix_rmdir(const char *path) 315 306 { 316 if ( rcerrno(vfs_unlink_path, path) != EOK)307 if (failed(vfs_unlink_path(path))) 317 308 return -1; 318 309 else … … 328 319 int posix_unlink(const char *path) 329 320 { 330 if ( rcerrno(vfs_unlink_path, path) != EOK)321 if (failed(vfs_unlink_path(path))) 331 322 return -1; 332 323 else … … 356 347 { 357 348 int file; 358 int rc = vfs_clone(fildes, fildes2, false, &file); 359 if (rc != EOK) { 360 errno = rc < 0 ? -rc : rc; 349 if (failed(vfs_clone(fildes, fildes2, false, &file))) { 361 350 return -1; 362 351 }
Note:
See TracChangeset
for help on using the changeset viewer.