source: rtems/cpukit/rtems/src/rtemsobjectsetname.c @ 6b5f22dc

Last change on this file since 6b5f22dc was 6b5f22dc, checked in by Sebastian Huber <sebastian.huber@…>, on 11/26/20 at 10:45:47

rtems: Canonicalize Doxygen @file comments

Use common phrases for the file brief descriptions.

Update #3706.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup RTEMSImplClassicObject
5 *
6 * @brief This source file contains the implementation of
7 *   rtems_object_set_name().
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2008.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#ifdef HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/rtems/object.h>
24#include <rtems/rtems/tasks.h>
25#include <rtems/score/objectimpl.h>
26
27/*
28 *  This method will set the object name based upon the user string.
29 *  If the object class uses 32-bit names, then only the first 4 bytes
30 *  of the string will be used.
31 */
32rtems_status_code rtems_object_set_name(
33  rtems_id       id,
34  const char    *name
35)
36{
37  Objects_Information *information;
38  Objects_Control     *the_object;
39  Objects_Id           tmpId;
40
41  if ( !name )
42    return RTEMS_INVALID_ADDRESS;
43
44  tmpId = (id == OBJECTS_ID_OF_SELF) ? rtems_task_self() : id;
45
46  information  = _Objects_Get_information_id( tmpId );
47  if ( !information )
48    return RTEMS_INVALID_ID;
49
50  _Objects_Allocator_lock();
51  the_object = _Objects_Get_no_protection( tmpId, information );
52
53  if ( the_object == NULL ) {
54    _Objects_Allocator_unlock();
55    return RTEMS_INVALID_ID;
56  }
57
58  _Objects_Set_name( information, the_object, name );
59  _Objects_Allocator_unlock();
60  return RTEMS_SUCCESSFUL;
61}
Note: See TracBrowser for help on using the repository browser.