aboutsummaryrefslogtreecommitdiff
path: root/en/devices/architecture/kernel/reqs-interfaces.html
blob: 53fbf65600b6aa57502bbb8ed1f9ccee347ed2b0 (plain)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<html devsite>
  <head>
    <title>Interface Requirements</title>
    <meta name="project_path" value="/_project.yaml" />
    <meta name="book_path" value="/_book.yaml" />
  </head>
  {% include "_versions.html" %}
  <body>
  <!--
      Copyright 2017 The Android Open Source Project

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
  -->

<p>This page describes a subset of the Linux kernel interfaces on which Android
relies to function properly. The presence and correctness of these interfaces is
tested as part of the <a href="/devices/tech/vts/index.html">Vendor Test Suite
(VTS)</a>. This subset will grow over time to contain a larger portion of
Android kernel interfaces.</p>

<h2 id="system-calls">System calls</h2>
<p>All system calls are expected to provide the same signatures and semantics as
in the upstream Linux kernel of the same version.</p>

<h3 id="prctl">prctl</h3>
<p>In addition to the upstream <code>prctl</code> operations for supported
kernel versions, Android relies on additional <code>prctl</code> operations, the
implementation of which can be found in the android-common kernel.</p>

<pre class="prettyprint">
PR_SET_TIMERSLACK_PID
PR_SET_VMA
</pre>

<h2 id="filesystems">Filesystems</h2>
<p>The Linux kernel exports interfaces via several filesystems. Android expects
these interfaces to communicate the same information, in the same format, and
provide the same semantics as in the upstream Linux kernel. For interfaces that
do not exist upstream, the appropriate behavior is dictated by the corresponding
branch of the Android common kernel.</p>

