13.7.7. SYS_READ (0x06)

Read the contents of a file into a buffer. The file position is specified either:

The file position is at the start of the file when the file is opened, and is lost when the file is closed.The file operation should be performed as a single action whenever possible. That is, a write of 16KB should not be split into four 4KB chunks unless there is no alternative.

Entry

On entry, r1 contains a pointer to a four word data block:

word 1

contains a handle for a file previously opened with SYS_OPEN.

word 2

points to a buffer.

word 3

contains the number of bytes to read to the buffer from the file.

word 4

is an integer that specifies the file mode. Table 13.4 gives the valid values for the integer, and their corresponding ANSI C fopen() modes.

Return

On exit, r0 contains:

  • 0 if the call is successful

  • the number of bytes not read, if there is an error.

If the handle is for an interactive device (that is, SYS_ISTTY returns –1 for this handle), a non-zero return from SYS_READ indicates that the line read did not fill the buffer.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential