Thread (2 messages) 2 messages, 2 authors, 2017-03-07
  • (off-list ancestor, not in this archive)
  • Re: syscall(2) · Mike Frysinger <hidden> · 2017-03-06
  • Re: syscall(2) · walter harms <hidden> · 2017-03-07

Re: syscall(2)

flat view

From: Mike Frysinger <hidden>
Date: 2017-03-06 19:08:03

On 06 Mar 2017 12:01, Michael Kerrisk (man-pages) wrote:
[Extending the CC for some other input. Changhee Han added the text
that you are asking about; Mike F has done a lot of other work on the
page. Perhaps they can comment.]

On 5 March 2017 at 09:08, Victor Khimenko [off-list ref] wrote:
quoted
syscall(2) example includes the following snippet which explains how to
call readahead on ARM:

       syscall(SYS_readahead, fd, 0,
                   (unsigned int) (offset >> 32),
                   (unsigned int) (offset & 0xFFFFFFFF),
                   count);

But ARM EABI specifies that "A double-word sized type is passed in two
consecutive registers (e.g., r0 and r1, or r2 and r3). The content of
the registers is as if the value had been loaded from memory representation
with a single LDM instruction."

This would imply that arguments are swapped around in the man page, no?
So, I'm taking it that you mean the call should look like this:

       syscall(SYS_readahead, fd, 0,
                   (unsigned int) (offset & 0xFFFFFFFF),
                   (unsigned int) (offset >> 32),
                  count);

Is that what you mean?
quoted
I've tried to experiement and with ftruncate, at least, it works like
this...
Sounds plausible. I'm hoping that Mike or Changhee Han might comment.
it depends on the endianness.  the man page shows BE, and Victor's
suggestion changes it to LE.  we probably need to explain that and
not just swap the args in the example.
-mike

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help