Changeset 34712
- Timestamp:
- 08/02/09 22:46:36 (4 years ago)
- Files:
-
- 1 modified
-
platform/linux/morememory/trunk/morememory.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
platform/linux/morememory/trunk/morememory.c
r34711 r34712 8 8 #include <fcntl.h> 9 9 #include <malloc.h> 10 #include <poll.h> 11 #include <pthread.h> 10 12 #include <stdio.h> 11 13 #include <stdlib.h> 12 14 #include <string.h> 13 15 #include <sys/mman.h> 16 #include <sys/select.h> 14 17 #include <sys/stat.h> 18 #include <sys/time.h> 15 19 #include <sys/types.h> 16 20 #include <unistd.h> 17 #include <bits/libc-lock.h>18 21 19 22 #define MAXMEM (1024*1024*1024) … … 44 47 int fd; 45 48 46 /* create a sparse temporary file and mmap it */47 49 assert((fd = mkstemp(tmpfile)) != -1); 48 50 assert(unlink(tmpfile) == 0); 49 51 assert(ftruncate(fd, MAXMEM) == 0); 50 51 52 /* TODO move fd to a higher number (maybe necessary) */ 52 53 return fd; … … 98 99 DEF_ORIG(waitpid, pid_t, (pid_t pid, int* status, int options), 99 100 (pid, status, options)); 101 DEF_ORIG(fgetc, int, (FILE* stream), (stream)); 102 DEF_ORIG(fgets, char*, (char* s, int size, FILE* stream), (s, size, stream)); 103 DEF_ORIG(select, int, (int nfds, fd_set* readfds, fd_set* writefds, 104 fd_set* exceptfds, struct timeval* timeout), 105 (nfds, readfds, writefds, exceptfds, timeout)); 106 DEF_ORIG(poll, int, (struct pollfd* fds, nfds_t nfds, int timeout), 107 (fds, nfds, timeout)); 100 108 101 109 #undef DEF_ORIG … … 104 112 extern void moremem_init(void) 105 113 { 114 /* create temporary file and mmap */ 106 115 memfd = create_memfile(); 107 116 assert((moremem = mmap(NULL, MAXMEM, PROT_READ | PROT_WRITE | PROT_EXEC, … … 120 129 DLSYM(wait); 121 130 DLSYM(waitpid); 131 DLSYM(fgetc); 132 DLSYM(fgets); 133 DLSYM(select); 134 DLSYM(poll); 122 135 #undef DLSYM 123 136 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)