libc: minimal: Align errno.h values with newlib

In order to be able to document the error codes with Doxygen and
Breathe, start by aligning the macro values to those provided by newlib
in include/sys/errno.h:

https://github.com/zephyrproject-rtos/newlib-cygwin/blob/zephyr-newlib-4.1.0/newlib/libc/include/sys/errno.h

Also get rid of the (unused and untrue) ERRMAX definition.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
diff --git a/lib/libc/minimal/include/errno.h b/lib/libc/minimal/include/errno.h
index cb50ef7..5ef527a 100644
--- a/lib/libc/minimal/include/errno.h
+++ b/lib/libc/minimal/include/errno.h
@@ -25,8 +25,9 @@
 
 #define errno (*z_errno())
 
-/*
- * POSIX Error codes
+/**
+ * Error codes returned by functions.
+ * Includes a list of those defined by IEEE Std 1003.1-2017.
  */
 
 #define EPERM 1		/* Not owner */
@@ -43,7 +44,7 @@
 #define ENOMEM 12       /* Not enough core */
 #define EACCES 13       /* Permission denied */
 #define EFAULT 14       /* Bad address */
-#define ENOTEMPTY 15    /* Directory not empty */
+#define	ENOTBLK 15	/* Block device required */
 #define EBUSY 16	/* Mount device busy */
 #define EEXIST 17       /* File exists */
 #define EXDEV 18	/* Cross-device link */
@@ -54,80 +55,62 @@
 #define ENFILE 23       /* File table overflow */
 #define EMFILE 24       /* Too many open files */
 #define ENOTTY 25       /* Not a typewriter */
-#define ENAMETOOLONG 26 /* File name too long */
+#define ETXTBSY 26      /* Text file busy */
 #define EFBIG 27	/* File too large */
 #define ENOSPC 28       /* No space left on device */
 #define ESPIPE 29       /* Illegal seek */
 #define EROFS 30	/* Read-only file system */
 #define EMLINK 31       /* Too many links */
 #define EPIPE 32	/* Broken pipe */
-#define EDEADLK 33      /* Resource deadlock avoided */
-#define ENOLCK 34       /* No locks available */
-#define ENOTSUP 35      /* Unsupported value */
-#define EMSGSIZE 36     /* Message size */
+#define EDOM 33         /* Argument too large */
+#define ERANGE 34       /* Result too large */
+#define ENOMSG 35       /* Unexpected message type */
+#define EDEADLK 45      /* Resource deadlock avoided */
+#define ENOLCK 46       /* No locks available */
+#define ENOSTR 60       /* STREAMS device required */
+#define ENODATA 61      /* Missing expected message data */
+#define ETIME 62        /* STREAMS timeout occurred */
+#define ENOSR 63        /* Insufficient memory */
+#define EPROTO 71       /* Generic STREAMS error */
+#define EBADMSG 77      /* Invalid STREAMS message */
+#define ENOSYS 88       /* Function not implemented */
+#define ENOTEMPTY 90    /* Directory not empty */
+#define ENAMETOOLONG 91 /* File name too long */
+#define ELOOP 92	/* Too many levels of symbolic links */
+#define EOPNOTSUPP 95   /* Operation not supported on socket */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define ECONNRESET 104   /* Connection reset by peer */
+#define ENOBUFS 105      /* No buffer space available */
+#define EAFNOSUPPORT 106 /* Addr family not supported */
+#define EPROTOTYPE 107   /* Protocol wrong type for socket */
+#define ENOTSOCK 108	 /* Socket operation on non-socket */
+#define ENOPROTOOPT 109  /* Protocol not available */
+#define ESHUTDOWN 110    /* Can't send after socket shutdown */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EADDRINUSE 112   /* Address already in use */
+#define ECONNABORTED 113 /* Software caused connection abort */
+#define ENETUNREACH 114  /* Network is unreachable */
+#define ENETDOWN 115     /* Network is down */
+#define ETIMEDOUT 116    /* Connection timed out */
+#define EHOSTDOWN 117    /* Host is down */
+#define EHOSTUNREACH 118 /* No route to host */
+#define EINPROGRESS 119  /* Operation now in progress */
+#define EALREADY 120     /* Operation already in progress */
+#define EDESTADDRREQ 121 /* Destination address required */
+#define EMSGSIZE 122        /* Message size */
+#define EPROTONOSUPPORT 123 /* Protocol not supported */
+#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
+#define EADDRNOTAVAIL 125   /* Can't assign requested address */
+#define ENETRESET 126       /* Network dropped connection on reset */
+#define EISCONN 127         /* Socket is already connected */
+#define ENOTCONN 128        /* Socket is not connected */
+#define ETOOMANYREFS 129    /* Too many references: can't splice */
+#define ENOTSUP 134         /* Unsupported value */
+#define EILSEQ 138          /* Illegal byte sequence */
+#define ECANCELED 140       /* Operation canceled */
 
