Added experimental makepkg-update-checksums.sh
[mirrors/Programs.git] / c / mmap / mmap.c
CommitLineData
21c4e167
H
1#include <stdio.h>
2#include <fcntl.h>
3#include <sys/mman.h>
4#include <sys/stat.h>
5#include <sys/types.h>
6
7unsigned 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
16int 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.507231 seconds and 4 git commands to generate.