Changeset 23a0368 in mainline for uspace/lib/posix/source
- Timestamp:
- 2017-03-30T19:52:23Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ae7bfbbd
- Parents:
- b5b5d84
- Location:
- uspace/lib/posix/source
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/source/internal/common.h
rb5b5d84 r23a0368 59 59 }) 60 60 61 /* Convert error code to positive errno and -1 return value */ 62 #define rcerrno(func, ...) ({ \ 63 int rc = func(__VA_ARGS__); \ 64 if (rc < 0) \ 65 errno = -rc; \ 66 rc; \ 67 }) 68 61 69 extern aoff64_t posix_pos[MAX_OPEN_FILES]; 62 70 -
uspace/lib/posix/source/sys/stat.c
rb5b5d84 r23a0368 39 39 #include "../internal/common.h" 40 40 #include "posix/sys/stat.h" 41 #include "libc/ sys/stat.h"41 #include "libc/vfs/vfs.h" 42 42 43 43 #include "posix/errno.h" … … 80 80 { 81 81 struct stat hst; 82 int rc = negerrno(fstat, fd, &hst);82 int rc = rcerrno(vfs_stat, fd, &hst); 83 83 if (rc < 0) 84 return rc;84 return -1; 85 85 stat_to_posix(st, &hst); 86 86 return 0; … … 110 110 { 111 111 struct stat hst; 112 int rc = negerrno(stat, path, &hst);112 int rc = rcerrno(vfs_stat_path, path, &hst); 113 113 if (rc < 0) 114 return rc;114 return -1; 115 115 stat_to_posix(st, &hst); 116 116 return 0; -
uspace/lib/posix/source/unistd.c
rb5b5d84 r23a0368 48 48 #include "libc/malloc.h" 49 49 #include "libc/vfs/vfs.h" 50 #include "libc/sys/stat.h"51 50 52 51 aoff64_t posix_pos[MAX_OPEN_FILES]; … … 221 220 { 222 221 struct stat st; 222 int rc; 223 223 224 224 switch (whence) { … … 230 230 break; 231 231 case SEEK_END: 232 if (fstat(fildes, &st) != EOK) {233 errno = -errno;232 rc = rcerrno(vfs_stat, fildes, &st); 233 if (rc != EOK) 234 234 return -1; 235 }236 235 posix_pos[fildes] = st.size + offset; 237 236 break;
Note:
See TracChangeset
for help on using the changeset viewer.