source: rtems/cpukit/rtems/src/regiongetsegmentsize.c @ 371cea31

4.104.115
Last change on this file since 371cea31 was 371cea31, checked in by Joel Sherrill <joel.sherrill@…>, on 08/26/09 at 12:00:24

2009-08-24 Sebastian Huber <Sebastian.Huber@…>

  • libmisc/stackchk/check.c, rtems/src/regionreturnsegment.c, rtems/src/regiongetsegmentsize.c, src/heapalignupuptr.c, src/heapallocatealigned.c, src/heapallocate.c, src/heap.c, src/heapextend.c, src/heapfree.c, src/heapgetfreeinfo.c, src/heapgetinfo.c, src/heapresizeblock.c, src/heapsizeofuserarea.c, src/heapwalk.c, src/pheapgetblocksize.c, inline/rtems/score/heap.inl, include/rtems/score/heap.h: Overall cleanup. Changed all types for addresses, sizes, offsets and alignments to uintptr_t. Reformatted. Added variables for clarity. Renamed various objects. Enabled _HAssert() for all instances. More changes follow.
  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  Region Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-2007.
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#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <rtems/system.h>
20#include <rtems/rtems/status.h>
21#include <rtems/rtems/support.h>
22#include <rtems/score/object.h>
23#include <rtems/rtems/options.h>
24#include <rtems/rtems/region.h>
25#include <rtems/score/states.h>
26#include <rtems/score/apimutex.h>
27
28/*PAGE
29 *
30 *  rtems_region_get_segment_size
31 *
32 *  This directive will return the size of the segment indicated
33 *
34 *  Input parameters:
35 *    id         - region id
36 *    segment    - segment address
37 *    size       - pointer to segment size in bytes
38 *
39 *  Output parameters:
40 *    size       - segment size in bytes filled in
41 *    RTEMS_SUCCESSFUL - if successful
42 *    error code - if unsuccessful
43 */
44
45rtems_status_code rtems_region_get_segment_size(
46  Objects_Id         id,
47  void              *segment,
48  intptr_t          *size
49)
50{
51  Objects_Locations        location;
52  rtems_status_code        return_status = RTEMS_INTERNAL_ERROR;
53  register Region_Control *the_region;
54
55  if ( !segment )
56    return RTEMS_INVALID_ADDRESS;
57
58  if ( !size )
59    return RTEMS_INVALID_ADDRESS;
60
61  _RTEMS_Lock_allocator();
62
63    the_region = _Region_Get( id, &location );
64    switch ( location ) {
65
66      case OBJECTS_LOCAL:
67        if ( !_Heap_Size_of_alloc_area( &the_region->Memory, segment, size ) )
68          return_status = RTEMS_INVALID_ADDRESS;
69        else
70          return_status = RTEMS_SUCCESSFUL;
71        break;
72
73#if defined(RTEMS_MULTIPROCESSING)
74      case OBJECTS_REMOTE:        /* this error cannot be returned */
75        break;
76#endif
77
78      case OBJECTS_ERROR:
79        return_status = RTEMS_INVALID_ID;
80        break;
81    }
82
83  _RTEMS_Unlock_allocator();
84  return return_status;
85}
Note: See TracBrowser for help on using the repository browser.