[libcxx-commits] [libcxx] [libc++] Add FreeBSD-specific EINTEGRITY errc value (PR #76364)

Dimitry Andric via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 25 08:48:35 PST 2023


DimitryAndric wrote:

Note that reviews.llvm.org seems to have dropped off the internet, so for reference the old diff we are still carrying (which I want to get rid of) is the following:

```diff
--- a/libcxx/include/__system_error/errc.h
+++ b/libcxx/include/__system_error/errc.h
@@ -45,6 +45,7 @@ enum class errc
     identifier_removed,                 // EIDRM
     illegal_byte_sequence,              // EILSEQ
     inappropriate_io_control_operation, // ENOTTY
+    integrity_check_failed,             // EINTEGRITY
     interrupted,                        // EINTR
     invalid_argument,                   // EINVAL
     invalid_seek,                       // ESPIPE
@@ -142,6 +143,7 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc)
     identifier_removed                  = EIDRM,
     illegal_byte_sequence               = EILSEQ,
     inappropriate_io_control_operation  = ENOTTY,
+    integrity_check_failed              = EINTEGRITY,
     interrupted                         = EINTR,
     invalid_argument                    = EINVAL,
     invalid_seek                        = ESPIPE,
--- a/libcxx/include/errno.h
+++ b/libcxx/include/errno.h
@@ -34,49 +34,79 @@ Macros:
 
 #ifdef __cplusplus
 
-#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) || !defined(EINTEGRITY)
 
 #ifdef ELAST
 
 static const int __elast1 = ELAST+1;
 static const int __elast2 = ELAST+2;
+static const int __elast3 = ELAST+3;
 
 #else
 
 static const int __elast1 = 104;
 static const int __elast2 = 105;
+static const int __elast3 = 106;
 
 #endif
 
-#ifdef ENOTRECOVERABLE
+#if !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
+#define ENOTRECOVERABLE __elast1
+#define EOWNERDEAD __elast2
+#define EINTEGRITY __elast3
+#if defined(ELAST)
+#undef ELAST
+#define ELAST EINTEGRITY
+#endif
 
+#elif !defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && defined(EINTEGRITY)
+#define ENOTRECOVERABLE __elast1
+#define EOWNERDEAD __elast2
+#if defined(ELAST)
+#undef ELAST
+#define ELAST EOWNERDEAD
+#endif
+
+#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
 #define EOWNERDEAD __elast1
+#define EINTEGRITY __elast2
+#if defined(ELAST)
+#undef ELAST
+#define ELAST EINTEGRITY
+#endif
 
-#ifdef ELAST
+#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && defined(EINTEGRITY)
+#define EOWNERDEAD __elast1
+#if defined(ELAST)
 #undef ELAST
 #define ELAST EOWNERDEAD
 #endif
 
-#elif defined(EOWNERDEAD)
+#elif defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
+#define ENOTRECOVERABLE __elast1
+#define EINTEGRITY __elast2
+#if defined(ELAST)
+#undef ELAST
+#define ELAST EINTEGRITY
+#endif
 
+#elif defined(EOWNERDEAD) && !defined(ENOTRECOVERABLE) && defined(EINTEGRITY)
 #define ENOTRECOVERABLE __elast1
-#ifdef ELAST
+#if defined(ELAST)
 #undef ELAST
 #define ELAST ENOTRECOVERABLE
 #endif
 
-#else  // defined(EOWNERDEAD)
-
-#define EOWNERDEAD __elast1
-#define ENOTRECOVERABLE __elast2
-#ifdef ELAST
+#elif defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY)
+#define EINTEGRITY __elast1
+#if defined(ELAST)
 #undef ELAST
-#define ELAST ENOTRECOVERABLE
+#define ELAST EINTEGRITY
 #endif
 
-#endif // defined(EOWNERDEAD)
+#endif // !defined(OWNERDEAD) && !defined(NOTRECOVERABLE) && !defined(INTEGRITY)
 
-#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+#endif // !defined(OWNERDEAD) || !defined(NOTRECOVERABLE) || !defined(INTEGRITY)
 
 //  supply errno values likely to be missing, particularly on Windows
 
@@ -392,6 +422,10 @@ static const int __elast2 = 105;
 
 #ifndef EMLINK
 #define EMLINK 9979
+#endif
+
+#ifndef EINTEGRITY
+#define EINTEGRITY 9980
 #endif
 
 #endif // __cplusplus
```


https://github.com/llvm/llvm-project/pull/76364


More information about the libcxx-commits mailing list