Subject: Re: [PATCH 1/3] compat/posix.h: track SA_RESTART fallback

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Jun 2025 08:34:43 -0700

"Carlo Marcelo Arenas Belón via GitGitGadget"
<[email-masked]> writes:

> From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <[email-masked]>
>
> Systems without SA_RESTART where using custom CFLAGS instead of
> the standard header file.

This is not a sentence, isn't it?  "where" -> "are"???  I dunno.

> Consolidate that, so it will be easier to use in a future commit.
>
> Signed-off-by: Carlo Marcelo Arenas Belón <[email-masked]>
> ---
>  compat/posix.h   | 7 +++++++
>  config.mak.uname | 3 ---
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/compat/posix.h b/compat/posix.h
> index 067a00f33b83..2612a8515897 100644
> --- a/compat/posix.h
> +++ b/compat/posix.h
> @@ -250,6 +250,13 @@ char *gitdirname(char *);
>  #define NAME_MAX 255
>  #endif
>  
> +/* On most systems <signal.h> would have given us this, but
> + * not on some systems (e.g. NonStop, QNX).
> + */
> +#ifndef SA_RESTART
> +#define SA_RESTART 0	/* disabled for sigaction() */
> +#endif

So not just on QNX and NonStop, we have SA_RESTART defined
everywhere.  I do not know offhand what the ramifications of this
change is, but we seem to use the symbol in places outside #ifdef
meaning that anybody other than QNX and NonStop that lack SA_RESTART
wouldn't have been able to build Git before this change, and now
they would be.  The resulting binary may not work for them at all
yet but that is not any worse than before.

>  typedef uintmax_t timestamp_t;
>  #define PRItime PRIuMAX
>  #define parse_timestamp strtoumax
> diff --git a/config.mak.uname b/config.mak.uname
> index b1c5c4d5e8ed..52160ef5cb07 100644
> --- a/config.mak.uname
> +++ b/config.mak.uname
> @@ -654,8 +654,6 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
>  	FREAD_READS_DIRECTORIES = UnfortunatelyYes
>  
>  	# Not detected (nor checked for) by './configure'.
> -	# We don't have SA_RESTART on NonStop, unfortunalety.
> -	COMPAT_CFLAGS += -DSA_RESTART=0
>  	# Apparently needed in compat/fnmatch/fnmatch.c.
>  	COMPAT_CFLAGS += -DHAVE_STRING_H=1
>  	NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
> @@ -782,7 +780,6 @@ ifeq ($(uname_S),MINGW)
>          endif
>  endif
>  ifeq ($(uname_S),QNX)
> -	COMPAT_CFLAGS += -DSA_RESTART=0
>  	EXPAT_NEEDS_XMLPARSE_H = YesPlease
>  	HAVE_STRINGS_H = YesPlease
>  	NEEDS_SOCKET = YesPlease