calling fsync() on in-memory files

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












From fsync(2):



fsync() transfers ("flushes") all modified in-core data of (i.e., modified
buffer cache pages for) the file referred to by the file descriptor fd to
the disk device (or other permanent storage device)


What effects can fsync have if fd was obtained by one of the in-memory
APIs like shm_open(3p) or `memfd_create(2)*? Is it ever necessary to
explicitly commit changes to the memory object?










share|improve this question

























    up vote
    0
    down vote

    favorite












    From fsync(2):



    fsync() transfers ("flushes") all modified in-core data of (i.e., modified
    buffer cache pages for) the file referred to by the file descriptor fd to
    the disk device (or other permanent storage device)


    What effects can fsync have if fd was obtained by one of the in-memory
    APIs like shm_open(3p) or `memfd_create(2)*? Is it ever necessary to
    explicitly commit changes to the memory object?










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      From fsync(2):



      fsync() transfers ("flushes") all modified in-core data of (i.e., modified
      buffer cache pages for) the file referred to by the file descriptor fd to
      the disk device (or other permanent storage device)


      What effects can fsync have if fd was obtained by one of the in-memory
      APIs like shm_open(3p) or `memfd_create(2)*? Is it ever necessary to
      explicitly commit changes to the memory object?










      share|improve this question













      From fsync(2):



      fsync() transfers ("flushes") all modified in-core data of (i.e., modified
      buffer cache pages for) the file referred to by the file descriptor fd to
      the disk device (or other permanent storage device)


      What effects can fsync have if fd was obtained by one of the in-memory
      APIs like shm_open(3p) or `memfd_create(2)*? Is it ever necessary to
      explicitly commit changes to the memory object?







      linux posix shared-memory






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 4 at 11:32









      phg

      623417




      623417




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          No effect. It is not associated with permanent storage.




          Historically, mixing mmap() and read()/write() could give inconsistent results.



          Modern Linux is very carefully structured to make it work correctly on every supported CPU. Though if your system is too obscure, you could still be the unlucky person who finds a hardware-specific bug.



          The point is that on a POSIX-conforming OS, it could be necessary to use msync() to flush after writing changes to a memory-map of a file, if you want read() to work consistently afterwards. If you want to understand the POSIX rules, it might be helpful to look at the MS_INVALIDATE flag of msync(), and what its existence implies :).



          However, POSIX msync() is specifically targeted at mappings which are associated with persistent storage. It is left undefined what effect it has on "shared memory objects". So this would be a pretty obscure way to answer your original question.



          Also bear in mind that just because something implements a system call with the same name as the POSIX one, it doesn't necessarily provide all the same guarantees as POSIX. Only a small number of OS versions have actually been submitted to the POSIX test suite. (It costs money).






          share|improve this answer






















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473210%2fcalling-fsync-on-in-memory-files%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            No effect. It is not associated with permanent storage.




            Historically, mixing mmap() and read()/write() could give inconsistent results.



            Modern Linux is very carefully structured to make it work correctly on every supported CPU. Though if your system is too obscure, you could still be the unlucky person who finds a hardware-specific bug.



            The point is that on a POSIX-conforming OS, it could be necessary to use msync() to flush after writing changes to a memory-map of a file, if you want read() to work consistently afterwards. If you want to understand the POSIX rules, it might be helpful to look at the MS_INVALIDATE flag of msync(), and what its existence implies :).



            However, POSIX msync() is specifically targeted at mappings which are associated with persistent storage. It is left undefined what effect it has on "shared memory objects". So this would be a pretty obscure way to answer your original question.



            Also bear in mind that just because something implements a system call with the same name as the POSIX one, it doesn't necessarily provide all the same guarantees as POSIX. Only a small number of OS versions have actually been submitted to the POSIX test suite. (It costs money).






            share|improve this answer


























              up vote
              1
              down vote













              No effect. It is not associated with permanent storage.




              Historically, mixing mmap() and read()/write() could give inconsistent results.



              Modern Linux is very carefully structured to make it work correctly on every supported CPU. Though if your system is too obscure, you could still be the unlucky person who finds a hardware-specific bug.



              The point is that on a POSIX-conforming OS, it could be necessary to use msync() to flush after writing changes to a memory-map of a file, if you want read() to work consistently afterwards. If you want to understand the POSIX rules, it might be helpful to look at the MS_INVALIDATE flag of msync(), and what its existence implies :).



              However, POSIX msync() is specifically targeted at mappings which are associated with persistent storage. It is left undefined what effect it has on "shared memory objects". So this would be a pretty obscure way to answer your original question.



              Also bear in mind that just because something implements a system call with the same name as the POSIX one, it doesn't necessarily provide all the same guarantees as POSIX. Only a small number of OS versions have actually been submitted to the POSIX test suite. (It costs money).






              share|improve this answer
























                up vote
                1
                down vote










                up vote
                1
                down vote









                No effect. It is not associated with permanent storage.




                Historically, mixing mmap() and read()/write() could give inconsistent results.



                Modern Linux is very carefully structured to make it work correctly on every supported CPU. Though if your system is too obscure, you could still be the unlucky person who finds a hardware-specific bug.



                The point is that on a POSIX-conforming OS, it could be necessary to use msync() to flush after writing changes to a memory-map of a file, if you want read() to work consistently afterwards. If you want to understand the POSIX rules, it might be helpful to look at the MS_INVALIDATE flag of msync(), and what its existence implies :).



                However, POSIX msync() is specifically targeted at mappings which are associated with persistent storage. It is left undefined what effect it has on "shared memory objects". So this would be a pretty obscure way to answer your original question.



                Also bear in mind that just because something implements a system call with the same name as the POSIX one, it doesn't necessarily provide all the same guarantees as POSIX. Only a small number of OS versions have actually been submitted to the POSIX test suite. (It costs money).






                share|improve this answer














                No effect. It is not associated with permanent storage.




                Historically, mixing mmap() and read()/write() could give inconsistent results.



                Modern Linux is very carefully structured to make it work correctly on every supported CPU. Though if your system is too obscure, you could still be the unlucky person who finds a hardware-specific bug.



                The point is that on a POSIX-conforming OS, it could be necessary to use msync() to flush after writing changes to a memory-map of a file, if you want read() to work consistently afterwards. If you want to understand the POSIX rules, it might be helpful to look at the MS_INVALIDATE flag of msync(), and what its existence implies :).



                However, POSIX msync() is specifically targeted at mappings which are associated with persistent storage. It is left undefined what effect it has on "shared memory objects". So this would be a pretty obscure way to answer your original question.



                Also bear in mind that just because something implements a system call with the same name as the POSIX one, it doesn't necessarily provide all the same guarantees as POSIX. Only a small number of OS versions have actually been submitted to the POSIX test suite. (It costs money).







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Oct 4 at 12:56

























                answered Oct 4 at 11:36









                sourcejedi

                20.6k42888




                20.6k42888



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473210%2fcalling-fsync-on-in-memory-files%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay