]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/nolibc: Define u_(long|int|short_char) for _DEFAULT_SOURCE files
authorMarco Schlumpp <marco.schlumpp@gmail.com>
Tue, 24 May 2022 18:17:14 +0000 (20:17 +0200)
committerUnikraft <monkey@unikraft.io>
Thu, 4 May 2023 15:50:59 +0000 (15:50 +0000)
These typedefs are commonly used in BSD code. Most libc libraries define
them by default or for _DEFAULT_SOURCE files. Because unikraft is
usually closer to Linux, this adopts the later approach.

Signed-off-by: Marco Schlumpp <marco.schlumpp@gmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Reviewed-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Approved-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #627

lib/nolibc/include/nolibc-internal/shareddefs.h
lib/nolibc/include/sys/types.h

index 15eb4771d0f626c65b0d27957099ef0964ee2c70..1c5542eee439d1ffa9a0fdda298ff080972bb873 100644 (file)
@@ -212,3 +212,11 @@ typedef unsigned short __sa_family_t;
 typedef __sa_family_t sa_family_t;
 #define __DEFINED_sa_family_t
 #endif
+
+#if defined(__NEED_BSD_TYPES) && !defined(__DEFINED_BSD_TYPES)
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+typedef unsigned long u_long;
+#define __DEFINED_BSD_TYPES
+#endif
index fc42ee3100676f26c57e53ac8f3844488cab16e2..880cc39096e34cb7c21235085dcfc3097aea4bff 100644 (file)
@@ -41,6 +41,9 @@
 extern "C" {
 #endif
 
+#ifdef _DEFAULT_SOURCE
+#define __NEED_BSD_TYPES
+#endif
 #define __NEED_size_t
 #define __NEED_ssize_t
 #define __NEED_off_t