Index: abi/include/_bits/errno.h
===================================================================
--- abi/include/_bits/errno.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/_bits/errno.h	(revision 0d14c25ac2ed65826983b3ad5668e42d58e76f65)
@@ -41,14 +41,20 @@
 #define _BITS_ERRNO_H_
 
+#include <_bits/native.h>
+#include <_bits/decls.h>
+
 #ifdef __OPAQUE_ERRNO__
 #include <_bits/__opaque_handle.h>
 
+__HELENOS_DECLS_BEGIN;
 __opaque_handle(errno_t);
 typedef errno_t sys_errno_t;
+__HELENOS_DECLS_END;
+
 #define __errno_t(val) ((errno_t) val)
 
 #else
 
-#include <_bits/native.h>
+__HELENOS_DECLS_BEGIN;
 
 /**
@@ -65,4 +71,6 @@
 typedef sysarg_t sys_errno_t;
 
+__HELENOS_DECLS_END;
+
 /**
  * A C++-style "cast" to `errno_t`.
Index: abi/include/_bits/native.h
===================================================================
--- abi/include/_bits/native.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/_bits/native.h	(revision 0d14c25ac2ed65826983b3ad5668e42d58e76f65)
@@ -47,4 +47,7 @@
 
 #include <inttypes.h>
+#include <_bits/decls.h>
+
+__HELENOS_DECLS_BEGIN;
 
 typedef uintptr_t pfn_t;
@@ -53,7 +56,5 @@
 typedef intptr_t  native_t;
 
-#define PRIdn  PRIdPTR  /**< Format for native_t. */
-#define PRIun  PRIuPTR  /**< Format for sysarg_t. */
-#define PRIxn  PRIxPTR  /**< Format for hexadecimal sysarg_t. */
+__HELENOS_DECLS_END;
 
 #endif
Index: abi/include/_bits/off64_t.h
===================================================================
--- abi/include/_bits/off64_t.h	(revision 0d14c25ac2ed65826983b3ad5668e42d58e76f65)
+++ abi/include/_bits/off64_t.h	(revision 0d14c25ac2ed65826983b3ad5668e42d58e76f65)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2019 Jiří Zárevúcky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup bits
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _BITS_OFF64_T_H_
+#define _BITS_OFF64_T_H_
+
+#include <stdint.h>
+#include <_bits/decls.h>
+
+__C_DECLS_BEGIN;
+typedef int64_t off64_t;
+__C_DECLS_END;
+
+#endif
+
+/** @}
+ */
Index: abi/include/_bits/ssize_t.h
===================================================================
--- abi/include/_bits/ssize_t.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/_bits/ssize_t.h	(revision 0d14c25ac2ed65826983b3ad5668e42d58e76f65)
@@ -42,9 +42,9 @@
 
 #include <stdint.h>
+#include <_bits/decls.h>
 
+__C_DECLS_BEGIN;
 typedef intptr_t ssize_t;
-
-#define SSIZE_MIN  INTPTR_MIN
-#define SSIZE_MAX  INTPTR_MAX
+__C_DECLS_END;
 
 #endif
Index: abi/include/inttypes.h
===================================================================
--- abi/include/inttypes.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/inttypes.h	(revision 0d14c25ac2ed65826983b3ad5668e42d58e76f65)
@@ -43,4 +43,5 @@
 #include <stdint.h>
 #include <_bits/wchar_t.h>
+#include <_bits/decls.h>
 
 /*
@@ -311,11 +312,4 @@
 #endif
 
-#ifdef _HELENOS_SOURCE
-#define UINT8_MIN   0
-#define UINT16_MIN  0
-#define UINT32_MIN  0
-#define UINT64_MIN  0
-#endif
-
 #define PRIdMAX  "lld"
 #define PRIiMAX  "lli"
@@ -330,7 +324,11 @@
 #define SCNxMAX  "llx"
 
-#ifdef __cplusplus
-extern "C" {
+#if defined(_HELENOS_SOURCE) && !defined(__cplusplus)
+#define PRIdn  PRIdPTR  /**< Format for native_t. */
+#define PRIun  PRIuPTR  /**< Format for sysarg_t. */
+#define PRIxn  PRIxPTR  /**< Format for hexadecimal sysarg_t. */
 #endif
+
+__C_DECLS_BEGIN;
 
 typedef struct {
@@ -343,11 +341,11 @@
 intmax_t strtoimax(const char *__restrict__, char **__restrict__, int);
 uintmax_t strtoumax(const char *__restrict__, char **__restrict__, int);
-
-#ifdef __cplusplus
-}
+intmax_t wcstoimax(const wchar_t *__restrict__, wchar_t **__restrict__, int);
+uintmax_t wcstoumax(const wchar_t *__restrict__, wchar_t **__restrict__, int);
+
+__C_DECLS_END;
+
 #endif
 
-#endif
-
 /** @}
  */
Index: abi/include/limits.h
===================================================================
--- abi/include/limits.h	(revision 4d51c607b40cddbde56d258de8b91cd585fccb3d)
+++ abi/include/limits.h	(revision 0d14c25ac2ed65826983b3ad5668e42d58e76f65)
@@ -84,4 +84,7 @@
 #define MB_LEN_MAX 4
 
+#define __NAME_MAX  256
+
+#ifdef _HELENOS_SOURCE
 #define UCHAR_MIN   0
 #define USHRT_MIN   0
@@ -89,4 +92,19 @@
 #define ULONG_MIN   (0ul)
 #define ULLONG_MIN  (0ull)
+#define SSIZE_MIN   INTPTR_MIN
+#define UINT8_MIN   0
+#define UINT16_MIN  0
+#define UINT32_MIN  0
+#define UINT64_MIN  0
+#endif
+
+#if defined(_HELENOS_SOURCE) || defined(_POSIX_SOURCE) || \
+    defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define SSIZE_MAX  INTPTR_MAX
+#define NAME_MAX   __NAME_MAX
+
+#endif
 
 /* GCC's <limits.h> doesn't define these for C++11, even though it should. */
