Skip to content

Commit 2b515d7

Browse files
hlefdavidchisnall
authored andcommitted
Add a FreeRTOS_errno.h header.
This header defines errno values used by FreeRTOS+TCP. This used to be called `FreeRTOS_errno_TCP.h` and part of the FreeRTOS+TCP tree, until it was removed because integrated in the FreeRTOS core, which we do not use. We therefore re-introduce it here in the compatibility layer. Signed-off-by: Hugo Lefeuvre <[email protected]>
1 parent 83b39b4 commit 2b515d7

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright SCI Semiconductor and CHERIoT Contributors.
2+
// SPDX-License-Identifier: MIT
3+
4+
#pragma once
5+
6+
#include <errno.h>
7+
8+
/**
9+
* This header defines errno values used by FreeRTOS+TCP.
10+
*
11+
* In the FreeRTOS core tree, this is included in `projdefs.h`.
12+
*
13+
* We modified it here to use the same errno codes are the CHERIoT core when
14+
* possible.
15+
*/
16+
17+
#define pdFREERTOS_ERRNO_NONE 0 // No errors
18+
#define pdFREERTOS_ERRNO_ENOENT ENOENT // No such file or directory
19+
#define pdFREERTOS_ERRNO_EINTR EINTR // Interrupted system call
20+
#define pdFREERTOS_ERRNO_EIO EIO // I/O error
21+
#define pdFREERTOS_ERRNO_ENXIO ENXIO // No such device or address
22+
#define pdFREERTOS_ERRNO_EBADF EBADF // Bad file number
23+
#define pdFREERTOS_ERRNO_EAGAIN EAGAIN // No more processes
24+
#define pdFREERTOS_ERRNO_EWOULDBLOCK EWOULDBLOCK // Operation would block
25+
#define pdFREERTOS_ERRNO_ENOMEM ENOMEM // Not enough memory
26+
#define pdFREERTOS_ERRNO_EACCES EACCES // Permission denied
27+
#define pdFREERTOS_ERRNO_EFAULT EFAULT // Bad address
28+
#define pdFREERTOS_ERRNO_EBUSY EBUSY // Mount device busy
29+
#define pdFREERTOS_ERRNO_EEXIST EEXIST // File exists
30+
#define pdFREERTOS_ERRNO_EXDEV EXDEV // Cross-device link
31+
#define pdFREERTOS_ERRNO_ENODEV ENODEV // No such device
32+
#define pdFREERTOS_ERRNO_ENOTDIR ENOTDIR // Not a directory
33+
#define pdFREERTOS_ERRNO_EISDIR EISDIR // Is a directory
34+
#define pdFREERTOS_ERRNO_EINVAL EINVAL // Invalid argument
35+
#define pdFREERTOS_ERRNO_ENOSPC ENOSPC // No space left on device
36+
#define pdFREERTOS_ERRNO_ESPIPE ESPIPE // Illegal seek
37+
#define pdFREERTOS_ERRNO_EROFS EROFS // Read only file system
38+
#define pdFREERTOS_ERRNO_EUNATCH EUNATCH // Protocol driver not attached
39+
#define pdFREERTOS_ERRNO_EBADE EBADE // Invalid exchange
40+
#define pdFREERTOS_ERRNO_EFTYPE EFTYPE // Inappropriate file type or format
41+
#define pdFREERTOS_ERRNO_ENOTEMPTY ENOTEMPTY // Directory not empty
42+
#define pdFREERTOS_ERRNO_ENAMETOOLONG ENAMETOOLONG // File or path name too long
43+
#define pdFREERTOS_ERRNO_EOPNOTSUPP EOPNOTSUPP // Operation not supported on transport endpoint
44+
#define pdFREERTOS_ERRNO_EAFNOSUPPORT EAFNOSUPPORT // Address family not supported by protocol
45+
#define pdFREERTOS_ERRNO_ENOBUFS ENOBUFS // No buffer space available
46+
#define pdFREERTOS_ERRNO_ENOPROTOOPT ENOPROTOOPT // Protocol not available
47+
#define pdFREERTOS_ERRNO_EADDRINUSE EADDRINUSE // Address already in use
48+
#define pdFREERTOS_ERRNO_ETIMEDOUT ETIMEDOUT // Connection timed out
49+
#define pdFREERTOS_ERRNO_EINPROGRESS EINPROGRESS // Connection already in progress
50+
#define pdFREERTOS_ERRNO_EALREADY EALREADY // Socket already connected
51+
#define pdFREERTOS_ERRNO_EADDRNOTAVAIL EADDRNOTAVAIL // Address not available
52+
#define pdFREERTOS_ERRNO_EISCONN EISCONN // Socket is already connected
53+
#define pdFREERTOS_ERRNO_ENOTCONN ENOTCONN // Socket is not connected
54+
#define pdFREERTOS_ERRNO_ENOMEDIUM ENOMEDIUM // No medium inserted
55+
#define pdFREERTOS_ERRNO_EILSEQ EILSEQ // An invalid UTF-16 sequence was encountered
56+
#define pdFREERTOS_ERRNO_ECANCELED ECANCELED // Operation canceled
57+
58+
/**
59+
* These errno codes are non-standard, assign them a code outside our errno
60+
* range.
61+
*/
62+
63+
#define pdFREERTOS_ERRNO_ENMFILE (__ELASTERROR + 1) // No more files

sdk/include/errno.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#define ENOMSG 42 // No message of the desired type.
4747
#define EIDRM 43 // Identifier removed.
4848
#define EDEADLK 45 // Resource deadlock would occur.
49+
#define EUNATCH 49 // Protocol driver not attached.
50+
#define EBADE 52 // Invalid exchange.
4951
#define ENOSTR 60 // Not a STREAM.
5052
#define ENODATA 61 // No data available.
5153
#define ETIME 62 // Timer expired.
@@ -54,6 +56,7 @@
5456
#define EPROTO 71 // Protocol error.
5557
#define EMULTIHOP 72 // Reserved.
5658
#define EBADMSG 74 // Bad message.
59+
#define EFTYPE 79 // Inappropriate file type or format.
5760
#define EILSEQ 84 // Illegal byte sequence.
5861
#define ENOTSOCK 88 // Not a socket.
5962
#define EDESTADDRREQ 89 // Destination address required.
@@ -80,6 +83,7 @@
8083
#define EINPROGRESS 115 // Operation in progress.
8184
#define ESTALE 116 // Reserved.
8285
#define EDQUOT 122 // Reserved.
86+
#define ENOMEDIUM 123 // No medium inserted.
8387
#define ECANCELED 125 // Operation canceled.
8488
#define EOWNERDEAD 130 // Previous owner died.
8589
#define ENOTRECOVERABLE 131 // State not recoverable.

0 commit comments

Comments
 (0)