Ignore:
Timestamp:
2015-10-06T19:01:36Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0328987
Parents:
f1f7584
Message:

UNIX-like I/O functions should use errno to return error code for many reasons.

File:
1 edited

Legend:

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

    rf1f7584 r6afc9d7  
    4848        } while (0)
    4949
    50 /* A little helper macro to avoid typing this over and over. */
     50/* Convert negative error return value to positive errno */
    5151#define errnify(func, ...) ({ \
    5252        int rc = func(__VA_ARGS__); \
     
    5858})
    5959
     60/* Convert negative errno to positive errno */
     61#define negerrno(func, ...) ({ \
     62        int rc = func(__VA_ARGS__); \
     63        if (rc < 0) { \
     64                errno = -errno; \
     65        } \
     66        rc; \
     67})
     68
    6069#endif /* LIBPOSIX_COMMON_H_ */
    6170
Note: See TracChangeset for help on using the changeset viewer.