1ldi_ioctl(9F)            Kernel Functions for Drivers            ldi_ioctl(9F)
2
3
4

NAME

6       ldi_ioctl - send an ioctl to a device
7

SYNOPSIS

9       #include <sys/sunldi.h>
10
11
12
13       int ldi_ioctl(ldi_handle_t lh, int cmd, intptr_t arg, int mode,
14            cred_t  *cr, int *rvalp);
15
16

PARAMETERS

18       lh       Layered handle.
19
20
21       cr       Pointer to a credential structure used to open a device.
22
23
24       rvalp    Caller  return  value. (May be set by driver and is valid only
25                if the ioctl() succeeds).
26
27
28       cmd      Command argument. Interpreted by driver ioctl() as the  opera‐
29                tion to be performed.
30
31
32       arg      Driver  parameter. Argument interpretation is driver dependent
33                and usually depends on the command type.
34
35
36       mode     Bit field that contains:
37
38                FKIOCTL    Inform the target device that the ioctl  originated
39                           from within the kernel.
40
41
42

DESCRIPTION

44       The  ldi_ioctl()  function  passes an ioctl request to the device entry
45       point for the device specified by the layered handle. This operation is
46       supported for block, character, and streams devices.
47
48
49       If  arg  is  interpreted   as  a  pointer (that is, as not an immediate
50       value) and the data pointed to by arg is in the kernels address  space,
51       the  FKIOCTL  flag  should  be set. This indicates to the target driver
52       that no data model conversion is necessary.
53
54
55       If the caller of ldi_ioctl() is not the originator of  the  ioctl  data
56       pointed  to by arg, (for example, when passing on an ioctl request from
57       a user process), the caller must pass on the mode  parameter  from  the
58       original  ioctl.  This  is because the mode parameter contains the con‐
59       tains the FMODELS bits that enable the target driver to  determine  the
60       data  model  of  the process which originated the ioctl and perform any
61       necessary conversions. See ddi_model_convert_from(9F) for more informa‐
62       tion.
63

STREAM IOCTLS

65       For   a   general  description  of  streams  ioctls  see  streamio(7I).
66       ldi_ioctl() supports a number of streams ioctls, using layered  handles
67       in  the  place  of  file  descriptors.  When issuing streams ioctls the
68       FKIOCTL parameter should be specified. The possible return  values  for
69       supported ioctl commands are also documented in streamio(7I).
70
71
72       The following streams ioctls are supported:
73
74       I_PLINK      Behaves  as documented in streamio(7I). The layered handle
75                    lh should point to the streams multiplexer. The arg param‐
76                    eter  should point to a layered handle for another streams
77                    driver.
78
79
80       I_UNPLINK    Behaves as documented in streamio(7I)).  The layered  han‐
81                    dle  lh  should  point to the streams multiplexer. The arg
82                    parameter is the multiplexor ID number returned by I_PLINK
83                    when the streams were linked.
84
85

RETURN VALUES

87       The  ldi_ioctl()  function  returns 0 upon success. If a failure occurs
88       before the request is passed on to the device, possible  return  values
89       are  shown  below.  Otherwise any other error number may be returned by
90       the device.
91
92       EINVAL     Invalid input parameters.
93
94
95       ENOTSUP    Operation is not supported for this device.
96
97

CONTEXT

99       These functions can be called from user or kernel context.
100

SEE ALSO

102       streamio(7I), ddi_model_convert_from(9F)
103
104
105
106SunOS 5.11                        3 June 2003                    ldi_ioctl(9F)
Impressum