Back to Darwin Xnu

Device Read

osfmk/man/device_read.html

latest1.9 KB
Original Source

device_read


Function - Read a sequence of bytes from a specific device.

SYNOPSIS

**#include&ltdevice/device.h&gt**** kern\_return\_t device\_read****(device\_t**device, **mach\_port\_t** reply\_port, **dev\_mode\_t** mode, **recnum\_t** recnum, **io\_buf\_len\_t** bytes\_wanted, **io\_buf\_ptr\_t** io\_buf\_ptr\_t, **mach\_msg\_type\_number\_t** mach\_msg\_type\_number\_t**);****#include&ltdevice/device\_request.h&gt ****kern\_return\_t device\_read\_request**** (mach\_port\_t **device,** mach\_port\_t **reply\_port,** dev\_mode\_t **mode,** recnum\_t **recnum,** io\_buf\_len\_t **bytes\_wanted** ); ****kern\_return\_t ds\_device\_read\_reply**** (mach\_port\_t **reply\_port,** kern\_return\_t **return\_code,** io\_buf\_ptr\_t **data,** mach\_msg\_type\_number\_t **data\_count** );**

PARAMETERS

device[in device send right] A device port to the device to be read.

reply_port[in reply receive (to be converted to send-once) right] The port to which the reply message is to be sent.

mode[in scalar] I/O mode value. Meaningful options are:

D_NOWAIT Do not wait if data is unavailable.

recnum[in scalar] Record number to be read.

bytes_wanted[in scalar] Size of data transfer.

return_code[in scalar] The return status code from the read.

data[out pointer to dynamic array of bytes, in for asynchronous form] Returned data bytes.

data_count[out scalar, in for asynchronous form] Number of returned data bytes.

DESCRIPTION

The device_read function reads a sequence of bytes from a device object. The meaning of recnum as well as the specific operation performed is device dependent.

RETURN VALUES

Only generic errors apply.

Functions: device_read_inband, device_read_overwrite, device_reply_server.