[PATCH] erofs-utils: lib: Explicitly include <pthread.h> where used

Gao Xiang hsiangkao at linux.alibaba.com
Tue Oct 8 17:29:55 AEDT 2024


Hi Satoshi,

On 2024/10/8 14:08, Satoshi Niwa via Linux-erofs wrote:
> compress.c and inode.c use pthread functions but do not explicitly include <pthread.h>.
> This causes build failures with the Android build system,
> which throws "error: implicit declaration of function pthread_*".
> > Signed-off-by: Satoshi Niwa <niwa at google.com>

Thanks for catching this!
Reviewed-by: Gao Xiang <hsiangkao at linux.alibaba.com>

Thanks,
Gao Xiang

> ---
>   lib/compress.c | 3 +++
>   lib/inode.c    | 3 +++
>   2 files changed, 6 insertions(+)
> 
> diff --git a/lib/compress.c b/lib/compress.c
> index 17e7112..5d6fb2a 100644
> --- a/lib/compress.c
> +++ b/lib/compress.c
> @@ -8,6 +8,9 @@
>   #ifndef _LARGEFILE64_SOURCE
>   #define _LARGEFILE64_SOURCE
>   #endif
> +#ifdef EROFS_MT_ENABLED
> +#include <pthread.h>
> +#endif
>   #include <string.h>
>   #include <stdlib.h>
>   #include <unistd.h>
> diff --git a/lib/inode.c b/lib/inode.c
> index 7958d43..48f46b1 100644
> --- a/lib/inode.c
> +++ b/lib/inode.c
> @@ -6,6 +6,9 @@
>    * with heavy changes by Gao Xiang <xiang at kernel.org>
>    */
>   #define _GNU_SOURCE
> +#ifdef EROFS_MT_ENABLED
> +#include <pthread.h>
> +#endif
>   #include <string.h>
>   #include <stdlib.h>
>   #include <stdio.h>



More information about the Linux-erofs mailing list