PHYSIO(9)

NAME
physread, physwrite - initiate I/O on raw devices

SYNOPSIS
#include <sys/buf.h>
#include <sys/device.h>
int
physread(struct dev_read_args *ap);
int
physwrite(struct dev_write_args *ap);

DESCRIPTION
Physread() and physwrite() are helper functions typically called from character device read and write routines to start I/O on a user process buffer. They will call the dev_dstrategy() routine one or more times depending on the size of transfer which is described by the ap argument.

The maximum amount of data transferable in one iteration of the physread() and physwrite() functions is determined by the maximum I/O size supported by the device dev, otherwise the value of MAXPHYS is used. Until the I/O operation is complete, the calling process or thread is put to sleep with the wait message set to ‘physstr’.

The physread() and physwrite() functions always await the completion of the entire requested transfer before returning, unless an error condition is detected earlier.

The ap argument is a pointer to a dev_read_args or dev_write_args structure, as passed to d_read or d_write.

RETURN VALUES
If successful physread() and physwrite() will return 0.

The errno value EFAULT will be returned if the address range described by uio is not accessible by the calling process or thread.

Note that the actual transfer size may be less than requested by ap if the device signals an “end of file” condition.

SEE ALSO
read(2), write(2), uio(9)