From 5c25fe9464cd01388704412b96df78a0e5fa8f74 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 6 Aug 2020 16:25:56 +0000 Subject: [PATCH] Reapply r343111 (partially, by mckusick): Create new EINTEGRITY error with message "Integrity check failed". An integrity check such as a check-hash or a cross-correlation failed. The integrity error falls between EINVAL that identifies errors in parameters to a system call and EIO that identifies errors with the underlying storage media. EINTEGRITY is typically raised by intermediate kernel layers such as a filesystem or an in-kernel GEOM subsystem when they detect inconsistencies. Uses include allowing the mount(8) command to return a different exit value to automate the running of fsck(8) during a system boot. These changes make no use of the new error, they just add it. Later commits will be made for the use of the new error number and it will be added to additional manual pages as appropriate. Reviewed by: gnn, dim, brueffer, imp Discussed with: kib, cem, emaste, ed, jilles Differential Revision: https://reviews.freebsd.org/D18765 --- contrib/llvm-project/libcxx/include/__errc | 2 + contrib/llvm-project/libcxx/include/errno.h | 74 +++++++++++++++------ 2 files changed, 56 insertions(+), 20 deletions(-) diff --git a/contrib/llvm-project/libcxx/include/__errc b/contrib/llvm-project/libcxx/include/__errc index a8ad29f364ac..1b5b43391815 100644 --- a/contrib/llvm-project/libcxx/include/__errc +++ b/contrib/llvm-project/libcxx/include/__errc @@ -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, diff --git a/contrib/llvm-project/libcxx/include/errno.h b/contrib/llvm-project/libcxx/include/errno.h index 447319effd35..f2d13b9a9904 100644 --- a/contrib/llvm-project/libcxx/include/errno.h +++ b/contrib/llvm-project/libcxx/include/errno.h @@ -32,49 +32,79 @@ #ifdef __cplusplus -#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) +#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) || !defined(EINTEGRITY) -#ifdef ELAST +#if defined(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 -#define EOWNERDEAD __elast1 - -#ifdef ELAST +#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) - -#define ENOTRECOVERABLE __elast1 -#ifdef ELAST -#undef ELAST -#define ELAST ENOTRECOVERABLE -#endif - -#else // defined(EOWNERDEAD) - +#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY) #define EOWNERDEAD __elast1 -#define ENOTRECOVERABLE __elast2 -#ifdef ELAST +#define EINTEGRITY __elast2 +#if defined(ELAST) +#undef ELAST +#define ELAST EINTEGRITY +#endif + +#elif !defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && defined(EINTEGRITY) +#define EOWNERDEAD __elast1 +#if defined(ELAST) +#undef ELAST +#define ELAST EOWNERDEAD +#endif + +#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 +#if defined(ELAST) #undef ELAST #define ELAST ENOTRECOVERABLE #endif -#endif // defined(EOWNERDEAD) +#elif defined(EOWNERDEAD) && defined(ENOTRECOVERABLE) && !defined(EINTEGRITY) +#define EINTEGRITY __elast1 +#if defined(ELAST) +#undef ELAST +#define ELAST EINTEGRITY +#endif -#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) +#endif // !defined(OWNERDEAD) && !defined(NOTRECOVERABLE) && !defined(INTEGRITY) + +#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; #define EMLINK 9979 #endif +#ifndef EINTEGRITY +#define EINTEGRITY 9980 +#endif + #endif // __cplusplus #endif // _LIBCPP_ERRNO_H