Device Driver Tutorial

Defining the Write Device Entry Point

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

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

The following code is the dummy_write() 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_write(dev_t dev, struct uio *uiop, cred_t *credp)
    cmn_err(CE_NOTE, "Inside dummy_write");
    return DDI_SUCCESS;