source: rtems/cpukit/rtems/src/regiongetsegmentsize.c @ 41eb1e4

4.104.115
Last change on this file since 41eb1e4 was 41eb1e4, checked in by Joel Sherrill <joel.sherrill@…>, on 12/14/08 at 22:48:54

2008-12-14 Joel Sherrill <joel.sherrill@…>

  • libcsupport/src/realloc.c, rtems/include/rtems/rtems/region.h, rtems/src/regioncreate.c, rtems/src/regionextend.c, rtems/src/regiongetsegment.c, rtems/src/regiongetsegmentsize.c, rtems/src/regionmp.c, rtems/src/regionresizesegment.c, sapi/include/rtems/config.h, score/include/rtems/score/heap.h, score/include/rtems/score/protectedheap.h, score/src/heap.c, score/src/heapallocate.c, score/src/heapallocatealigned.c, score/src/heapextend.c, score/src/heapresizeblock.c, score/src/heapsizeofuserarea.c, score/src/pheapallocate.c, score/src/pheapallocatealigned.c, score/src/pheapextend.c, score/src/pheapgetblocksize.c, score/src/pheapresizeblock.c: Change sizes of heap/region and allocated objects in heap to intptr_t so they can be larger than a single allocatable object (e.g. size_t).
  • 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_user_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.