What system call does Evince use to open pdf?

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











up vote
2
down vote

favorite












I have tried to hook system calls using linux kernel module. However, when I open a pdf file using Evince, I find no open,read and write is used on this specific file, only lstat is used.



Here is the strace log of strace evince folder1/test.pdf



So I wonder what system call does evince use to open andread from file?










share|improve this question

















  • 2




    Try strace with the -f (follow) option, since the clone call creates a subprocess.
    – Thomas Dickey
    Nov 23 at 1:24










  • @ThomasDickey Thanks, I've updated the log in the link. Now I can see open("/home/xytao/folder1/test.pdf", O_RDONLY) in line 5376, but I still don't see read, maybe because it's using pread?
    – user6456568
    Nov 23 at 1:36











  • perhaps the socket I/O is what's doing it - or pread can. Reading the source-code would help :-)
    – Thomas Dickey
    Nov 23 at 1:40











  • Yes, pread. This is the start of the PDF file: pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256
    – Filipe Brandenburger
    Nov 23 at 2:17














up vote
2
down vote

favorite












I have tried to hook system calls using linux kernel module. However, when I open a pdf file using Evince, I find no open,read and write is used on this specific file, only lstat is used.



Here is the strace log of strace evince folder1/test.pdf



So I wonder what system call does evince use to open andread from file?










share|improve this question

















  • 2




    Try strace with the -f (follow) option, since the clone call creates a subprocess.
    – Thomas Dickey
    Nov 23 at 1:24










  • @ThomasDickey Thanks, I've updated the log in the link. Now I can see open("/home/xytao/folder1/test.pdf", O_RDONLY) in line 5376, but I still don't see read, maybe because it's using pread?
    – user6456568
    Nov 23 at 1:36











  • perhaps the socket I/O is what's doing it - or pread can. Reading the source-code would help :-)
    – Thomas Dickey
    Nov 23 at 1:40











  • Yes, pread. This is the start of the PDF file: pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256
    – Filipe Brandenburger
    Nov 23 at 2:17












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have tried to hook system calls using linux kernel module. However, when I open a pdf file using Evince, I find no open,read and write is used on this specific file, only lstat is used.



Here is the strace log of strace evince folder1/test.pdf



So I wonder what system call does evince use to open andread from file?










share|improve this question













I have tried to hook system calls using linux kernel module. However, when I open a pdf file using Evince, I find no open,read and write is used on this specific file, only lstat is used.



Here is the strace log of strace evince folder1/test.pdf



So I wonder what system call does evince use to open andread from file?







ubuntu linux-kernel system-calls read evince






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 at 1:00









user6456568

203




203







  • 2




    Try strace with the -f (follow) option, since the clone call creates a subprocess.
    – Thomas Dickey
    Nov 23 at 1:24










  • @ThomasDickey Thanks, I've updated the log in the link. Now I can see open("/home/xytao/folder1/test.pdf", O_RDONLY) in line 5376, but I still don't see read, maybe because it's using pread?
    – user6456568
    Nov 23 at 1:36











  • perhaps the socket I/O is what's doing it - or pread can. Reading the source-code would help :-)
    – Thomas Dickey
    Nov 23 at 1:40











  • Yes, pread. This is the start of the PDF file: pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256
    – Filipe Brandenburger
    Nov 23 at 2:17












  • 2




    Try strace with the -f (follow) option, since the clone call creates a subprocess.
    – Thomas Dickey
    Nov 23 at 1:24










  • @ThomasDickey Thanks, I've updated the log in the link. Now I can see open("/home/xytao/folder1/test.pdf", O_RDONLY) in line 5376, but I still don't see read, maybe because it's using pread?
    – user6456568
    Nov 23 at 1:36











  • perhaps the socket I/O is what's doing it - or pread can. Reading the source-code would help :-)
    – Thomas Dickey
    Nov 23 at 1:40











  • Yes, pread. This is the start of the PDF file: pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256
    – Filipe Brandenburger
    Nov 23 at 2:17







2




2




Try strace with the -f (follow) option, since the clone call creates a subprocess.
– Thomas Dickey
Nov 23 at 1:24




Try strace with the -f (follow) option, since the clone call creates a subprocess.
– Thomas Dickey
Nov 23 at 1:24












@ThomasDickey Thanks, I've updated the log in the link. Now I can see open("/home/xytao/folder1/test.pdf", O_RDONLY) in line 5376, but I still don't see read, maybe because it's using pread?
– user6456568
Nov 23 at 1:36





@ThomasDickey Thanks, I've updated the log in the link. Now I can see open("/home/xytao/folder1/test.pdf", O_RDONLY) in line 5376, but I still don't see read, maybe because it's using pread?
– user6456568
Nov 23 at 1:36













perhaps the socket I/O is what's doing it - or pread can. Reading the source-code would help :-)
– Thomas Dickey
Nov 23 at 1:40





perhaps the socket I/O is what's doing it - or pread can. Reading the source-code would help :-)
– Thomas Dickey
Nov 23 at 1:40













