… | |
… | |
163 | # else |
163 | # else |
164 | # define MAP_ANONYMOUS MAP_FIXED /* and hope this fails */ |
164 | # define MAP_ANONYMOUS MAP_FIXED /* and hope this fails */ |
165 | # endif |
165 | # endif |
166 | #endif |
166 | #endif |
167 | |
167 | |
168 | /* defines all sorts of constants to 0 unless they are already defined */ |
|
|
169 | /* also provides const_iv_ and const_niv_ macros for them */ |
|
|
170 | #include "def0.h" |
|
|
171 | |
|
|
172 | #ifndef makedev |
168 | #ifndef makedev |
173 | # define makedev(maj,min) (((maj) << 8) | (min)) |
169 | # define makedev(maj,min) (((maj) << 8) | (min)) |
174 | #endif |
170 | #endif |
175 | #ifndef major |
171 | #ifndef major |
176 | # define major(dev) ((dev) >> 8) |
172 | # define major(dev) ((dev) >> 8) |
… | |
… | |
184 | #endif |
180 | #endif |
185 | |
181 | |
186 | /*****************************************************************************/ |
182 | /*****************************************************************************/ |
187 | |
183 | |
188 | #if !_POSIX_MAPPED_FILES |
184 | #if !_POSIX_MAPPED_FILES |
189 | # define mmap(addr,length,prot,flags,fd,offs) EIO_ENOSYS () |
185 | # define mmap(addr,length,prot,flags,fd,offs) (errno = ENOSYS, (void *)-1) |
190 | # define munmap(addr,length) EIO_ENOSYS () |
186 | # define munmap(addr,length) EIO_ENOSYS () |
191 | #endif |
187 | #endif |
192 | |
188 | |
193 | #if !_POSIX_MEMORY_PROTECTION |
189 | #if !_POSIX_MEMORY_PROTECTION |
194 | # define mprotect(addr,len,prot) EIO_ENOSYS () |
190 | # define mprotect(addr,len,prot) EIO_ENOSYS () |
… | |
… | |
275 | { |
271 | { |
276 | /* todo: iterate over magic and only free ours, but of course */ |
272 | /* todo: iterate over magic and only free ours, but of course */ |
277 | /* the perl5porters will call that (correct) behaviour buggy */ |
273 | /* the perl5porters will call that (correct) behaviour buggy */ |
278 | sv_unmagic (sv, FOREIGN_MAGIC); |
274 | sv_unmagic (sv, FOREIGN_MAGIC); |
279 | } |
275 | } |
|
|
276 | |
|
|
277 | /*****************************************************************************/ |
|
|
278 | |
|
|
279 | /* defines all sorts of constants to 0 unless they are already defined */ |
|
|
280 | /* also provides const_iv_ and const_niv_ macros for them */ |
|
|
281 | #include "def0.h" |
280 | |
282 | |
281 | /*****************************************************************************/ |
283 | /*****************************************************************************/ |
282 | |
284 | |
283 | static void |
285 | static void |
284 | fiemap (eio_req *req) |
286 | fiemap (eio_req *req) |
… | |
… | |
1042 | const_niv (MADV_RANDOM , POSIX_MADV_RANDOM) |
1044 | const_niv (MADV_RANDOM , POSIX_MADV_RANDOM) |
1043 | const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED) |
1045 | const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED) |
1044 | const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED) |
1046 | const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED) |
1045 | |
1047 | |
1046 | /* the second block will be 0 when missing */ |
1048 | /* the second block will be 0 when missing */ |
|
|
1049 | const_iv (O_ACCMODE) |
|
|
1050 | |
1047 | const_iv (O_RDONLY) |
1051 | const_iv (O_RDONLY) |
1048 | const_iv (O_WRONLY) |
1052 | const_iv (O_WRONLY) |
1049 | const_iv (O_RDWR) |
1053 | const_iv (O_RDWR) |
1050 | const_iv (O_CREAT) |
1054 | const_iv (O_CREAT) |
1051 | const_iv (O_TRUNC) |
1055 | const_iv (O_TRUNC) |
… | |
… | |
2069 | munmap (SV *scalar) |
2073 | munmap (SV *scalar) |
2070 | CODE: |
2074 | CODE: |
2071 | sv_clear_foreign (scalar); |
2075 | sv_clear_foreign (scalar); |
2072 | |
2076 | |
2073 | SV * |
2077 | SV * |
2074 | mremap (SV *scalar, STRLEN new_length, int flags = 0, IV new_address = 0) |
2078 | mremap (SV *scalar, STRLEN new_length, int flags = MREMAP_MAYMOVE, IV new_address = 0) |
2075 | CODE: |
2079 | CODE: |
2076 | { |
2080 | { |
2077 | MAGIC *mg = mg_findext (scalar, FOREIGN_MAGIC, &mmap_vtbl); |
2081 | MAGIC *mg = mg_findext (scalar, FOREIGN_MAGIC, &mmap_vtbl); |
2078 | void *new; |
2082 | void *new; |
2079 | |
2083 | |