Sujet : Re: Memory mapping: MAP_PRIVATE and msync()
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 08. Apr 2024, 02:50:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <uuvigf$340q8$1@dont-email.me>
References : 1 2
User-Agent : Pan/0.155 (Kherson; fc5a80b8)
On Sun, 07 Apr 24 15:18:47 +0000, pehache wrote:
void* p2 = mmap( NULL
, n
, PROT_READ | PROT_WRITE
, MAP_SHARED | MAP_NORESERVE
, fd
, 0 );
Not easy to remember what the arguments mean. Try this:
void * p2 = mmap
(
/*addr =*/ NULL,
/*length =*/ n,
/*prot =*/ PROT_READ | PROT_WRITE,
/*flags =*/ MAP_SHARED | MAP_NORESERVE,
/*fd =*/ fd,
/*offset =*/ 0
);