[PATCH] Added declaration of method pthread_getname_np

Joel Sherrill joel at rtems.org
Wed Apr 19 19:04:03 UTC 2017


On Wed, Apr 19, 2017 at 2:02 PM, Gedare Bloom <gedare at rtems.org> wrote:

> Hi Tanu,
>
> This comes into RTEMS through newlib. You have to clone newlib and
> search in newlib.git/newlib.
>


It is installed as part of your tools by the RSB.

You can #define _GNU_SOURCE before you include any .h files
or add it to the Makefile or whatever you use.

>
> Side-note: Please ensure to use a properly configured git user.name
> and user.email so that git-send-email and git-format-patch will
> preserve the correct authorship information.
>
> Gedare
>
> On Wed, Apr 19, 2017 at 2:59 PM, Tanu Hari Dixit <tokencolour at gmail.com>
> wrote:
> > Hello Joel,
> >
> > I git grepped for the above lines in src/rtems but couldn't find it. I
> > couldn't find it in
> > /src/rtems/cpukit/posix/include/rtems/posix/pthread.h. I don't know
> > how to define _GNU_SOURCE. Can you please help me with this?
> >
> > Thank you,
> > Tanu Hari Dixit.
> >
> > On Wed, Apr 19, 2017 at 9:38 PM, Joel Sherrill <joel at rtems.org> wrote:
> >> Hi,
> >>
> >> This is prototyped in pthread.h in the current tools:
> >>
> >>  #if __GNU_VISIBLE
> >> int     pthread_getname_np(pthread_t, char *, size_t) __nonnull(2);
> >>
> >> int     pthread_setname_np(pthread_t, const char *) __nonnull(2);
> >> #endif
> >>
> >> Do you have current tools? Did you define _GNU_SOURCE so this
> >> prototype is visible?
> >>
> >> --joel
> >>
> >>
> >> Are you sure your to
> >>
> >> On Wed, Apr 19, 2017 at 10:00 AM, tokencolour <tokencolour at gmail.com>
> wrote:
> >>>
> >>> Gets rid of 1 warning -->
> >>> warning: no previous prototype for 'pthread_getname_np'
> >>> [-Wmissing-prototypes]
> >>> ---
> >>>  cpukit/posix/include/rtems/posix/pthreadimpl.h | 5 +++++
> >>>  cpukit/posix/src/pthreadgetnamenp.c            | 1 +
> >>>  2 files changed, 6 insertions(+)
> >>>
> >>> diff --git a/cpukit/posix/include/rtems/posix/pthreadimpl.h
> >>> b/cpukit/posix/include/rtems/posix/pthreadimpl.h
> >>> index 90a60b6..51a1a2a 100644
> >>> --- a/cpukit/posix/include/rtems/posix/pthreadimpl.h
> >>> +++ b/cpukit/posix/include/rtems/posix/pthreadimpl.h
> >>> @@ -111,6 +111,11 @@ int rtems_pthread_attribute_compare(
> >>>    const pthread_attr_t *attr2
> >>>  );
> >>>
> >>> +/*
> >>> + * pthread_getname_np
> >>> + */
> >>> +int pthread_getname_np( pthread_t thread, char *name, size_t len );
> >>> +
> >>>  RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate(void)
> >>>  {
> >>>    _Objects_Allocator_lock();
> >>> diff --git a/cpukit/posix/src/pthreadgetnamenp.c
> >>> b/cpukit/posix/src/pthreadgetnamenp.c
> >>> index e753823..b1a99f0 100644
> >>> --- a/cpukit/posix/src/pthreadgetnamenp.c
> >>> +++ b/cpukit/posix/src/pthreadgetnamenp.c
> >>> @@ -16,6 +16,7 @@
> >>>  #include <string.h>
> >>>
> >>>  #include <rtems/score/threadimpl.h>
> >>> +#include <rtems/posix/pthreadimpl.h>
> >>>
> >>>  int pthread_getname_np( pthread_t thread, char *name, size_t len )
> >>>  {
> >>> --
> >>> 2.1.4
> >>>
> >>> _______________________________________________
> >>> devel mailing list
> >>> devel at rtems.org
> >>> http://lists.rtems.org/mailman/listinfo/devel
> >>
> >>
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170419/4c15c342/attachment.html>


More information about the devel mailing list