-
Notifications
You must be signed in to change notification settings - Fork 110
/
p_malloc.c
52 lines (48 loc) · 1.2 KB
/
p_malloc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <pal.h>
#include <stddef.h>
#include <stdio.h>
#include "pal_base.h"
#include "pal_base_private.h"
/**
*
* Dynamically allocates contiguous memory buffer on the local node.
*
* @param team A pointer to the object defining the team structure.
* The team contains a set of compute nodes with each node having
* a finite amount of memory.
*
* @param size Total amount of memory to allocate
*
* @return Returns a pointer to the memory buffer
* Returns NULL on error
*/
p_mem_t p_malloc(p_team_t team, size_t size)
{
printf("Running p_malloc(%p,%d)\n", team, (int)size);
#if 0
p_mem_t *mem;
switch (0) { // FIX!
case P_DEV_EPIPHANY: // shared memory model
break;
case P_DEV_FPGA: // shared memory model
break;
case P_DEV_GPU: // shared memory model
break;
case P_DEV_SMP: // heap (thread model)
/*
mem=malloc(sizeof(p_mem_t));
mem->mutex = 23;
mem->takeit = 0;
mem->gotit = 0;
mem->size = size;
mem->memptr = malloc(size);
break;
*/
case P_DEV_GRID: // file+IP (rcp?)
break;
default:
return (1);
}
#endif
return p_mem_err(ENOSYS);
}