* sparc-opc.c (sparc_opcodes): Mark all insns that reference
[deliverable/binutils-gdb.git] / mmalloc / keys.c
CommitLineData
63abb1e7
FF
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
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20
21/* This module provides access to some keys that the application can use to
22 provide persistent access to locations in the mapped memory section.
23 The intent is that these keys are to be used sparingly as sort of
24 persistent global variables which the application can use to reinitialize
25 access to data in the mapped region.
26
27 For the moment, these keys are simply stored in the malloc descriptor
28 itself, in an array of fixed length. This should be fixed so that there
29 can be an unlimited number of keys, possibly using a multilevel access
30 scheme of some sort. */
31
32#include "mmalloc.h"
33
34int
35mmalloc_setkey (md, keynum, key)
36 PTR md;
37 int keynum;
38 PTR key;
39{
40 struct mdesc *mdp = (struct mdesc *) md;
41 int result = 0;
42
43 if ((mdp != NULL) && (keynum >= 0) && (keynum < MMALLOC_KEYS))
44 {
45 mdp -> keys [keynum] = key;
46 result++;
47 }
48 return (result);
49}
50
51PTR
52mmalloc_getkey (md, keynum)
53 PTR md;
54 int keynum;
55{
56 struct mdesc *mdp = (struct mdesc *) md;
57 PTR keyval = NULL;
58
59 if ((mdp != NULL) && (keynum >= 0) && (keynum < MMALLOC_KEYS))
60 {
61 keyval = mdp -> keys [keynum];
62 }
63 return (keyval);
64}
This page took 0.156752 seconds and 4 git commands to generate.