Ignore:
Timestamp:
2018-01-04T20:03:02Z (6 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/internal/common.h

    r10de842 r0d0b319  
    5050        } while (0)
    5151
    52 /* Convert negative errno to positive errno */
    53 #define negerrno(func, ...) ({ \
    54         int rc = func(__VA_ARGS__); \
    55         if (rc < 0) { \
    56                 errno = -errno; \
    57         } \
    58         rc; \
    59 })
    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 })
     52/* Checks if the value is a failing error code.
     53 * If so, writes the error code to errno and returns true.
     54 */
     55static inline bool failed(int rc) {
     56        if (rc != EOK) {
     57                errno = rc;
     58                return true;
     59        }
     60        return false;
     61}
    6862
    6963extern aoff64_t posix_pos[MAX_OPEN_FILES];
Note: See TracChangeset for help on using the changeset viewer.