Is the umask function a kernel function?











up vote
0
down vote

favorite












I assumed the umask() function is a:




shell function containing a variable commonly referred to as file creation mask




but I was very wrong (and should improve this linked question) because umask() is not a shell function and doesn't contain such variable.



If the umask() function is not a "shell function" is it true to name it a "kernel function"?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I assumed the umask() function is a:




    shell function containing a variable commonly referred to as file creation mask




    but I was very wrong (and should improve this linked question) because umask() is not a shell function and doesn't contain such variable.



    If the umask() function is not a "shell function" is it true to name it a "kernel function"?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I assumed the umask() function is a:




      shell function containing a variable commonly referred to as file creation mask




      but I was very wrong (and should improve this linked question) because umask() is not a shell function and doesn't contain such variable.



      If the umask() function is not a "shell function" is it true to name it a "kernel function"?










      share|improve this question













      I assumed the umask() function is a:




      shell function containing a variable commonly referred to as file creation mask




      but I was very wrong (and should improve this linked question) because umask() is not a shell function and doesn't contain such variable.



      If the umask() function is not a "shell function" is it true to name it a "kernel function"?







      umask






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 23 at 9:45









      JohnDoea

      551132




      551132






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          There is no such thing as a "kernel function", unless you mean this.



          umask(2) is a system call. And it was so since the dawn of time [1].



          But it doesn't have to be that way -- you can implement it by having the actual bitmask be part of a chunk of memory that's always mapped at the same address and preserved through execve(2), and have the open(2), creat(2), etc userland wrappers pick it up from there. That would be just as POSIX-compliant.



          [1] in the original implementation, the u.u_cmask field that function sets is only used in a single place elsewhere -- in the "Make a new file" maknode() function.






          share|improve this answer




























            up vote
            1
            down vote













            The manual for umask says:




            A child process created via fork(2) inherits its parent's umask. The
            umask is left unchanged by execve(2).




            Therefore because it persists after a call to exec (execve), it must be implemented in the kernel, as all exec calls replace the running program (except some structures stored in the kernel).






            share|improve this answer





















            • My dear ctrl+alt+delor, a user I most appreciate and a man of honor IMO, I had to choose the other answer as "correct" because it defined what I called a "kernel function" as a a "system call" which I get the impression is at least a bit more accurate. Please forgive me for this "swapping". I also upvoted your answer.
              – JohnDoea
              Nov 26 at 9:48













            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: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            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%2f483636%2fis-the-umask-function-a-kernel-function%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            There is no such thing as a "kernel function", unless you mean this.



            umask(2) is a system call. And it was so since the dawn of time [1].



            But it doesn't have to be that way -- you can implement it by having the actual bitmask be part of a chunk of memory that's always mapped at the same address and preserved through execve(2), and have the open(2), creat(2), etc userland wrappers pick it up from there. That would be just as POSIX-compliant.



            [1] in the original implementation, the u.u_cmask field that function sets is only used in a single place elsewhere -- in the "Make a new file" maknode() function.






            share|improve this answer

























              up vote
              1
              down vote



              accepted










              There is no such thing as a "kernel function", unless you mean this.



              umask(2) is a system call. And it was so since the dawn of time [1].



              But it doesn't have to be that way -- you can implement it by having the actual bitmask be part of a chunk of memory that's always mapped at the same address and preserved through execve(2), and have the open(2), creat(2), etc userland wrappers pick it up from there. That would be just as POSIX-compliant.



              [1] in the original implementation, the u.u_cmask field that function sets is only used in a single place elsewhere -- in the "Make a new file" maknode() function.






              share|improve this answer























                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                There is no such thing as a "kernel function", unless you mean this.



                umask(2) is a system call. And it was so since the dawn of time [1].



                But it doesn't have to be that way -- you can implement it by having the actual bitmask be part of a chunk of memory that's always mapped at the same address and preserved through execve(2), and have the open(2), creat(2), etc userland wrappers pick it up from there. That would be just as POSIX-compliant.



                [1] in the original implementation, the u.u_cmask field that function sets is only used in a single place elsewhere -- in the "Make a new file" maknode() function.






                share|improve this answer












                There is no such thing as a "kernel function", unless you mean this.



                umask(2) is a system call. And it was so since the dawn of time [1].



                But it doesn't have to be that way -- you can implement it by having the actual bitmask be part of a chunk of memory that's always mapped at the same address and preserved through execve(2), and have the open(2), creat(2), etc userland wrappers pick it up from there. That would be just as POSIX-compliant.



                [1] in the original implementation, the u.u_cmask field that function sets is only used in a single place elsewhere -- in the "Make a new file" maknode() function.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 23 at 21:45









                mosvy

                4,941322




                4,941322
























                    up vote
                    1
                    down vote













                    The manual for umask says:




                    A child process created via fork(2) inherits its parent's umask. The
                    umask is left unchanged by execve(2).




                    Therefore because it persists after a call to exec (execve), it must be implemented in the kernel, as all exec calls replace the running program (except some structures stored in the kernel).






                    share|improve this answer





















                    • My dear ctrl+alt+delor, a user I most appreciate and a man of honor IMO, I had to choose the other answer as "correct" because it defined what I called a "kernel function" as a a "system call" which I get the impression is at least a bit more accurate. Please forgive me for this "swapping". I also upvoted your answer.
                      – JohnDoea
                      Nov 26 at 9:48

















                    up vote
                    1
                    down vote













                    The manual for umask says:




                    A child process created via fork(2) inherits its parent's umask. The
                    umask is left unchanged by execve(2).




                    Therefore because it persists after a call to exec (execve), it must be implemented in the kernel, as all exec calls replace the running program (except some structures stored in the kernel).






                    share|improve this answer





















                    • My dear ctrl+alt+delor, a user I most appreciate and a man of honor IMO, I had to choose the other answer as "correct" because it defined what I called a "kernel function" as a a "system call" which I get the impression is at least a bit more accurate. Please forgive me for this "swapping". I also upvoted your answer.
                      – JohnDoea
                      Nov 26 at 9:48















                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    The manual for umask says:




                    A child process created via fork(2) inherits its parent's umask. The
                    umask is left unchanged by execve(2).




                    Therefore because it persists after a call to exec (execve), it must be implemented in the kernel, as all exec calls replace the running program (except some structures stored in the kernel).






                    share|improve this answer












                    The manual for umask says:




                    A child process created via fork(2) inherits its parent's umask. The
                    umask is left unchanged by execve(2).




                    Therefore because it persists after a call to exec (execve), it must be implemented in the kernel, as all exec calls replace the running program (except some structures stored in the kernel).







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 23 at 10:08









                    ctrl-alt-delor

                    10.2k41955




                    10.2k41955












                    • My dear ctrl+alt+delor, a user I most appreciate and a man of honor IMO, I had to choose the other answer as "correct" because it defined what I called a "kernel function" as a a "system call" which I get the impression is at least a bit more accurate. Please forgive me for this "swapping". I also upvoted your answer.
                      – JohnDoea
                      Nov 26 at 9:48




















                    • My dear ctrl+alt+delor, a user I most appreciate and a man of honor IMO, I had to choose the other answer as "correct" because it defined what I called a "kernel function" as a a "system call" which I get the impression is at least a bit more accurate. Please forgive me for this "swapping". I also upvoted your answer.
                      – JohnDoea
                      Nov 26 at 9:48


















                    My dear ctrl+alt+delor, a user I most appreciate and a man of honor IMO, I had to choose the other answer as "correct" because it defined what I called a "kernel function" as a a "system call" which I get the impression is at least a bit more accurate. Please forgive me for this "swapping". I also upvoted your answer.
                    – JohnDoea
                    Nov 26 at 9:48






                    My dear ctrl+alt+delor, a user I most appreciate and a man of honor IMO, I had to choose the other answer as "correct" because it defined what I called a "kernel function" as a a "system call" which I get the impression is at least a bit more accurate. Please forgive me for this "swapping". I also upvoted your answer.
                    – JohnDoea
                    Nov 26 at 9:48




















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f483636%2fis-the-umask-function-a-kernel-function%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Morgemoulin

                    Scott Moir

                    Souastre