Changes in uspace/lib/posix/source/sys/stat.c [59f388a:6afc9d7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/source/sys/stat.c
r59f388a r6afc9d7 39 39 #include "../internal/common.h" 40 40 #include "posix/sys/stat.h" 41 #include "libc/ vfs/vfs.h"41 #include "libc/sys/stat.h" 42 42 43 43 #include "posix/errno.h" … … 49 49 * @param dest POSIX stat struct. 50 50 * @param src HelenOS stat struct. 51 *52 * @return 0 on success, -1 on error.53 51 */ 54 static intstat_to_posix(struct posix_stat *dest, struct stat *src)52 static void stat_to_posix(struct posix_stat *dest, struct stat *src) 55 53 { 56 54 memset(dest, 0, sizeof(struct posix_stat)); … … 70 68 dest->st_nlink = src->lnkcnt; 71 69 dest->st_size = src->size; 72 73 if (src->size > INT64_MAX) {74 errno = ERANGE;75 return -1;76 }77 78 return 0;79 70 } 80 71 … … 89 80 { 90 81 struct stat hst; 91 int rc = rcerrno(vfs_stat, fd, &hst);82 int rc = negerrno(fstat, fd, &hst); 92 83 if (rc < 0) 93 return -1; 94 return stat_to_posix(st, &hst); 84 return rc; 85 stat_to_posix(st, &hst); 86 return 0; 95 87 } 96 88 … … 118 110 { 119 111 struct stat hst; 120 int rc = rcerrno(vfs_stat_path, path, &hst);112 int rc = negerrno(stat, path, &hst); 121 113 if (rc < 0) 122 return -1; 123 return stat_to_posix(st, &hst); 114 return rc; 115 stat_to_posix(st, &hst); 116 return 0; 124 117 } 125 118 … … 131 124 * @return Zero on success, -1 otherwise. 132 125 */ 133 int posix_chmod(const char *path, posix_mode_t mode)126 int posix_chmod(const char *path, mode_t mode) 134 127 { 135 128 /* HelenOS doesn't support permissions, return success. */ … … 144 137 * @return Previous file mode creation mask. 145 138 */ 146 posix_mode_t posix_umask(posix_mode_t mask)139 mode_t posix_umask(mode_t mask) 147 140 { 148 141 /* HelenOS doesn't support permissions, return empty mask. */ … … 150 143 } 151 144 152 /**153 * Create a directory.154 *155 * @param path Path to the new directory.156 * @param mode Permission bits to be set.157 * @return Zero on success, -1 otherwise.158 */159 int posix_mkdir(const char *path, posix_mode_t mode)160 {161 int rc = rcerrno(vfs_link_path, path, KIND_DIRECTORY, NULL);162 if (rc != EOK)163 return -1;164 else165 return 0;166 }167 168 145 /** @} 169 146 */
Note:
See TracChangeset
for help on using the changeset viewer.