source: rtems/cpukit/rtems/src/rtemsobjectsetname.c @ 4efe1955

4.115
Last change on this file since 4efe1955 was 4efe1955, checked in by Mathew Kallada <matkallada@…>, on 12/06/12 at 00:46:05

rtems misc: Clean up Doxygen GCI Task #5

http://www.google-melange.com/gci/task/view/google/gci2012/8015207

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 * @file
3 *
4 * @brief Set Name of Object
5 * @ingroup ClassicClassInfo Object Class Information
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/score/object.h>
23#include <rtems/score/thread.h>
24#include <rtems/rtems/status.h>
25#include <rtems/rtems/types.h>
26#include <rtems/rtems/object.h>
27
28/*
29 *  This method will set the object name based upon the user string.
30 *  If the object class uses 32-bit names, then only the first 4 bytes
31 *  of the string will be used.
32 */
33rtems_status_code rtems_object_set_name(
34  rtems_id       id,
35  const char    *name
36)
37{
38  Objects_Information *information;
39  Objects_Locations    location;
40  Objects_Control     *the_object;
41  Objects_Id           tmpId;
42
43  if ( !name )
44    return RTEMS_INVALID_ADDRESS;
45
46  tmpId = (id == OBJECTS_ID_OF_SELF) ? _Thread_Executing->Object.id : id;
47
48  information  = _Objects_Get_information_id( tmpId );
49  if ( !information )
50    return RTEMS_INVALID_ID;
51
52  the_object = _Objects_Get( information, tmpId, &location );
53  switch ( location ) {
54
55    case OBJECTS_LOCAL:
56      _Objects_Set_name( information, the_object, name );
57      _Thread_Enable_dispatch();
58      return RTEMS_SUCCESSFUL;
59
60#if defined(RTEMS_MULTIPROCESSING)
61    case OBJECTS_REMOTE:
62#endif
63    case OBJECTS_ERROR:
64      break;
65  }
66
67  return RTEMS_INVALID_ID;
68}
Note: See TracBrowser for help on using the repository browser.