OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [test/] [mmap/] [mmap.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
 
2
/* The mmap test is useful, since syscalls with 6 arguments
3
 * (as mmap) are done differently on various architectures.
4
 */
5
 
6
#include <stdio.h>
7
#include <stdlib.h>
8
#include <unistd.h>
9
#include <sys/mman.h>
10
 
11
 
12
int main(int argc, char **argv)
13
{
14
        void *ptr;
15
 
16
 
17
        ptr = mmap(NULL, 4096, PROT_READ|PROT_WRITE,
18
                MAP_PRIVATE|MAP_ANONYMOUS, 0, 0);
19
 
20
        if(ptr==MAP_FAILED){
21
                perror("mmap");
22
                exit(1);
23
        }
24
        printf("mmap returned %p\n",ptr);
25
        exit(0);
26
}
27
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.