[PATCH] libc: Added sig2str/str2sig prototypes

Joel Sherrill joel at rtems.org
Wed Jul 7 13:56:56 UTC 2021


On Wed, Jul 7, 2021 at 5:46 AM Matt Joyce <mfjoyce2004 at gmail.com> wrote:
>
> Added definition of SIG2STR_MAX and function prototypes for sig2str
> and str2sig in sys/signal.h in order to improve POSIX compliance.
> ---
>  newlib/libc/include/sys/signal.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h
> index 45cc0366c..36dcbdb1a 100644
> --- a/newlib/libc/include/sys/signal.h
> +++ b/newlib/libc/include/sys/signal.h
> @@ -238,6 +238,18 @@ int sigqueue (pid_t, int, const union sigval);
>
>  #endif /* __POSIX_VISIBLE >= 199309 */
>
> +#if __GNU_VISIBLE

This is OK for now. When Issue 8 is published, this may need to change.

> +
> +/* 202x_d2-POSIX-Issue-8, p. 327 adds SIG2STR_MAX ps. 332 adds sig2str()
> + * and str2sig() */

Do not reference page number in a draft that is not widely
distributed. How about:

POSIX Issue 8 adds sig2str() and str2sig()

> +
> +#define SIG2STR_MAX sizeof("Unknown signal 4294967295 ")

We both saw the email requesting the sizeof this string as the max length
but a comment that this allows for the maximum length signal name and
longest integer format is probably needed.

> +
> +int sig2str(int, char *);
> +int str2sig(const char *__restrict, int *__restrict);
> +
> +#endif /* __GNU_VISIBLE */
> +
>  #if defined(___AM29K__)
>  /* These all need to be defined for ANSI C, but I don't think they are
>     meaningful.  */
> --
> 2.31.1
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list