<h3 id="procfs">procfs</h3>
<table>
  <tr>
   <th>Interface</th>
   <th>Description</th>
  </tr>
  <tr>
  <td>/proc/asound/</td>
  <td>Read-only file showing the list of currently configured ALSA drivers.</td>
  </tr>
  <tr>
   <td>/proc/cmdline</td>
   <td>Read-only file containing command line arguments passed to the kernel.
   </td>
  </tr>
  <tr>
   <td>/proc/config.gz</td>
   <td>Read-only file containing kernel build configuration.</td>
  </tr>
  <tr>
   <td>/proc/cpuinfo</td>
   <td>Read-only file containing architecture-specific CPU details.</td>
  </tr>
  <tr>
    <td>/proc/diskstats</td>
    <td>Read-only file showing I/O statistics of block devices.</td>
  </tr>
  <tr>
    <td>/proc/filesystems</td>
    <td>Read-only file listing filesystems currently supported by the
    kernel.</td>
  </tr>
  <tr>
  <tr>
   <td>/proc/kmsg</td>
   <td>Read-only file showing kernel messages in real time.</td>
  </tr>
  <tr>
    <td>/proc/loadavg</td>
    <td>Read-only file showing CPU and IO load average over time.</td>
  </tr>
  <tr>
   <td>/proc/meminfo</td>
   <td>Read-only file showing memory subsystem details.</td>
  </tr>
  <tr>
    <td>/proc/misc</td>
    <td>Read-only file listing miscellaneous drivers registered on the
    miscellaneous major device.</td>
  </tr>
  <tr>
   <td>/proc/modules</td>
   <td>Read-only file containing information about loaded kernel modules.</td>
  </tr>
  <tr>
   <td>/proc/mounts</td>
 <td>Symlink to <code>/proc/self/mounts</code>, which is a read-only file
 listing information about the mounted filesystems.</td>
  </tr>
  <tr>
    <td>/proc/net</td>
    <td>Directory containing a variety of network stack parameters.</td>
  </tr>
  <tr>
   <td>/proc/net/xt_qtaguid/</td>
   <td>Read-write file providing information about tagged sockets.</td>
  </tr>
  <tr>
    <td>/proc/pagetypeinfo</td>
    <td>Read-only file containing page allocator information.</td>
  </tr>
  <tr>
   <td>/proc/stat</td>
   <td>Read-only file containing various kernel and system statistics.</td>
  </tr>
  <tr>
    <td>/proc/swaps</td>
    <td>Read-only file showing swap space utilization. <strong>This file is
    optional; its contents and permissions will be verified in VTS only if the
    file is present</strong>.</td>
  </tr>
  <tr>
    <td>/proc/sys/abi/swp</td>
    <td>Read-write file which determines the behavior of the obsoleted ARM
    instruction SWP.</td>
  </tr>
  <tr>
    <td>/proc/sys/fs/pipe-max-size</td>
    <td>Read-write file that reports the maximum size, in bytes, of an
    individual pipe buffer.</td>
  </tr>
  <tr>
    <td>/proc/sys/fs/protected_hardlinks</td>
    <td>Read-write file that controls the behavior of creation of hard links.
    </td>
  </tr>
  <tr>
    <td>/proc/sys/fs/protected_symlinks</td>
    <td>Read-write file that controls the behavior of creation of symbolic
    links.</td>
  </tr>
  <tr>
    <td>/proc/sys/fs/suid_dumpable</td>
    <td>Read-write file that controls the core dump mode for setuid or otherwise
    protected/tainted binaries.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/core_pattern</td>
    <td>Read-write file that specifies the core dump filename pattern.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/core_pipe_limit</td>
    <td>Read-write file that defines how many concurrent crashing processes may
    be piped to user applications in parallel.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/dmesg_restrict</td>
    <td>Read-write file that controls whether unprivileged users may access
    dmesg.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/domainname</td>
    <td>Read-write file that contains the YP/NIS domain name of the system.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/hostname</td>
    <td>Read-write file that determines the host name of the system.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/hung_task_timeout_secs</td>
    <td>Read-write file that controls the timeout used to determine when a task
    has become non-responsive and should be considered hung. <strong>This file
    is optional; its contents and permissions will be verified in VTS only if
    the file is present</strong>.</td>
  </tr>
  <tr>
   <td>/proc/sys/kernel/kptr_restrict</td>
   <td>Read-write file that determines whether kernel pointers are printed in
   <code>proc</code> files and other interfaces.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/modules_disabled</td>
    <td>Read-write file that controls whether kernel modules may be loaded.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/panic_on_oops</td>
    <td>Read-write file that controls the kernel's behavior on oops.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/perf_event_max_sample_rate</td>
    <td>Read-write file that controls the maximum sample rate of performance
    events.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/perf_event_paranoid</td>
    <td>Read-write file that controls the usage of the performance events system
    by unprivileged users.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/pid_max</td>
    <td>Read-write file that contains the PID allocation wrap value.</td>
  </tr>
  <tr>
    <td>/proc/sys/kernel/random/boot_id</td>
    <td>Read-only file that contains a new random ID on each boot.</td>
  </tr>
  <tr>
   <td>/proc/sys/kernel/randomize_va_space</td>
   <td>Read-write file that determines the address layout randomization policy
   for the system.</td>
  </tr>
  <tr>
  <td>/proc/sys/kernel/sched_child_runs_first</td>
  <td>Read-write file that controls whether newly forked tasks are favored in
  scheduling over their parent tasks.</td>
  </tr>
  <tr>
  <td>/proc/sys/kernel/sched_latency_ns</td>
  <td>Read-write file that contains the maximum latency, in nanoseconds, a task
  may incur prior to being scheduled.</td>
  </tr>
  <tr>
  <td>/proc/sys/kernel/sched_rt_period_us</td>
  <td>Read-write file that contains the period length used by the system-wide RT
  execution limit in microseconds.</td>
  </tr>
  <tr>
  <td>/proc/sys/kernel/sched_rt_runtime_us</td>
  <td>Read-write file that contains the amount of time, relative to
  sched_rt_period_us, that the system may execute RT tasks.</td>
  </tr>
  <tr>
  <td>/proc/sys/kernel/sched_tunable_scaling</td>
  <td>Read-write file that controls whether sched_latency_ns should be
  automatically adjusted by the scheduler based on the number of CPUs.</td>
  </tr>
  <tr>
  <td>/proc/sys/kernel/sched_wakeup_granularity_ns</td>
  <td>Read-write file that contains how much more virtual runtime task A must
  have than task B in nanoseconds for task B to preempt it.</td>
  </tr>
  <tr>
  <td>/proc/sys/kernel/sysrq</td>
  <td>Read-write file that controls the functions allowed to be invoked via the
  sysrq key.</td>
  </tr>
  <tr>
  <td>/proc/sys/net/*</td>
  <td>Directory containing a variety of network stack parameters.</td>
  </tr>
  <tr>
  <td>/proc/sysrq-trigger</td>
  <td>Write-only file that can be used to initiate sysrq functions.</td>
  </tr>
  <tr>
  <td>/proc/sys/vm/dirty_background_ratio</td>
  <td>Read-write file that contains, as a percentage of total available memory
  (free pages and reclaimable pages), the number of pages at which the
  background kernel flusher threads will start writing out dirty data.</td>
  </tr>
  <tr>
  <td>/proc/sys/vm/dirty_expire_centisecs</td>
  <td>Read-write file that defines when dirty data is old enough to be eligible
  for write out by the kernel flusher threads.</td>
  </tr>
  <tr>
  <td>/proc/sys/vm/drop_caches</td>
  <td>Read-write file that can be used to force the kernel to drop clean
  caches.</td>
  </tr>
  <tr>
  <td>/proc/sys/vm/extra_free_kbytes</td>
  <td>Read-write file that can be used to keep extra free memory between the
  threshold where background reclaim (kswapd) kicks in, and the threshold
  where direct reclaim (by allocating processes) kicks in. <strong>This file
  is optional; its contents and permissions will be verified in VTS only if
  the file is present</strong>.</td>
  </tr>
  <tr>
  <td>/proc/sys/vm/max_map_count</td>
  <td>Read-write file that contains the maximum number of memory map areas a
  process may have.</td>
  </tr>

  <tr>
   <td>/proc/sys/vm/mmap_min_addr</td>
   <td>Read-write file that determines the minimum address than can be
   <code>mmap</code>'d.</td>
  </tr>
  <tr>
   <td>/proc/sys/vm/mmap_rnd_bits</td>
   <td>Read-write file that specifies the amount of randomness in
   <code>mmap</code>'d addresses.</td>
  </tr>
  <tr>
   <td>/proc/sys/vm/mmap_rnd_compat_bits</td>
   <td>Read-write file that specifies the amount of randomness in
   <code>mmap</code>'d addresses.</td>
  </tr>
  <tr>
   <td>/proc/sys/vm/overcommit_memory</td>
   <td>Read-write file that determines the kernel virtual memory accounting
   mode.</td>
  </tr>
  <tr>
    <td>/proc/sys/vm/page-cluster</td>
    <td>Read-write file that controls the number of pages up to which
    consecutive pages are read in from swap in a single attempt.</td>
  </tr>
  <tr>
   <td>/proc/uid_cputime/remove_uid_range</td>
   <td>Write-only file that, when written, removes UIDs from being shown in
   <code>/proc/uid_cputime/show_uid_stat</code>.</td>
  </tr>
  <tr>
   <td>/proc/uid_cputime/show_uid_stat</td>
   <td>Read-only file containing the time a UID's processes spent in user and
   kernel space.</td>
  </tr>
  <tr>
  <td>/proc/uid_io/stats</td>
  <td>Read-only file containing a list of I/O stats for each UID in the
  system</td>
  </tr>
  <tr>
  <td>/proc/uid_procstat/set</td>
  <td>Write-only file used to configure a UID as foreground or background.</td>
  </tr>
  <tr>
  <td>/proc/uid_time_in_state</td>
  <td>Read-only file containing the time each UID's processes spend executing at
  each available frequency. <strong>This file is optional; its contents and
  permissions will be verified in VTS only if the file is present</strong>.</td>
  </tr>
  <tr>
  <td>/proc/uptime</td>
  <td>Read-only file that shows how long the system has been running.</td>
  </tr>
  <tr>
   <td>/proc/version</td>
   <td>Read-only file containing a string describing the kernel version.</td>
  </tr>
  <tr>
   <td>/proc/vmallocinfo</td>
   <td>Read-only file containing <code>vmalloc</code>'d ranges.</td>
  </tr>
  <tr>
    <td>/proc/vmstat</td>
    <td>Read-only file containing virtual memory statistics from the kernel.
    </td>
  </tr>
  <tr>
   <td>/proc/zoneinfo</td>
   <td>Read-only file containing information about memory zones.</td>
  </tr>
</table>

<h3 id="dev">dev</h3>

<table>
  <tr>
   <th>Interface</th>
   <th>Description</th>
  </tr>
  <tr>
   <td>/dev/ashmem</td>
   <td>Anonymous shared memory device file.</td>
  </tr>
  <tr>
   <td>/dev/binder</td>
   <td>Binder device file.</td>
  </tr>
  <tr>
   <td>/dev/hwbinder</td>
   <td>Hardware binder device file.</td>
  </tr>
  <tr>
   <td>/dev/tun</td>
   <td>Universal TUN/TAP device file.</td>
  </tr>
  <tr>
   <td>/dev/xt_qtaguid</td>
   <td>QTAGUID netfilter device file.</td>
  </tr>
</table>

<h3 id="sysfs">sysfs</h3>
<table>
  <tr>
   <th>Interface</th>
   <th>Description</th>
  </tr>
  <tr>
  <td>/sys/class/net/*/mtu</td>
  <td>Read-write file containing the maximum transmission unit for each
  interface.</td>
  </tr>
  <tr>
  <td>/sys/class/rtc/*/hctosys</td>
  <td>Read-only file showing whether a particular rtc supplies the system time
    on boot and resume.</td>
  </tr>
  <tr>
  <td>/sys/devices/system/cpu/</td>
  <td>Directory containing information about CPU configuration and
  frequency.</td>
  </tr>
  <tr>
  <td>/sys/kernel/ipv4</td>
  <td>Directory of read-write files to configure TCP socket buffer sizes.</td>
  </tr>
  <tr>
  <td>/sys/kernel/wakeup_reasons</td>
  <td>Directory of read-only files containing the last suspend time and resume
  reason.</td>
  </tr>
  <tr>
  <td>/sys/power/state</td>
  <td>Read-write file that controls the system sleep states.</td>
  </tr>
  <tr>
  <td>/sys/power/wake_lock</td>
  <td>Read-write file that contains the active wake locks.</td>
  </tr>
  <tr>
  <td>/sys/power/wake_unlock</td>
  <td>Read-write file that contains non-active wake locks.</td>
  </tr>
  <tr>
  <td>/sys/power/wakeup_count</td>
  <td>Read-write file that can be used to put the system into a sleep state
  while taking into account the concurrent arrival of wakeup events.</td>
  </tr>
</table>

<h3 id="selinuxfs">selinuxfs</h3>
<p>The framework mounts <code>selinuxfs</code> at <code>/sys/fs/selinux</code>.
</p>

<table>
  <tr>
   <th>Path</th>
   <th>Description</th>
  </tr>
  <tr>
   <td>/sys/fs/selinux/checkreqprot</td>
   <td>Read/write file containing a binary flag that determines how selinux
   protections are checked on <code>mmap</code> and <code>mprotect</code> calls.
   </td>
  </tr>
  <tr>
   <td>/sys/fs/selinux/null</td>
   <td>Read/write null device for use by selinux.</td>
  </tr>
  <tr>
   <td>/sys/fs/selinux/policy</td>
   <td>Read-only file containing the selinux policy in binary form.</td>
  </tr>
</table>

<aside class="note"><strong>Note:</strong> For details on SELinux in Android
8.0, see <a href="/security/selinux/images/SELinux_Treble.pdf">SELinux for
Android 8.0</a>.</aside>

  </body>
</html>