+/** Create a `error_code` from an `errno` value
+ *
+ * This is expected to to whatever is right to create a
+ * `error_code` from a given `errno` value.
+ */
+inline
+std::error_code errno_code(int errnum)
+{
+ return std::error_code(errnum, errno_category());
+}
+
+/** Create an `error_code` from `errno` (and clear it) */
+inline
+std::error_code errno_code()
+{
+ int errnum = errno;
+ errno = 0;
+ return errno_code(errnum);
+}
+
+/** Create a `system_error` from an `errno` value
+ *
+ * This is expected to to whatever is right to create a
+ * `system_error` from a given `errno` value.
+ */