1write(9E)                     Driver Entry Points                    write(9E)
2
3
4

NAME

6       write - write data to a device
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/errno.h>
11       #include <sys/open.h>
12       #include <sys/cred.h>
13       #include <sys/ddi.h>
14       #include <sys/sunddi.h>
15
16
17
18       int prefixwrite(dev_t dev, struct uio *uio_p, cred_t *cred_p);
19
20

INTERFACE LEVEL

22       Architecture  independent  level  1  (DDI/DKI).  This  entry  point  is
23       optional.
24

PARAMETERS

26       dev        Device number.
27
28
29       uio_p      Pointer to the  uio(9S) structure that describes  where  the
30                  data is to be stored in user space.
31
32
33       cred_p     Pointer to the  user credential structure for the I/O trans‐
34                  action.
35
36

DESCRIPTION

38       Used for character or raw data I/O,  the  driver   write()  routine  is
39       called  indirectly  through   cb_ops(9S)  by the  write(2) system call.
40       The  write() routine supervises the data transfer from user space to  a
41       device described by the  uio(9S) structure.
42
43
44       The  write() routine should check the validity of the minor number com‐
45       ponent of  dev and the user credentials pointed to by cred_p, if perti‐
46       nent.
47

RETURN VALUES

49       The   write()  routine  should return 0 for success, or the appropriate
50       error number.
51

EXAMPLES

53       The following is an example of a write() routine  using  physio(9F)  to
54       perform writes to a seekable device:
55
56         static int
57         xxwrite(dev_t dev, struct uio *uiop, cred_t *credp)
58         {
59               int instance;
60               xx_t     xx;
61
62               instance = getminor(dev);
63               xx = ddi_get_soft_state(xxstate, instance);
64               if (xx == NULL)
65                      return (ENXIO);
66               return (physio(xxstrategy, NULL, dev, B_WRITE,
67                      xxmin, uiop));
68         }
69
70

SEE ALSO

72       read(2), write(2), read(9E), physio(9F), cb_ops(9S), uio(9S)
73
74
75       Writing Device Drivers
76
77
78
79SunOS 5.11                        28 Mar 1997                        write(9E)
Impressum