Motorola MCP750 Specifications Page 157

  • Download
  • Add to my manuals
  • Print
  • Page
    / 344
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 156
Developing a Device Drive
r
10-11
Information needed to develop each type of driver I/O service routine is presented in the
sections that follow.
The Open Routine 10
Specification
#include <sys/types.h>
#include <sys/file.h>
#include <sys/errno.h>
#include <sys/open.h>
#include <sys/cred.h>
#include <sys/ddi.h>
int xxopen (devp, oflag, otyp, crp)
dev_t devp;
int oflag;
int otyp;
cred_t *crp;
Return Values
0 if the device open is successful
A nonzero value if the open fails. The number is returned to the user in
errno; it should be an error number as defined in <sys/errno.h>.
The driver’s open entry point routine is called by the kernel during an open(2) of the
device special file. It is mandatory in all drivers.
The devp argument is a pointer to the device major and minor number.
The oflag argument is a flag that represents the file status flags set by the value of the
oflag argument set on the open(2) system call. The file status flags are defined in the
file <sys/file.h>.
The following bits are set if the corresponding bits are set on the open(2) system call:
FREAD Open the device with read access permission
FWRITE Open the device with write access permission
FNDELAY Open the device and return immediately without sleeping
(do not block the open even if there is a problem). On a read
or a write, 0 is returned if the request cannot be satisfied
immediately.
FNONBLOCK Open the device and return immediately without sleeping
(do not block the open even if there is a problem). On a read
or a write, -1 is returned, and errno is set to EAGAIN if
the request cannot be satisfied immediately.
Page view 156
1 2 ... 152 153 154 155 156 157 158 159 160 161 162 ... 343 344

Comments to this Manuals

No comments