From 3aa99f91e82e5e8cc93ec98fbaa1c4458c210b59 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Thu, 23 Mar 2023 17:41:14 +0100
Subject: [PATCH] [libc] add missing POSIX errnos

---
 share/libc/errno.h                     | 2 ++
 share/machdeps/machdep_avr_16.yaml     | 2 ++
 share/machdeps/machdep_gcc_x86_16.yaml | 2 ++
 share/machdeps/machdep_gcc_x86_32.yaml | 2 ++
 share/machdeps/machdep_gcc_x86_64.yaml | 2 ++
 share/machdeps/machdep_ppc_32.yaml     | 2 ++
 share/machdeps/machdep_x86_16.yaml     | 2 ++
 share/machdeps/machdep_x86_32.yaml     | 2 ++
 share/machdeps/machdep_x86_64.yaml     | 2 ++
 share/machdeps/make_machdep/errno.c    | 7 +++++++
 10 files changed, 25 insertions(+)

diff --git a/share/libc/errno.h b/share/libc/errno.h
index ea398ffc8f1..2fa3792a89d 100644
--- a/share/libc/errno.h
+++ b/share/libc/errno.h
@@ -117,6 +117,7 @@ __PUSH_FC_STDLIB
 #define ENOTCONN __FC_ENOTCONN
 #define ENOTDIR __FC_ENOTDIR
 #define ENOTEMPTY __FC_ENOTEMPTY
+#define ENOTRECOVERABLE __FC_ENOTRECOVERABLE
 #define ENOTSOCK __FC_ENOTSOCK
 #define ENOTSUP __FC_ENOTSUP
 #define ENOTTY __FC_ENOTTY
@@ -124,6 +125,7 @@ __PUSH_FC_STDLIB
 #define ENXIO __FC_ENXIO
 #define EOPNOTSUPP __FC_EOPNOTSUPP
 #define EOVERFLOW __FC_EOVERFLOW
+#define EOWNER_DEAD __FC_EOWNER_DEAD
 #define EPERM __FC_EPERM
 #define EPFNOSUPPORT __FC_EPFNOSUPPORT
 #define EPIPE __FC_EPIPE
diff --git a/share/machdeps/machdep_avr_16.yaml b/share/machdeps/machdep_avr_16.yaml
index bbf6aff51fb..6f83dbf1fa9 100644
--- a/share/machdeps/machdep_avr_16.yaml
+++ b/share/machdeps/machdep_avr_16.yaml
@@ -105,6 +105,7 @@ errno:
     enotconn: '107'
     enotdir: '20'
     enotempty: '39'
+    enotrecoverable: '131'
     enotsock: '88'
     enotsup: '95'
     enotty: '25'
@@ -112,6 +113,7 @@ errno:
     enxio: '6'
     eopnotsupp: '95'
     eoverflow: '75'
+    eownerdead: '130'
     eperm: '1'
     epfnosupport: '96'
     epipe: '32'
diff --git a/share/machdeps/machdep_gcc_x86_16.yaml b/share/machdeps/machdep_gcc_x86_16.yaml
index 1e1098967c0..7b16598bcee 100644
--- a/share/machdeps/machdep_gcc_x86_16.yaml
+++ b/share/machdeps/machdep_gcc_x86_16.yaml
@@ -101,6 +101,7 @@ errno:
     enotconn: '107'
     enotdir: '20'
     enotempty: '39'
+    enotrecoverable: '131'
     enotsock: '88'
     enotsup: '95'
     enotty: '25'
@@ -108,6 +109,7 @@ errno:
     enxio: '6'
     eopnotsupp: '95'
     eoverflow: '75'
+    eownerdead: '130'
     eperm: '1'
     epfnosupport: '96'
     epipe: '32'
diff --git a/share/machdeps/machdep_gcc_x86_32.yaml b/share/machdeps/machdep_gcc_x86_32.yaml
index 31a960d7521..911e754b71f 100644
--- a/share/machdeps/machdep_gcc_x86_32.yaml
+++ b/share/machdeps/machdep_gcc_x86_32.yaml
@@ -103,6 +103,7 @@ errno:
     enotconn: '107'
     enotdir: '20'
     enotempty: '39'
+    enotrecoverable: '131'
     enotsock: '88'
     enotsup: '95'
     enotty: '25'
@@ -110,6 +111,7 @@ errno:
     enxio: '6'
     eopnotsupp: '95'
     eoverflow: '75'
+    eownerdead: '130'
     eperm: '1'
     epfnosupport: '96'
     epipe: '32'
diff --git a/share/machdeps/machdep_gcc_x86_64.yaml b/share/machdeps/machdep_gcc_x86_64.yaml
index f87a36a2596..f504c136e01 100644
--- a/share/machdeps/machdep_gcc_x86_64.yaml
+++ b/share/machdeps/machdep_gcc_x86_64.yaml
@@ -103,6 +103,7 @@ errno:
     enotconn: '107'
     enotdir: '20'
     enotempty: '39'
