Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/source/sys/stat.c

    r59f388a r6afc9d7  
    3939#include "../internal/common.h"
    4040#include "posix/sys/stat.h"
    41 #include "libc/vfs/vfs.h"
     41#include "libc/sys/stat.h"
    4242
    4343#include "posix/errno.h"
     
    4949 * @param dest POSIX stat struct.
    5050 * @param src HelenOS stat struct.
    51  *
    52  * @return 0 on success, -1 on error.
    5351 */
    54 static int stat_to_posix(struct posix_stat *dest, struct stat *src)
     52static void stat_to_posix(struct posix_stat *dest, struct stat *src)
    5553{
    5654        memset(dest, 0, sizeof(struct posix_stat));
     
    7068        dest->st_nlink = src->lnkcnt;
    7169        dest->st_size = src->size;
    72 
    73         if (src->size > INT64_MAX) {
    74                 errno = ERANGE;
    75                 return -1;
    76         }
    77 
    78         return 0;
    7970}
    8071
     
    8980{
    9081        struct stat hst;
    91         int rc = rcerrno(vfs_stat, fd, &hst);
     82        int rc = negerrno(fstat, fd, &hst);
    9283        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;
    9587}
    9688
     
    118110{
    119111        struct stat hst;
    120         int rc = rcerrno(vfs_stat_path, path, &hst);
     112        int rc = negerrno(stat, path, &hst);
    121113        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;
    124117}
    125118
     
    131124 * @return Zero on success, -1 otherwise.
    132125 */
    133 int posix_chmod(const char *path, posix_mode_t mode)
     126int posix_chmod(const char *path, mode_t mode)
    134127{
    135128        /* HelenOS doesn't support permissions, return success. */
     
    144137 * @return Previous file mode creation mask.
    145138 */
    146 posix_mode_t posix_umask(posix_mode_t mask)
     139mode_t posix_umask(mode_t mask)
    147140{
    148141        /* HelenOS doesn't support permissions, return empty mask. */
     
    150143}
    151144
    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         else
    165                 return 0;
    166 }
    167 
    168145/** @}
    169146 */
Note: See TracChangeset for help on using the changeset viewer.