-
Notifications
You must be signed in to change notification settings - Fork 112
/
shm.c
49 lines (35 loc) · 838 Bytes
/
shm.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
#include "param.h"
#include "types.h"
#include "defs.h"
#include "x86.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
#include "spinlock.h"
struct {
struct spinlock lock;
struct shm_page {
uint id;
char *frame;
int refcnt;
} shm_pages[64];
} shm_table;
void shminit() {
int i;
initlock(&(shm_table.lock), "SHM lock");
acquire(&(shm_table.lock));
for (i = 0; i< 64; i++) {
shm_table.shm_pages[i].id =0;
shm_table.shm_pages[i].frame =0;
shm_table.shm_pages[i].refcnt =0;
}
release(&(shm_table.lock));
}
int shm_open(int id, char **pointer) {
//you write this
return 0; //added to remove compiler warning -- you should decide what to return
}
int shm_close(int id) {
//you write this too!
return 0; //added to remove compiler warning -- you should decide what to return
}