source: rtems/cpukit/rtems/src/regionreturnsegment.c @ 66cb142

5
Last change on this file since 66cb142 was b4b062f, checked in by Sebastian Huber <sebastian.huber@…>, on 04/08/16 at 05:50:42

rtems: Delete Region_Control::number_of_used_blocks

Use Heap_Statistics::used_blocks instead.

  • Property mode set to 100644
File size: 873 bytes
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Return Region Segment
5 *  @ingroup ClassicRegion
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
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.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/rtems/regionimpl.h>
22
23rtems_status_code rtems_region_return_segment(
24  rtems_id  id,
25  void     *segment
26)
27{
28  Region_Control *the_region;
29
30  the_region = _Region_Get_and_lock( id );
31
32  if ( the_region == NULL ) {
33    return RTEMS_INVALID_ID;
34  }
35
36  if ( _Region_Free_segment( the_region, segment ) ) {
37    /* Unlocks allocator */
38    _Region_Process_queue( the_region );
39    return RTEMS_SUCCESSFUL;
40  }
41
42  _Region_Unlock( the_region );
43  return RTEMS_INVALID_ADDRESS;
44}
Note: See TracBrowser for help on using the repository browser.