-/* ANSI math software */
-#define EDOM 37   /* Argument too large */
-#define ERANGE 38 /* Result too large */
-
-/* ipc/network software */
-
-/* argument errors */
-#define EDESTADDRREQ 40    /* Destination address required */
-#define EPROTOTYPE 41      /* Protocol wrong type for socket */
-#define ENOPROTOOPT 42     /* Protocol not available */
-#define EPROTONOSUPPORT 43 /* Protocol not supported */
-#define ESOCKTNOSUPPORT 44 /* Socket type not supported */
-#define EOPNOTSUPP 45      /* Operation not supported on socket */
-#define EPFNOSUPPORT 46    /* Protocol family not supported */
-#define EAFNOSUPPORT 47    /* Addr family not supported */
-#define EADDRINUSE 48      /* Address already in use */
-#define EADDRNOTAVAIL 49   /* Can't assign requested address */
-#define ENOTSOCK 50	/* Socket operation on non-socket */
-
-/* operational errors */
-#define ENETUNREACH 51  /* Network is unreachable */
-#define ENETRESET 52    /* Network dropped connection on reset */
-#define ECONNABORTED 53 /* Software caused connection abort */
-#define ECONNRESET 54   /* Connection reset by peer */
-#define ENOBUFS 55      /* No buffer space available */
-#define EISCONN 56      /* Socket is already connected */
-#define ENOTCONN 57     /* Socket is not connected */
-#define ESHUTDOWN 58    /* Can't send after socket shutdown */
-#define ETOOMANYREFS 59 /* Too many references: can't splice */
-#define ETIMEDOUT 60    /* Connection timed out */
-#define ECONNREFUSED 61 /* Connection refused */
-#define ENETDOWN 62     /* Network is down */
-#define ETXTBSY 63      /* Text file busy */
-#define ELOOP 64	/* Too many levels of symbolic links */
-#define EHOSTUNREACH 65 /* No route to host */
-#define ENOTBLK 66      /* Block device required */
-#define EHOSTDOWN 67    /* Host is down */
-
-/* non-blocking and interrupt i/o */
-#define EINPROGRESS 68 /* Operation now in progress */
-#define EALREADY 69    /* Operation already in progress */
 #define EWOULDBLOCK EAGAIN /* Operation would block */
 
-#define ENOSYS 71 /* Function not implemented */
-
-/* aio errors (should be under posix) */
-#define ECANCELED 72 /* Operation canceled */
-
-#define ERRMAX 81
-
-/* specific STREAMS errno values */
-
-#define ENOSR 74   /* Insufficient memory */
-#define ENOSTR 75  /* STREAMS device required */
-#define EPROTO 76  /* Generic STREAMS error */
-#define EBADMSG 77 /* Invalid STREAMS message */
-#define ENODATA 78 /* Missing expected message data */
-#define ETIME 79   /* STREAMS timeout occurred */
-#define ENOMSG 80  /* Unexpected message type */
-
-#define EILSEQ 138 /* Illegal byte sequence */
-
 #ifdef __cplusplus
 }
 #endif