4 <strong>Function
</strong> - Establish a connection to a device.
7 <strong>#include<device/device.h>
</strong>
9 <strong>kern_return_t device_open
</strong>
10 <strong>(mach_port_t
</strong> <var>master_port
</var>,
11 <strong>mach_port_t
</strong> <var>ledger
</var>,
12 <strong>dev_mode_t
</strong> <var>mode
</var>,
13 <strong>security_token_t
</strong> <var>security_id
</var>,
14 <strong>dev_name_t
</strong> <var>name
</var>,
15 <strong>mach_port_t
</strong> <var>device
</var><strong>);
</strong>
18 <strong>#include<device/device_request.h>
</strong>
20 <strong>kern_return_t device_open_request
</strong>
21 <strong>(mach_port_t
</strong> <var>master_port
</var>,
22 <strong>mach_port_t
</strong> <var>reply_port
</var>,
23 <strong>mach_port_t
</strong> <var>ledger
</var>,
24 <strong>dev_mode_t
</strong> <var>mode
</var>,
25 <strong>security_token_t
</strong> <var>security_id
</var>,
26 <strong>dev_name_t
</strong> <var>name
</var><strong>);
</strong>
29 <strong>kern_return_t ds_device_open_reply
</strong>
30 <strong>(mach_port_t
</strong> <var>reply_port
</var>,
31 <strong>kern_return_t
</strong> <var>return_code
</var>,
32 <strong>mach_port_t
</strong> <var>device
</var><strong>);
</strong>
37 <dt> <var>master_port
</var>
39 [in device-master send right]
40 The master device port. This port is
41 provided to the bootstrap task.
43 <dt> <var>reply_port
</var>
45 [in reply receive (to be converted to send-once) right]
47 which a reply is to be sent when the device is open.
49 <dt> <var>ledger
</var>
51 [pointer to a ledger send right]
52 Resource ledger from which the device will draw its resources.
57 Opening mode. This is the bit-wise
<strong>OR
</strong> of the following
61 <dt> <strong>D_READ
</strong>
65 <dt> <strong>D_WRITE
</strong>
69 <dt> <strong>D_NODELAY
</strong>
74 <dt> <var>security_id
</var>
77 The security ID that tasks attempting to use this device port
78 must have. A zero value indicates all identities.
82 [pointer to in array of
<var>char
</var>]
83 Name of the device to open.
85 <dt> <var>return_code
</var>
90 <dt> <var>device
</var>
92 [out device send right, in for asynchronous form]
98 The
<strong>device_open
</strong> function opens a device object. The
100 device is invoked, if the device is not already open. The open
102 is incremented. Each open for a device returns a port, the allowed
103 operations upon which being governed by
<var>mode
</var>. The port is not
105 <h3>RETURN VALUES
</h3>
107 Only generic errors apply.
108 <h3>RELATED INFORMATION
</h3>
111 <a href=
"device_close.html"><strong>device_close
</strong></a>,
112 <a href=
"device_reply_server.html"><strong>device_reply_server
</strong></a>.