我正在尝试使用
设置“共享”内存位置caddr_t mmap_ptr;
但是我收到了错误。有帮助吗?谢谢!
另外
mmap_ptr = mmap((caddr_t) 0, /* Memory Location, 0 lets O/S choose */
MAX_BUFFER_SIZE,/* How many bytes to mmap */
PROT_READ | PROT_WRITE, /* Read and write permissions */
MAP_SHARED, /* Accessible by another process */
fid, /* which file is associated with mmap */
(off_t) 0); /* Offset in page frame */
答案 0 :(得分:2)
caddr_t
是一个BSD主义,而且是旧的。在Linux(和POSIX)下,mmap
返回一个void指针。
#include <sys/mman.h>
void *mmap (void *addr,
size_t length,
int prot,
int flags,
int fd,
off_t offset);
int munmap (void *addr,
size_t length);