summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/rtemsobjectsetname.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-29 21:52:21 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-29 21:52:21 +0000
commit6c06288f6452da96fa630f1482aeaaba5d217531 (patch)
treeb12309ae199663c23f0ba74a71fdba4f32fb1036 /cpukit/rtems/src/rtemsobjectsetname.c
parent2008-01-29 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-6c06288f6452da96fa630f1482aeaaba5d217531.tar.bz2
2008-01-29 Joel Sherrill <joel.sherrill@oarcorp.com>
* itron/src/exd_tsk.c, itron/src/task.c, libmisc/capture/capture.c, libmisc/monitor/mon-config.c, libmisc/monitor/mon-driver.c, libmisc/monitor/mon-itask.c, libmisc/monitor/mon-monitor.c, libmisc/monitor/mon-mpci.c, libmisc/monitor/mon-object.c, libmisc/monitor/mon-symbols.c, posix/src/cancelrun.c, posix/src/pthreadexit.c, rtems/Makefile.am, rtems/preinstall.am, rtems/include/rtems.h, rtems/include/rtems/rtems/support.h, rtems/inline/rtems/rtems/tasks.inl, rtems/src/eventmp.c, rtems/src/msgmp.c, rtems/src/partmp.c, rtems/src/regionmp.c, rtems/src/rtemsobjectgetname.c, rtems/src/semmp.c, rtems/src/signalmp.c, rtems/src/taskdelete.c, rtems/src/taskmp.c, rtems/src/timerserver.c, score/Makefile.am, score/include/rtems/score/object.h, score/inline/rtems/score/object.inl, score/src/Unlimited.txt, score/src/objectgetnameasstring.c, score/src/threadqextractwithproxy.c: Add new Object Services collection. This changed the name of a few previously public but undocumented services and added a some new services. * rtems/include/rtems/rtems/object.h, rtems/src/rtemsbuildid.c, rtems/src/rtemsbuildname.c, rtems/src/rtemsobjectapimaximumclass.c, rtems/src/rtemsobjectapiminimumclass.c, rtems/src/rtemsobjectgetapiclassname.c, rtems/src/rtemsobjectgetapiname.c, rtems/src/rtemsobjectgetclassicname.c, rtems/src/rtemsobjectgetclassinfo.c, rtems/src/rtemsobjectidapimaximum.c, rtems/src/rtemsobjectidapiminimum.c, rtems/src/rtemsobjectidgetapi.c, rtems/src/rtemsobjectidgetclass.c, rtems/src/rtemsobjectidgetindex.c, rtems/src/rtemsobjectidgetnode.c, rtems/src/rtemsobjectsetname.c, score/src/objectapimaximumclass.c, score/src/objectgetinfo.c, score/src/objectgetinfoid.c, score/src/objectsetname.c: New files. * rtems/src/rtemsidtoname.c: Removed.
Diffstat (limited to 'cpukit/rtems/src/rtemsobjectsetname.c')
-rw-r--r--cpukit/rtems/src/rtemsobjectsetname.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/cpukit/rtems/src/rtemsobjectsetname.c b/cpukit/rtems/src/rtemsobjectsetname.c
new file mode 100644
index 0000000000..ccfd8a7b59
--- /dev/null
+++ b/cpukit/rtems/src/rtemsobjectsetname.c
@@ -0,0 +1,61 @@
+/*
+ * RTEMS Object Helper -- Set Name of Object as String
+ *
+ * COPYRIGHT (c) 1989-2008.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/system.h>
+#include <rtems/score/object.h>
+#include <rtems/score/thread.h>
+#include <rtems/rtems/status.h>
+#include <rtems/rtems/types.h>
+
+/*
+ * This method will set the object name based upon the user string.
+ * If the object class uses 32-bit names, then only the first 4 bytes
+ * of the string will be used.
+ */
+rtems_status_code rtems_object_set_name(
+ rtems_id id,
+ const char *name
+)
+{
+ Objects_Information *information;
+ Objects_Locations location;
+ Objects_Control *the_object;
+
+ if ( !name )
+ return RTEMS_INVALID_ADDRESS;
+
+ information = _Objects_Get_information_id( id );
+ if ( !information )
+ return RTEMS_INVALID_ID;
+
+ the_object = _Objects_Get( information, id, &location );
+ switch ( location ) {
+
+ case OBJECTS_LOCAL:
+ _Objects_Set_name( information, the_object, name );
+ _Thread_Enable_dispatch();
+ return RTEMS_SUCCESSFUL;
+
+#if defined(RTEMS_MULTIPROCESSING)
+ case OBJECTS_REMOTE:
+#endif
+ case OBJECTS_ERROR:
+ break;
+ }
+
+ return RTEMS_INVALID_ID;
+}