Re: [PATCH] libc: Added sig2str/str2sig prototypes
Dr. Joel, Thanks, I will make these changes and resubmit! Sincerely, Matt On Wed, Jul 7, 2021 at 3:57 PM Joel Sherrill wrote: > > On Wed, Jul 7, 2021 at 5:46 AM Matt Joyce 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@rtems.org > > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] libc: Added sig2str/str2sig prototypes
On Wed, Jul 7, 2021 at 5:46 AM Matt Joyce 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@rtems.org > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] libc: Added sig2str/str2sig prototypes
> On 17-Jun-2021, at 1:14 PM, Matthew Joyce wrote: > > Hi Eshan, > > Thanks very much for this...It's really helpful! > > Question on workflow: > So for this example, I just apply the patch to RSB. Do I understand correctly > that we need to rebuild the tool chain each and every time I make any > change? Yupp that’s one of the reasons it takes time to work on a patch. > (Step 7 in > Vaibhav's Blog) This didn't compile, apparently because of the double > restricts. Do I need > to make a change, rebuild the tool chain (around 1.33 hours), and test > again? Hopefully > there are shortcuts around that! You can check for symbols that’s the only way we had No shortcuts If it builds for newlib you have to build the complete tool chain to see it doesn’t break the RSB. Also you have to build the complete rtems Kernel That’s the only way you can build the test and run on the kernel Thanks - Eshan > > Thanks again for your help. > > Sincerely, > > Matt > >> On Wed, Jun 16, 2021 at 10:40 PM Eshan Dhawan >> wrote: >> >> Hi Matt, >> Since you are making changes only to a header file you don’t need to run >> autoreconf. >> You can directly apply the patch to RSB and it should work >> You need to run autoreconf when u make changes in makefile >> That is when u add a .c file >> On 17-Jun-2021, at 1:53 AM, Matt Joyce wrote: >>> >>> ***As Requested: For Review Only. Does Not Compile*** >>> >>> 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..fd2b3c672 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 >>> + >>> +/* 202x_d2-POSIX-Issue-8, p. 327 adds SIG2STR_MAX, p. 332 adds sig2str() >>> + and str2sig(). */ >>> + >>> +#define SIG2STR_MAX 4294967295 >>> + >>> +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@rtems.org >>> http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] libc: Added sig2str/str2sig prototypes
Hi Eshan, Thanks very much for this...It's really helpful! Question on workflow: So for this example, I just apply the patch to RSB. Do I understand correctly that we need to rebuild the tool chain each and every time I make any change? (Step 7 in Vaibhav's Blog) This didn't compile, apparently because of the double restricts. Do I need to make a change, rebuild the tool chain (around 1.33 hours), and test again? Hopefully there are shortcuts around that! Thanks again for your help. Sincerely, Matt On Wed, Jun 16, 2021 at 10:40 PM Eshan Dhawan wrote: > > Hi Matt, > Since you are making changes only to a header file you don’t need to run > autoreconf. > You can directly apply the patch to RSB and it should work > You need to run autoreconf when u make changes in makefile > That is when u add a .c file > > > On 17-Jun-2021, at 1:53 AM, Matt Joyce wrote: > > > > ***As Requested: For Review Only. Does Not Compile*** > > > > 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..fd2b3c672 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 > > + > > +/* 202x_d2-POSIX-Issue-8, p. 327 adds SIG2STR_MAX, p. 332 adds sig2str() > > + and str2sig(). */ > > + > > +#define SIG2STR_MAX 4294967295 > > + > > +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@rtems.org > > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] libc: Added sig2str/str2sig prototypes
Hi Matt, Since you are making changes only to a header file you don’t need to run autoreconf. You can directly apply the patch to RSB and it should work You need to run autoreconf when u make changes in makefile That is when u add a .c file > On 17-Jun-2021, at 1:53 AM, Matt Joyce wrote: > > ***As Requested: For Review Only. Does Not Compile*** > > 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..fd2b3c672 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 > + > +/* 202x_d2-POSIX-Issue-8, p. 327 adds SIG2STR_MAX, p. 332 adds sig2str() > + and str2sig(). */ > + > +#define SIG2STR_MAX 4294967295 > + > +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@rtems.org > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel