1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- /*
- * errno.c
- *
- * Copyright (C) 2017 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include <errno.h>
- #include <monolithium.h>
- int errno = 0;
- int __crt_translate_error(uint32_t status_code)
- {
- switch (status_code)
- {
- case ERR_NOTFOUND:
- return ENOENT;
- case ERR_FORBIDDEN:
- return EACCES;
- case ERR_INVALID:
- return EINVAL;
- case ERR_EXISTS:
- return EEXIST;
- case ERR_NOMEMORY:
- return ENOMEM;
- case ERR_HARDWARE:
- return EIO;
- case ERR_BUSY:
- return EAGAIN;
- case ERR_WRITEPROT:
- return EROFS;
- case ERR_NOSYSCALL:
- return ENOSYS;
- case ERR_TIMEOUT:
- return ETIMEDOUT;
- case ERR_BADPTR:
- return EFAULT;
- case ERR_CANCELED:
- return ECANCELED;
- case ERR_ISDIR:
- return EISDIR;
- case ERR_ISNOTDIR:
- return ENOTDIR;
- case ERR_DISKFULL:
- return ENOSPC;
- case ERR_BEYOND:
- return ENXIO;
- case ERR_SMALLBUF:
- return ETOOSMALL;
- default:
- return 0;
- }
- }
|