From: Michalis Pappas Date: Fri, 5 Jan 2024 18:42:47 +0000 (+0100) Subject: lib/nolibc: Import `pthread_t` & `pthread_attr_t` from musl X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=72aeedb323ef53bfd103f45c5daec4c59a2c7836;p=unikraft%2Funikraft.git lib/nolibc: Import `pthread_t` & `pthread_attr_t` from musl Import definitions of `pthread_d` and `pthread_addr_t` from musl, with minor changes to adapt for nolibc's `sharedefs.h`. Source of import: Repository: https://git.musl-libc.org/cgit/musl Tag: v1.2.4 (f5f55d65) Path: musl/include/alltypes.h.in Checkpatch-Ignore: POINTER_LOCATION Checkpatch-Ignore: LONG_LINES Checkpatch-Ignore: VOLATILE Checkpatch-Ignore: SPACING Signed-off-by: Michalis Pappas Approved-by: Andrei Tatar Reviewed-by: Andrei Tatar GitHub-Closes: #1244 --- diff --git a/lib/nolibc/include/nolibc-internal/shareddefs.h b/lib/nolibc/include/nolibc-internal/shareddefs.h index 53b0651fe..57aeeefc9 100644 --- a/lib/nolibc/include/nolibc-internal/shareddefs.h +++ b/lib/nolibc/include/nolibc-internal/shareddefs.h @@ -225,3 +225,17 @@ typedef unsigned int u_int; typedef unsigned long u_long; #define __DEFINED_BSD_TYPES #endif + +#if (defined __NEED_pthread_t && !defined __DEFINED_pthread_t) +#ifdef __cplusplus +typedef unsigned long pthread_t; +#else +typedef struct __pthread * pthread_t; +#endif +#define __DEFINED_pthread_t +#endif + +#if (defined __NEED_pthread_attr_t && !defined __DEFINED_pthread_attr_t) +typedef struct { union { int __i[sizeof(long)==8?14:9]; volatile int __vi[sizeof(long)==8?14:9]; unsigned long __s[sizeof(long)==8?7:9]; } __u; } pthread_attr_t; +#define __DEFINED_pthread_attr_t +#endif