GIT.Harvie.CZ
/
mirrors
/
Programs.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
b2b19209693adcb955bb53bebd1d1ce3135be2c6
[mirrors/Programs.git]
/
c
/
mmap-old
/
mmap.c
1
#include <stdio.h>
2
#include <fcntl.h>
3
#include <sys/mman.h>
4
#include <sys/stat.h>
5
#include <sys/types.h>
6
7
unsigned char
*
fmmap
(
FILE
*
fd
) {
8
struct
stat sb
;
9
10
if
(!
fd
)
perror
(
""
);
11
fd
=
fileno
(
fd
);
12
fstat
((
int
)
fd
, &
sb
);
13
return
mmap
(
0
,
sb
.
st_size
,
PROT_READ
,
MAP_PRIVATE
, (
int
)
fd
,
0
);
14
}
15
16
int
main
() {
17
FILE
*
fd
;
18
unsigned char
*
mm
;
19
20
fd
=
fopen
(
"mmap.c"
,
"r"
);
21
mm
=
fmmap
(
fd
);
22
23
perror
(
"Status"
);
24
puts
(
mm
);
25
26
//munmap(mm, 10);
27
fclose
(
fd
);
28
}
This page took
0.733246 seconds
and
5
git commands to generate.