* remote.c (remote_cisco_section_offsets): Do not cast result from
[deliverable/binutils-gdb.git] / mmalloc / keys.c
1 /* Access for application keys in mmap'd malloc managed region.
2 Copyright 1992 Free Software Foundation, Inc.
3
4 Contributed by Fred Fish at Cygnus Support. fnf@cygnus.com
5
6 This file is part of the GNU C Library.
7
8 The GNU C Library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
12
13 The GNU C Library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
18 You should have received a copy of the GNU Library General Public
19 License along with the GNU C Library; see the file COPYING.LIB. If
20 not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
22
23 /* This module provides access to some keys that the application can use to
24 provide persistent access to locations in the mapped memory section.
25 The intent is that these keys are to be used sparingly as sort of
26 persistent global variables which the application can use to reinitialize
27 access to data in the mapped region.
28
29 For the moment, these keys are simply stored in the malloc descriptor
30 itself, in an array of fixed length. This should be fixed so that there
31 can be an unlimited number of keys, possibly using a multilevel access
32 scheme of some sort. */
33
34 #include "mmprivate.h"
35
36 int
37 mmalloc_setkey (md, keynum, key)
38 PTR md;
39 int keynum;
40 PTR key;
41 {
42 struct mdesc *mdp = (struct mdesc *) md;
43 int result = 0;
44
45 if ((mdp != NULL) && (keynum >= 0) && (keynum < MMALLOC_KEYS))
46 {
47 mdp -> keys [keynum] = key;
48 result++;
49 }
50 return (result);
51 }
52
53 PTR
54 mmalloc_getkey (md, keynum)
55 PTR md;
56 int keynum;
57 {
58 struct mdesc *mdp = (struct mdesc *) md;
59 PTR keyval = NULL;
60
61 if ((mdp != NULL) && (keynum >= 0) && (keynum < MMALLOC_KEYS))
62 {
63 keyval = mdp -> keys [keynum];
64 }
65 return (keyval);
66 }
This page took 0.03366 seconds and 4 git commands to generate.