Device Driver Tutorial

Defining the Read Device Entry Point

The read(9E) routine returns type int. The read(9E) routine should return either DDI_SUCCESS or the appropriate error number.

The read(9E) routine takes three arguments. This dummy driver is so simple that this dummy_read() routine does not use any of the read(9E) arguments. The examples in Chapter 3, Reading and Writing Data in Kernel Memory show the read(9E) routine in more detail.

The following code is the dummy_read() routine that you should enter into your dummy.c file. You can copy the name portion of this function definition directly from the declaration you entered in Declaring the User Context Entry Points. Write a message to the system log and return success.

static int
dummy_read(dev_t dev, struct uio *uiop, cred_t *credp)
    cmn_err(CE_NOTE, "Inside dummy_read");
    return DDI_SUCCESS;