Yes, pread. This is the start of the PDF file: pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256
– Filipe Brandenburger
Nov 23 at 2:17




Yes, pread. This is the start of the PDF file: pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256
– Filipe Brandenburger
Nov 23 at 2:17










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










As pointed out by @ThomasDickey, you need to pass strace the -f option, in order to include the trace of all the threads.



(The clone() syscalls are creating new threads, not processes, but you still need -f to have strace follow threads.)



Once you're following all threads, the open becomes aparent, opening the file in read-only mode, on file descriptor 19:



open("/home/xytao/folder1/test.pdf", O_RDONLY) = 19


The contents of the file are read using a succession of pread calls into a small 256 character buffer, the first of which gets the %PDF-1.3 header:



pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256


If you go through the trace, you'll see it will then lseek to the end of the file (to determine file size), then read a couple of blocks of data from there. I assume that's information about the pages in the document.



The following preads happen at offsets in the middle of the file, but all of them seem to start with some information about "page", so I assume that's evince figuring out about the pages in the PDF document, probably using offsets it got from the end of the file.






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: 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%2f483562%2fwhat-system-call-does-evince-use-to-open-pdf%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    As pointed out by @ThomasDickey, you need to pass strace the -f option, in order to include the trace of all the threads.



    (The clone() syscalls are creating new threads, not processes, but you still need -f to have strace follow threads.)



    Once you're following all threads, the open becomes aparent, opening the file in read-only mode, on file descriptor 19:



    open("/home/xytao/folder1/test.pdf", O_RDONLY) = 19


    The contents of the file are read using a succession of pread calls into a small 256 character buffer, the first of which gets the %PDF-1.3 header:



    pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256


    If you go through the trace, you'll see it will then lseek to the end of the file (to determine file size), then read a couple of blocks of data from there. I assume that's information about the pages in the document.



    The following preads happen at offsets in the middle of the file, but all of them seem to start with some information about "page", so I assume that's evince figuring out about the pages in the PDF document, probably using offsets it got from the end of the file.






    share|improve this answer
























      up vote
      0
      down vote



      accepted










      As pointed out by @ThomasDickey, you need to pass strace the -f option, in order to include the trace of all the threads.



      (The clone() syscalls are creating new threads, not processes, but you still need -f to have strace follow threads.)



      Once you're following all threads, the open becomes aparent, opening the file in read-only mode, on file descriptor 19:



      open("/home/xytao/folder1/test.pdf", O_RDONLY) = 19


      The contents of the file are read using a succession of pread calls into a small 256 character buffer, the first of which gets the %PDF-1.3 header:



      pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256


      If you go through the trace, you'll see it will then lseek to the end of the file (to determine file size), then read a couple of blocks of data from there. I assume that's information about the pages in the document.



      The following preads happen at offsets in the middle of the file, but all of them seem to start with some information about "page", so I assume that's evince figuring out about the pages in the PDF document, probably using offsets it got from the end of the file.






      share|improve this answer






















        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        As pointed out by @ThomasDickey, you need to pass strace the -f option, in order to include the trace of all the threads.



        (The clone() syscalls are creating new threads, not processes, but you still need -f to have strace follow threads.)



        Once you're following all threads, the open becomes aparent, opening the file in read-only mode, on file descriptor 19:



        open("/home/xytao/folder1/test.pdf", O_RDONLY) = 19


        The contents of the file are read using a succession of pread calls into a small 256 character buffer, the first of which gets the %PDF-1.3 header:



        pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256


        If you go through the trace, you'll see it will then lseek to the end of the file (to determine file size), then read a couple of blocks of data from there. I assume that's information about the pages in the document.



        The following preads happen at offsets in the middle of the file, but all of them seem to start with some information about "page", so I assume that's evince figuring out about the pages in the PDF document, probably using offsets it got from the end of the file.






        share|improve this answer












        As pointed out by @ThomasDickey, you need to pass strace the -f option, in order to include the trace of all the threads.



        (The clone() syscalls are creating new threads, not processes, but you still need -f to have strace follow threads.)



        Once you're following all threads, the open becomes aparent, opening the file in read-only mode, on file descriptor 19:



        open("/home/xytao/folder1/test.pdf", O_RDONLY) = 19


        The contents of the file are read using a succession of pread calls into a small 256 character buffer, the first of which gets the %PDF-1.3 header:



        pread(19, "%PDF-1.3rn%241263305327rn3 0 objrn<</Fil"..., 256, 0) = 256


        If you go through the trace, you'll see it will then lseek to the end of the file (to determine file size), then read a couple of blocks of data from there. I assume that's information about the pages in the document.



        The following preads happen at offsets in the middle of the file, but all of them seem to start with some information about "page", so I assume that's evince figuring out about the pages in the PDF document, probably using offsets it got from the end of the file.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 at 3:12









        Filipe Brandenburger

        6,6501731




        6,6501731



























            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%2f483562%2fwhat-system-call-does-evince-use-to-open-pdf%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

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

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay