source: rtems/cpukit/score/src/objectgetnext.c @ a6eef8b

Last change on this file since a6eef8b was a6eef8b, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:52:48

2003-09-04 Joel Sherrill <joel@…>

  • apiext.c, chain.c, coremsg.c, coremsgbroadcast.c, coremsgclose.c, coremsgflush.c, coremsgflushsupp.c, coremsgflushwait.c, coremsginsert.c, coremsgseize.c, coremsgsubmit.c, coremutex.c, coremutexflush.c, coremutexseize.c, coremutexsurrender.c, coresem.c, coresemflush.c, coresemseize.c, coresemsurrender.c, coretod.c, coretodset.c, coretodtickle.c, coretodtoseconds.c, coretodvalidate.c, heap.c, heapallocate.c, heapextend.c, heapfree.c, heapgetinfo.c, heapsizeofuserarea.c, heapwalk.c, interr.c, isr.c, mpci.c, object.c, objectallocate.c, objectallocatebyindex.c, objectclearname.c, objectcomparenameraw.c, objectcomparenamestring.c, objectcopynameraw.c, objectcopynamestring.c, objectextendinformation.c, objectfree.c, objectget.c, objectgetbyindex.c, objectgetisr.c, objectgetnext.c, objectgetnoprotection.c, objectinitializeinformation.c, objectmp.c, objectnametoid.c, objectshrinkinformation.c, thread.c, threadchangepriority.c, threadclearstate.c, threadclose.c, threadcreateidle.c, threaddelayended.c, threaddispatch.c, threadevaluatemode.c, threadget.c, threadhandler.c, threadidlebody.c, threadinitialize.c, threadloadenv.c, threadmp.c, threadq.c, threadqdequeue.c, threadqdequeuefifo.c, threadqdequeuepriority.c, threadqenqueue.c, threadqenqueuefifo.c, threadqenqueuepriority.c, threadqextract.c, threadqextractfifo.c, threadqextractpriority.c, threadqextractwithproxy.c, threadqfirst.c, threadqfirstfifo.c, threadqfirstpriority.c, threadqflush.c, threadqtimeout.c, threadready.c, threadreset.c, threadresettimeslice.c, threadrestart.c, threadresume.c, threadrotatequeue.c, threadsetpriority.c, threadsetstate.c, threadsettransient.c, threadstackallocate.c, threadstackfree.c, threadstart.c, threadstartmultitasking.c, threadsuspend.c, threadtickletimeslice.c, threadyieldprocessor.c, userext.c, watchdog.c, watchdogadjust.c, watchdoginsert.c, watchdogremove.c, watchdogtickle.c, wkspace.c: URL for license changed.
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  Object Handler
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/score/address.h>
17#include <rtems/score/chain.h>
18#include <rtems/score/object.h>
19#if defined(RTEMS_MULTIPROCESSING)
20#include <rtems/score/objectmp.h>
21#endif
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24#include <rtems/score/sysstate.h>
25#include <rtems/score/isr.h>
26
27/*PAGE
28 *
29 * _Objects_Get_next
30 *
31 * Like _Objects_Get, but considers the 'id' as a "hint" and
32 * finds next valid one after that point.
33 * Mostly used for monitor and debug traversal of an object.
34 *
35 * Input parameters:
36 *   information - pointer to entry in table for this class
37 *   id          - object id to search for
38 *   location    - address of where to store the location
39 *   next_id     - address to store next id to try
40 *
41 * Output parameters:
42 *   returns     - address of object if local
43 *   location    - one of the following:
44 *                  OBJECTS_ERROR  - invalid object ID
45 *                  OBJECTS_REMOTE - remote object
46 *                  OBJECTS_LOCAL  - local object
47 *   next_id     - will contain a reasonable "next" id to continue traversal
48 *
49 * NOTE:
50 *      assumes can add '1' to an id to get to next index.
51 */
52
53Objects_Control *
54_Objects_Get_next(
55    Objects_Information *information,
56    Objects_Id           id,
57    Objects_Locations   *location_p,
58    Objects_Id          *next_id_p
59)
60{
61    Objects_Control *object;
62    Objects_Id       next_id;
63   
64    if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX)
65        next_id = information->minimum_id;
66    else
67        next_id = id;
68
69    do {
70        /* walked off end of list? */
71        if (_Objects_Get_index(next_id) > information->maximum)
72        {
73            *location_p = OBJECTS_ERROR;
74            goto final;
75        }
76       
77        /* try to grab one */
78        object = _Objects_Get(information, next_id, location_p);
79
80        next_id++;
81
82    } while (*location_p != OBJECTS_LOCAL);
83
84    *next_id_p = next_id;
85    return object;
86
87final:
88    *next_id_p = OBJECTS_ID_FINAL;
89    return 0;
90}
Note: See TracBrowser for help on using the repository browser.