+    enotrecoverable: '131'
     enotsock: '88'
     enotsup: '95'
     enotty: '25'
@@ -110,6 +111,7 @@ errno:
     enxio: '6'
     eopnotsupp: '95'
     eoverflow: '75'
+    eownerdead: '130'
     eperm: '1'
     epfnosupport: '96'
     epipe: '32'
diff --git a/share/machdeps/machdep_ppc_32.yaml b/share/machdeps/machdep_ppc_32.yaml
index 3236aa762f2..46b460e5ba1 100644
--- a/share/machdeps/machdep_ppc_32.yaml
+++ b/share/machdeps/machdep_ppc_32.yaml
@@ -105,6 +105,7 @@ errno:
     enotconn: '107'
     enotdir: '20'
     enotempty: '39'
+    enotrecoverable: '131'
     enotsock: '88'
     enotsup: '95'
     enotty: '25'
@@ -112,6 +113,7 @@ errno:
     enxio: '6'
     eopnotsupp: '95'
     eoverflow: '75'
+    eownerdead: '130'
     eperm: '1'
     epfnosupport: '96'
     epipe: '32'
diff --git a/share/machdeps/machdep_x86_16.yaml b/share/machdeps/machdep_x86_16.yaml
index 119373b9943..3d6cd2109e1 100644
--- a/share/machdeps/machdep_x86_16.yaml
+++ b/share/machdeps/machdep_x86_16.yaml
@@ -101,6 +101,7 @@ errno:
     enotconn: '107'
     enotdir: '20'
     enotempty: '39'
+    enotrecoverable: '131'
     enotsock: '88'
     enotsup: '95'
     enotty: '25'
@@ -108,6 +109,7 @@ errno:
     enxio: '6'
     eopnotsupp: '95'
     eoverflow: '75'
+    eownerdead: '130'
     eperm: '1'
     epfnosupport: '96'
     epipe: '32'
diff --git a/share/machdeps/machdep_x86_32.yaml b/share/machdeps/machdep_x86_32.yaml
index 6cee4a37cb6..12db8ccfb91 100644
--- a/share/machdeps/machdep_x86_32.yaml
+++ b/share/machdeps/machdep_x86_32.yaml
@@ -103,6 +103,7 @@ errno:
     enotconn: '107'
     enotdir: '20'
     enotempty: '39'
+    enotrecoverable: '131'
     enotsock: '88'
     enotsup: '95'
     enotty: '25'
@@ -110,6 +111,7 @@ errno:
     enxio: '6'
     eopnotsupp: '95'
     eoverflow: '75'
+    eownerdead: '130'
     eperm: '1'
     epfnosupport: '96'
     epipe: '32'
diff --git a/share/machdeps/machdep_x86_64.yaml b/share/machdeps/machdep_x86_64.yaml
index a9d4dfcb7c4..fc5f83a43c4 100644
--- a/share/machdeps/machdep_x86_64.yaml
+++ b/share/machdeps/machdep_x86_64.yaml
@@ -103,6 +103,7 @@ errno:
     enotconn: '107'
     enotdir: '20'
     enotempty: '39'
+    enotrecoverable: '131'
     enotsock: '88'
     enotsup: '95'
     enotty: '25'
@@ -110,6 +111,7 @@ errno:
     enxio: '6'
     eopnotsupp: '95'
     eoverflow: '75'
+    eownerdead: '130'
     eperm: '1'
     epfnosupport: '96'
     epipe: '32'
diff --git a/share/machdeps/make_machdep/errno.c b/share/machdeps/make_machdep/errno.c
index 34edccd40ff..f3b2b39d00d 100644
--- a/share/machdeps/make_machdep/errno.c
+++ b/share/machdeps/make_machdep/errno.c
@@ -20,6 +20,7 @@
 /*                                                                        */
 /**************************************************************************/
 
+#include <asm-generic/errno.h>
 #include <errno.h>
 
 /* Mandatory */
@@ -280,6 +281,9 @@ int enotdir_is = ENOTDIR;
 #ifdef ENOTEMPTY
 int enotempty_is = ENOTEMPTY;
 #endif
+#ifdef ENOTRECOVERABLE
+int enotrecoverable_is = ENOTRECOVERABLE;
+#endif
 #ifdef ENOTSOCK
 int enotsock_is = ENOTSOCK;
 #endif
@@ -301,6 +305,9 @@ int eopnotsupp_is = EOPNOTSUPP;
 #ifdef EOVERFLOW
 int eoverflow_is = EOVERFLOW;
 #endif
+#ifdef EOWNERDEAD
+int eownerdead_is = EOWNERDEAD;
+#endif
 #ifdef EPERM
 int eperm_is = EPERM;
 #endif
-- 
GitLab