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


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/string.c

    r10de842 r0d0b319  
    4141
    4242#include "posix/assert.h"
    43 #include "posix/errno.h"
     43
     44#include <errno.h>
     45
    4446#include "posix/limits.h"
    4547#include "posix/stdlib.h"
     
    615617char *posix_strerror(int errnum)
    616618{
    617         static const char *error_msgs[] = {
    618                 [E2BIG] = "[E2BIG] Argument list too long",
    619                 [EACCES] = "[EACCES] Permission denied",
    620                 [EADDRINUSE] = "[EADDRINUSE] Address in use",
    621                 [EADDRNOTAVAIL] = "[EADDRNOTAVAIL] Address not available",
    622                 [EAFNOSUPPORT] = "[EAFNOSUPPORT] Address family not supported",
    623                 [EAGAIN] = "[EAGAIN] Resource unavailable, try again",
    624                 [EALREADY] = "[EALREADY] Connection already in progress",
    625                 [EBADF] = "[EBADF] Bad file descriptor",
    626                 [EBADMSG] = "[EBADMSG] Bad message",
    627                 [EBUSY] = "[EBUSY] Device or resource busy",
    628                 [ECANCELED] = "[ECANCELED] Operation canceled",
    629                 [ECHILD] = "[ECHILD] No child processes",
    630                 [ECONNABORTED] = "[ECONNABORTED] Connection aborted",
    631                 [ECONNREFUSED] = "[ECONNREFUSED] Connection refused",
    632                 [ECONNRESET] = "[ECONNRESET] Connection reset",
    633                 [EDEADLK] = "[EDEADLK] Resource deadlock would occur",
    634                 [EDESTADDRREQ] = "[EDESTADDRREQ] Destination address required",
    635                 [EDOM] = "[EDOM] Mathematics argument out of domain of function",
    636                 [EDQUOT] = "[EDQUOT] Reserved",
    637                 [EEXIST] = "[EEXIST] File exists",
    638                 [EFAULT] = "[EFAULT] Bad address",
    639                 [EFBIG] = "[EFBIG] File too large",
    640                 [EHOSTUNREACH] = "[EHOSTUNREACH] Host is unreachable",
    641                 [EIDRM] = "[EIDRM] Identifier removed",
    642                 [EILSEQ] = "[EILSEQ] Illegal byte sequence",
    643                 [EINPROGRESS] = "[EINPROGRESS] Operation in progress",
    644                 [EINTR] = "[EINTR] Interrupted function",
    645                 [EINVAL] = "[EINVAL] Invalid argument",
    646                 [EIO] = "[EIO] I/O error",
    647                 [EISCONN] = "[EISCONN] Socket is connected",
    648                 [EISDIR] = "[EISDIR] Is a directory",
    649                 [ELOOP] = "[ELOOP] Too many levels of symbolic links",
    650                 [EMFILE] = "[EMFILE] File descriptor value too large",
    651                 [EMLINK] = "[EMLINK] Too many links",
    652                 [EMSGSIZE] = "[EMSGSIZE] Message too large",
    653                 [EMULTIHOP] = "[EMULTIHOP] Reserved",
    654                 [ENAMETOOLONG] = "[ENAMETOOLONG] Filename too long",
    655                 [ENETDOWN] = "[ENETDOWN] Network is down",
    656                 [ENETRESET] = "[ENETRESET] Connection aborted by network",
    657                 [ENETUNREACH] = "[ENETUNREACH] Network unreachable",
    658                 [ENFILE] = "[ENFILE] Too many files open in system",
    659                 [ENOBUFS] = "[ENOBUFS] No buffer space available",
    660                 [ENODATA] = "[ENODATA] No message is available on the STREAM head read queue",
    661                 [ENODEV] = "[ENODEV] No such device",
    662                 [ENOENT] = "[ENOENT] No such file or directory",
    663                 [ENOEXEC] = "[ENOEXEC] Executable file format error",
    664                 [ENOLCK] = "[ENOLCK] No locks available",
    665                 [ENOLINK] = "[ENOLINK] Reserved",
    666                 [ENOMEM] = "[ENOMEM] Not enough space",
    667                 [ENOMSG] = "[ENOMSG] No message of the desired type",
    668                 [ENOPROTOOPT] = "[ENOPROTOOPT] Protocol not available",
    669                 [ENOSPC] = "[ENOSPC] No space left on device",
    670                 [ENOSR] = "[ENOSR] No STREAM resources.",
    671                 [ENOSTR] = "[ENOSTR] Not a STREAM",
    672                 [ENOSYS] = "[ENOSYS] Function not supported",
    673                 [ENOTCONN] = "[ENOTCONN] The socket is not connected",
    674                 [ENOTDIR] = "[ENOTDIR] Not a directory",
    675                 [ENOTEMPTY] = "[ENOTEMPTY] Directory not empty",
    676                 [ENOTRECOVERABLE] = "[ENOTRECOVERABLE] State not recoverable",
    677                 [ENOTSOCK] = "[ENOTSOCK] Not a socket",
    678                 [ENOTSUP] = "[ENOTSUP] Not supported",
    679                 [ENOTTY] = "[ENOTTY] Inappropriate I/O control operation",
    680                 [ENXIO] = "[ENXIO] No such device or address",
    681                 [EOPNOTSUPP] = "[EOPNOTSUPP] Operation not supported",
    682                 [EOVERFLOW] = "[EOVERFLOW] Value too large to be stored in data type",
    683                 [EOWNERDEAD] = "[EOWNERDEAD] Previous owned died",
    684                 [EPERM] = "[EPERM] Operation not permitted",
    685                 [EPIPE] = "[EPIPE] Broken pipe",
    686                 [EPROTO] = "[EPROTO] Protocol error",
    687                 [EPROTONOSUPPORT] = "[EPROTONOSUPPORT] Protocol not supported",
    688                 [EPROTOTYPE] = "[EPROTOTYPE] Protocol wrong type for socket",
    689                 [ERANGE] = "[ERANGE] Result too large",
    690                 [EROFS] = "[EROFS] Read-only file system",
    691                 [ESPIPE] = "[ESPIPE] Invalid seek",
    692                 [ESRCH] = "[ESRCH] No such process",
    693                 [ESTALE] = "[ESTALE] Reserved",
    694                 [ETIME] = "[ETIME] Stream ioctl() timeout",
    695                 [ETIMEDOUT] = "[ETIMEDOUT] Connection timed out",
    696                 [ETXTBSY] = "[ETXTBSY] Text file busy",
    697                 [EWOULDBLOCK] = "[EWOULDBLOCK] Operation would block",
    698                 [EXDEV] = "[EXDEV] Cross-device link",
    699         };
    700 
    701         return (char *) error_msgs[posix_abs(errnum)];
     619        // FIXME: move strerror() and strerror_r() to libc.
     620        return (char *) str_error(errnum);
    702621}
    703622
     
    722641        }
    723642
    724         return 0;
     643        return EOK;
    725644}
    726645
Note: See TracChangeset for help on using the changeset viewer.