source: rtems/cpukit/posix/src/pthreadsetnamenp.c @ 77fbbd6

5
Last change on this file since 77fbbd6 was 7c499279, checked in by Sebastian Huber <sebastian.huber@…>, on 01/12/17 at 08:26:08

posix: Add pthread_getname_np(), ...

Add pthread_getname_np() and pthread_setname_np().

Update #2858.

  • Property mode set to 100644
File size: 876 bytes
Line 
1/*
2 * Copyright (c) 2017 embedded brains GmbH.
3 *
4 * The license and distribution terms for this file may be
5 * found in the file LICENSE in this distribution or at
6 * http://www.rtems.org/license/LICENSE.
7 */
8
9#if HAVE_CONFIG_H
10#include "config.h"
11#endif
12
13#define _GNU_SOURCE
14#include <pthread.h>
15#include <errno.h>
16
17#include <rtems/score/threadimpl.h>
18#include <rtems/posix/posixapi.h>
19
20int pthread_setname_np( pthread_t thread, const char *name )
21{
22  Thread_Control   *the_thread;
23  ISR_lock_Context  lock_context;
24  Status_Control    status;
25
26  _Objects_Allocator_lock();
27  the_thread = _Thread_Get( thread, &lock_context );
28
29  if ( the_thread == NULL ) {
30    _Objects_Allocator_unlock();
31    return ESRCH;
32  }
33
34  _ISR_lock_ISR_enable( &lock_context );
35  status = _Thread_Set_name( the_thread, name );
36  _Objects_Allocator_unlock();
37  return _POSIX_Get_error( status );
38}
Note: See TracBrowser for help on using the repository browser.