Changeset 23a0368 in mainline for uspace/lib/posix/source


Ignore:
Timestamp:
2017-03-30T19:52:23Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ae7bfbbd
Parents:
b5b5d84
Message:

Rename stat() to vfs_stat_path() and fstat() to vfs_stat()

Location:
uspace/lib/posix/source
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/source/internal/common.h

    rb5b5d84 r23a0368  
    5959})
    6060
     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
    6169extern aoff64_t posix_pos[MAX_OPEN_FILES];
    6270
  • uspace/lib/posix/source/sys/stat.c

    rb5b5d84 r23a0368  
    3939#include "../internal/common.h"
    4040#include "posix/sys/stat.h"
    41 #include "libc/sys/stat.h"
     41#include "libc/vfs/vfs.h"
    4242
    4343#include "posix/errno.h"
     
    8080{
    8181        struct stat hst;
    82         int rc = negerrno(fstat, fd, &hst);
     82        int rc = rcerrno(vfs_stat, fd, &hst);
    8383        if (rc < 0)
    84                 return rc;
     84                return -1;
    8585        stat_to_posix(st, &hst);
    8686        return 0;
     
    110110{
    111111        struct stat hst;
    112         int rc = negerrno(stat, path, &hst);
     112        int rc = rcerrno(vfs_stat_path, path, &hst);
    113113        if (rc < 0)
    114                 return rc;
     114                return -1;
    115115        stat_to_posix(st, &hst);
    116116        return 0;
  • uspace/lib/posix/source/unistd.c

    rb5b5d84 r23a0368  
    4848#include "libc/malloc.h"
    4949#include "libc/vfs/vfs.h"
    50 #include "libc/sys/stat.h"
    5150
    5251aoff64_t posix_pos[MAX_OPEN_FILES];
     
    221220{
    222221        struct stat st;
     222        int rc;
    223223
    224224        switch (whence) {
     
    230230                break;
    231231        case SEEK_END:
    232                 if (fstat(fildes, &st) != EOK) {
    233                         errno = -errno;
     232                rc = rcerrno(vfs_stat, fildes, &st);
     233                if (rc != EOK)
    234234                        return -1;
    235                 }
    236235                posix_pos[fildes] = st.size + offset;
    237236                break;
Note: See TracChangeset for help on using the changeset viewer.