device_read


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

SYNOPSIS

#include<device/device.h>

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<device/device_request.h>

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.

RELATED INFORMATION

Functions: device_read_inband, device_read_overwrite, device_reply_server.