Re: Memory mapping: MAP_PRIVATE and msync()

Liste des GroupesRevenir à cl c  
Sujet : Re: Memory mapping: MAP_PRIVATE and msync()
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.c
Date : 08. Apr 2024, 05:06:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240407200220.887@kylheku.com>
References : 1 2 3
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-04-08, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
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:

Nobody is going to follow your grotesque, poorly considered coding
conventions.

>
    void * p2 = mmap
      (
        /*addr =*/ NULL,
            ^^^^     ^^^^ a null pointer is some kind of "addr"

        /*length =*/ n,
        /*prot =*/ PROT_READ | PROT_WRITE,
            ^^^^     ^^^^
             |         |
             `---------|---- You know this
                       `---- from this.
                       
        /*flags =*/ MAP_SHARED | MAP_NORESERVE,
            ^^^^
            Tells you nothing. You know that preprocessor constants
            combined together with | are "flags".

        /*fd =*/ fd,
            ^^     ^^
             identical, tells you nothing.

        /*offset =*/ 0
      );


--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Date Sujet#  Auteur
7 Apr 24 * Memory mapping: MAP_PRIVATE and msync()11pehache
7 Apr 24 +* Re: Memory mapping: MAP_PRIVATE and msync()6pehache
7 Apr 24 i+- Re: Memory mapping: MAP_PRIVATE and msync()1pehache
8 Apr 24 i`* Re: Memory mapping: MAP_PRIVATE and msync()4Lawrence D'Oliveiro
8 Apr 24 i +- Re: Memory mapping: MAP_PRIVATE and msync()1Kaz Kylheku
8 Apr 24 i `* Re: Memory mapping: MAP_PRIVATE and msync()2bart
9 Apr 24 i  `- Re: Memory mapping: MAP_PRIVATE and msync()1Lawrence D'Oliveiro
7 Apr 24 `* Re: Memory mapping: MAP_PRIVATE and msync()4Lew Pitcher
7 Apr 24  `* Re: Memory mapping: MAP_PRIVATE and msync()3pehache
8 Apr 24   `* Re: Memory mapping: MAP_PRIVATE and msync()2pehache
8 Apr 24    `- fu2 is fne (Was: Memory mapping: =?UTF-8?Q?MAP=5FPRIVATE=20and=20msync=28=29?=)1Kenny McCormack

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal