forked from apple/darwin-xnu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevice_open.html
112 lines (106 loc) · 3.54 KB
/
device_open.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<h2>device_open</h2>
<hr>
<p>
<strong>Function</strong> - Establish a connection to a device.
<h3>SYNOPSIS</h3>
<pre>
<strong>#include<device/device.h></strong>
<strong>kern_return_t device_open</strong>
<strong>(mach_port_t</strong> <var>master_port</var>,
<strong>mach_port_t</strong> <var>ledger</var>,
<strong>dev_mode_t</strong> <var>mode</var>,
<strong>security_token_t</strong> <var>security_id</var>,
<strong>dev_name_t</strong> <var>name</var>,
<strong>mach_port_t</strong> <var>device</var><strong>);</strong>
<strong>#include<device/device_request.h></strong>
<strong>kern_return_t device_open_request</strong>
<strong>(mach_port_t</strong> <var>master_port</var>,
<strong>mach_port_t</strong> <var>reply_port</var>,
<strong>mach_port_t</strong> <var>ledger</var>,
<strong>dev_mode_t</strong> <var>mode</var>,
<strong>security_token_t</strong> <var>security_id</var>,
<strong>dev_name_t</strong> <var>name</var><strong>);</strong>
<strong>kern_return_t ds_device_open_reply</strong>
<strong>(mach_port_t</strong> <var>reply_port</var>,
<strong>kern_return_t</strong> <var>return_code</var>,
<strong>mach_port_t</strong> <var>device</var><strong>);</strong>
</pre>
<h3>PARAMETERS</h3>
<dl>
<p>
<dt> <var>master_port</var>
<dd>
[in device-master send right]
The master device port. This port is
provided to the bootstrap task.
<p>
<dt> <var>reply_port</var>
<dd>
[in reply receive (to be converted to send-once) right]
The port to
which a reply is to be sent when the device is open.
<p>
<dt> <var>ledger</var>
<dd>
[pointer to a ledger send right]
Resource ledger from which the device will draw its resources.
<p>
<dt> <var>mode</var>
<dd>
[in scalar]
Opening mode. This is the bit-wise <strong>OR</strong> of the following
values:
<dl>
<p>
<dt> <strong>D_READ</strong>
<dd>
Read access
<p>
<dt> <strong>D_WRITE</strong>
<dd>
Write access
<p>
<dt> <strong>D_NODELAY</strong>
<dd>
Do not delay on open
</dl>
<p>
<dt> <var>security_id</var>
<dd>
[in scalar]
The security ID that tasks attempting to use this device port
must have. A zero value indicates all identities.
<p>
<dt> <var>name</var>
<dd>
[pointer to in array of <var>char</var>]
Name of the device to open.
<p>
<dt> <var>return_code</var>
<dd>
[in scalar]
Status of the open.
<p>
<dt> <var>device</var>
<dd>
[out device send right, in for asynchronous form]
The returned device
port.
</dl>
<h3>DESCRIPTION</h3>
<p>
The <strong>device_open</strong> function opens a device object. The
open operation of the
device is invoked, if the device is not already open. The open
count for the device
is incremented. Each open for a device returns a port, the allowed
operations upon which being governed by <var>mode</var>. The port is not
distinct.
<h3>RETURN VALUES</h3>
<p>
Only generic errors apply.
<h3>RELATED INFORMATION</h3>
<p>
Functions:
<a href="device_close.html"><strong>device_close</strong></a>,
<a href="device_reply_server.html"><strong>device_reply_server</strong></a>.