Changeset 0d0b319 in mainline for uspace/lib/posix/source/unistd.c


Ignore:
Timestamp:
2018-01-04T20:03:02Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
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)
Message:

Flip error constants to positive values, and update libposix for the change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/source/unistd.c

    r10de842 r0d0b319  
    4040#include "posix/unistd.h"
    4141
    42 #include "posix/errno.h"
     42#include <errno.h>
     43
    4344#include "posix/string.h"
    4445#include "posix/fcntl.h"
     
    5253#include <libarch/config.h>
    5354
     55// FIXME: replace with a hash table
    5456aoff64_t posix_pos[MAX_OPEN_FILES];
    5557
     
    126128char *posix_getcwd(char *buf, size_t size)
    127129{
    128         int rc = rcerrno(vfs_cwd_get, buf, size);
    129         if (rc != EOK)
     130        if (failed(vfs_cwd_get(buf, size)))
    130131                return NULL;
    131132        return buf;
     
    139140int posix_chdir(const char *path)
    140141{
    141         int rc = rcerrno(vfs_cwd_set, path);
    142         if (rc != EOK)
     142        if (failed(vfs_cwd_set(path)))
    143143                return -1;
    144144        return 0;
     
    196196{
    197197        posix_pos[fildes] = 0;
    198         int rc = rcerrno(vfs_put, fildes);
    199         if (rc != EOK)
     198        if (failed(vfs_put(fildes)))
    200199                return -1;
    201200        else
     
    214213{
    215214        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)))
    220216                return -1;
    221217        return (ssize_t) nread;
     
    233229{
    234230        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)))
    239232                return -1;
    240233        return nwr;
     
    253246{
    254247        struct stat st;
    255         int rc;
    256248
    257249        switch (whence) {
     
    263255                break;
    264256        case SEEK_END:
    265                 rc = rcerrno(vfs_stat, fildes, &st);
    266                 if (rc != EOK)
     257                if (failed(vfs_stat(fildes, &st)))
    267258                        return -1;
    268259                posix_pos[fildes] = st.size + offset;
     
    285276int posix_fsync(int fildes)
    286277{
    287         if (rcerrno(vfs_sync, fildes) != EOK)
     278        if (failed(vfs_sync(fildes)))
    288279                return -1;
    289280        else
     
    300291int posix_ftruncate(int fildes, posix_off_t length)
    301292{
    302         if (rcerrno(vfs_resize, fildes, (aoff64_t) length) != EOK)
     293        if (failed(vfs_resize(fildes, (aoff64_t) length)))
    303294                return -1;
    304295        else
     
    314305int posix_rmdir(const char *path)
    315306{
    316         if (rcerrno(vfs_unlink_path, path) != EOK)
     307        if (failed(vfs_unlink_path(path)))
    317308                return -1;
    318309        else
     
    328319int posix_unlink(const char *path)
    329320{
    330         if (rcerrno(vfs_unlink_path, path) != EOK)
     321        if (failed(vfs_unlink_path(path)))
    331322                return -1;
    332323        else
     
    356347{
    357348        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))) {
    361350                return -1;
    362351        }
Note: See TracChangeset for help on using the changeset viewer.