PerlIO::mmap#
Memory-mapped IO layer opened as <:mmap, with a read()/write() fallback when mmap fails.
This is a PerlIO layer that memory-maps files for reading instead of using read() syscalls. It falls back to PerlIOBuf if mmap fails.
The layer extends PerlIOBuf with: mptr — mapped address (from mmap()) len — mapped length bbuf — saved malloced buffer if map fails
The BOOT section registers the “mmap” PerlIO layer via PerlIO_define_layer.
mmap.xs vtable (PerlIO_mmap, lines 258-287):
Pushed = PerlIOBuf_pushed — line 263
Popped = PerlIOBuf_popped — line 264
Open = PerlIOBuf_open — line 265
Binmode = PerlIOBase_binmode — line 266
Getarg = NULL — line 267
Fileno = PerlIOBase_fileno — line 268
Dup = PerlIOMmap_dup — line 269
Read = PerlIOBuf_read — line 270
Unread = PerlIOMmap_unread — line 271
Write = PerlIOMmap_write — line 272
Seek = PerlIOBuf_seek — line 273
Tell = PerlIOBuf_tell — line 274
Close = PerlIOBuf_close — line 275
Flush = PerlIOMmap_flush — line 276
Fill = PerlIOMmap_fill — line 277
Eof = PerlIOBase_eof — line 278
Error = PerlIOBase_error — line 279
Clearerr = PerlIOBase_clearerr — line 280
Setlinebuf = PerlIOBase_setlinebuf — line 281
Get_base = PerlIOMmap_get_base — line 282
Get_bufsiz = PerlIOBuf_bufsiz — line 283
Get_ptr = PerlIOBuf_get_ptr — line 284
Get_cnt = PerlIOBuf_get_cnt — line 285
Set_ptrcnt = PerlIOBuf_set_ptrcnt — line 286