#include <oskit/exec/exec.h>typedef int exec_read_func_t(void *handle, oskit_addr_t file_ofs, void *buf, oskit_size_t size, [out] oskit_size_t *actual);
This type describes the function prototype of the read callback function which the client OS must supply to the executable interpreter; it is used by the executable interpreter library to read ``metadata'' from the executable file such as the executable file's header (as opposed to the actual executable data itself). It is basically analogous in purpose and semantics to the standard POSIX read function.
- handle
- This is simply the opaque pointer value originally passed by the client in the call to the executable interpreter; the client's callbacks typically use it to locate any state relevant to the executable being loaded. The actual use or meaning of this parameter is completely opaque to the executable interpreter library.
- file_ofs
- This parameter indicates the offset in the file at which to start reading.
- buf
- The buffer into which to read data.
- size
- The maximum amount of data to read from the file. Less than this much data may be read if end-of-file is reached during the read.
- actual
- The client callback returns the amount of data actually read in this parameter. It should be equal to the requested size unless the end-of-file was reached.
Returns 0 on success, or an error code on failure. The error code may be either one of the EX_ error codes defined in exec.h, or it may be a caller-defined error code, which the executable interpreter code will simply pass directly back through to the original caller.