[英]How to memory map a file in Common Lisp on Linux?
How can I achieve memory mapping in Common Lisp either through cffi
or a custom library?如何通过cffi
或自定义库在 Common Lisp 中实现 memory 映射?
There is void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
有void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
in C language.在 C 语言中。
There is already How do I memory map tmpfs files in sbcl? sbcl 中已经有 How do I memory map tmpfs 文件? , but nowadays there is a portable library for that: just (ql:quickload "mmap")
. ,但现在有一个可移植的库:just (ql:quickload "mmap")
。
Some implementations let you specify in a call to function open
take the file should be memory-mapped.某些实现允许您在调用 function open
时指定文件应该是内存映射的。 At least Allegro CL supports (open.. :mapped t)
.至少 Allegro CL 支持(open.. :mapped t)
。 This also works in macro with-open-file
which expands into open
.这也适用于扩展为open
的宏with-open-file
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.