]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - Documentation/core-api/kernel-api.rst
docs/core-api: move *{str,mem}dup* to "String Manipulation"
[mirror_ubuntu-jammy-kernel.git] / Documentation / core-api / kernel-api.rst
CommitLineData
baca8a0c
MCC
1====================
2The Linux Kernel API
3====================
4
baca8a0c 5
416c7517
RD
6List Management Functions
7=========================
baca8a0c
MCC
8
9.. kernel-doc:: include/linux/list.h
10 :internal:
11
12Basic C Library Functions
13=========================
14
15When writing drivers, you cannot in general use routines which are from
16the C Library. Some of the functions have been found generally useful
17and they are listed below. The behaviour of these functions may vary
18slightly from those defined by ANSI, and these deviations are noted in
19the text.
20
21String Conversions
22------------------
23
24.. kernel-doc:: lib/vsprintf.c
25 :export:
26
27.. kernel-doc:: include/linux/kernel.h
28 :functions: kstrtol
29
30.. kernel-doc:: include/linux/kernel.h
31 :functions: kstrtoul
32
33.. kernel-doc:: lib/kstrtox.c
34 :export:
35
36String Manipulation
37-------------------
38
39.. kernel-doc:: lib/string.c
40 :export:
41
15956176
MR
42.. kernel-doc:: mm/util.c
43 :functions: kstrdup kstrdup_const kstrndup kmemdup kmemdup_nul memdup_user
44 vmemdup_user strndup_user memdup_user_nul
45
eacc670f
RD
46Basic Kernel Library Functions
47==============================
48
49The Linux kernel provides more basic utility functions.
50
baca8a0c
MCC
51Bit Operations
52--------------
53
54.. kernel-doc:: arch/x86/include/asm/bitops.h
55 :internal:
56
baca8a0c
MCC
57Bitmap Operations
58-----------------
59
7d7363e4
RD
60.. kernel-doc:: lib/bitmap.c
61 :doc: bitmap introduction
62
63.. kernel-doc:: include/linux/bitmap.h
64 :doc: declare bitmap
65
66.. kernel-doc:: include/linux/bitmap.h
67 :doc: bitmap overview
68
69.. kernel-doc:: include/linux/bitmap.h
70 :doc: bitmap bitops
71
baca8a0c
MCC
72.. kernel-doc:: lib/bitmap.c
73 :export:
74
75.. kernel-doc:: lib/bitmap.c
76 :internal:
77
404376af
RD
78.. kernel-doc:: include/linux/bitmap.h
79 :internal:
80
baca8a0c
MCC
81Command-line Parsing
82--------------------
83
84.. kernel-doc:: lib/cmdline.c
85 :export:
86
eacc670f
RD
87Sorting
88-------
89
90.. kernel-doc:: lib/sort.c
91 :export:
92
93.. kernel-doc:: lib/list_sort.c
94 :export:
95
96Text Searching
97--------------
98
99.. kernel-doc:: lib/textsearch.c
100 :doc: ts_intro
101
102.. kernel-doc:: lib/textsearch.c
103 :export:
104
105.. kernel-doc:: include/linux/textsearch.h
106 :functions: textsearch_find textsearch_next \
107 textsearch_get_pattern textsearch_get_pattern_len
108
109CRC and Math Functions in Linux
110===============================
111
baca8a0c
MCC
112CRC Functions
113-------------
114
8a29896a
RD
115.. kernel-doc:: lib/crc4.c
116 :export:
117
baca8a0c
MCC
118.. kernel-doc:: lib/crc7.c
119 :export:
120
8a29896a 121.. kernel-doc:: lib/crc8.c
baca8a0c
MCC
122 :export:
123
8a29896a 124.. kernel-doc:: lib/crc16.c
baca8a0c
MCC
125 :export:
126
127.. kernel-doc:: lib/crc32.c
baca8a0c
MCC
128
129.. kernel-doc:: lib/crc-ccitt.c
130 :export:
131
8a29896a
RD
132.. kernel-doc:: lib/crc-itu-t.c
133 :export:
134
68e51252
RD
135Base 2 log and power Functions
136------------------------------
137
138.. kernel-doc:: include/linux/log2.h
139 :internal:
140
141Division Functions
142------------------
143
144.. kernel-doc:: include/asm-generic/div64.h
145 :functions: do_div
146
147.. kernel-doc:: include/linux/math64.h
148 :internal:
149
150.. kernel-doc:: lib/div64.c
151 :functions: div_s64_rem div64_u64_rem div64_u64 div64_s64
152
153.. kernel-doc:: lib/gcd.c
154 :export:
155
d063623b
RD
156UUID/GUID
157---------
158
159.. kernel-doc:: lib/uuid.c
160 :export:
161
baca8a0c
MCC
162Memory Management in Linux
163==========================
164
165The Slab Cache
166--------------
167
168.. kernel-doc:: include/linux/slab.h
169 :internal:
170
171.. kernel-doc:: mm/slab.c
172 :export:
173
174.. kernel-doc:: mm/util.c
15956176 175 :functions: kfree_const kvmalloc_node kvfree get_user_pages_fast
baca8a0c
MCC
176
177User Space Memory Access
178------------------------
179
7d2b39ab 180.. kernel-doc:: arch/x86/include/asm/uaccess.h
baca8a0c
MCC
181 :internal:
182
183.. kernel-doc:: arch/x86/lib/usercopy_32.c
184 :export:
185
186More Memory Management Functions
187--------------------------------
188
189.. kernel-doc:: mm/readahead.c
190 :export:
191
192.. kernel-doc:: mm/filemap.c
193 :export:
194
195.. kernel-doc:: mm/memory.c
196 :export:
197
198.. kernel-doc:: mm/vmalloc.c
199 :export:
200
201.. kernel-doc:: mm/page_alloc.c
202 :internal:
203
204.. kernel-doc:: mm/mempool.c
205 :export:
206
207.. kernel-doc:: mm/dmapool.c
208 :export:
209
210.. kernel-doc:: mm/page-writeback.c
211 :export:
212
213.. kernel-doc:: mm/truncate.c
214 :export:
215
216Kernel IPC facilities
217=====================
218
219IPC utilities
220-------------
221
222.. kernel-doc:: ipc/util.c
223 :internal:
224
225FIFO Buffer
226===========
227
228kfifo interface
229---------------
230
231.. kernel-doc:: include/linux/kfifo.h
232 :internal:
233
234relay interface support
235=======================
236
237Relay interface support is designed to provide an efficient mechanism
238for tools and facilities to relay large amounts of data from kernel
239space to user space.
240
241relay interface
242---------------
243
244.. kernel-doc:: kernel/relay.c
245 :export:
246
247.. kernel-doc:: kernel/relay.c
248 :internal:
249
250Module Support
251==============
252
253Module Loading
254--------------
255
256.. kernel-doc:: kernel/kmod.c
257 :export:
258
259Inter Module support
260--------------------
261
262Refer to the file kernel/module.c for more information.
263
264Hardware Interfaces
265===================
266
267Interrupt Handling
268------------------
269
270.. kernel-doc:: kernel/irq/manage.c
271 :export:
272
273DMA Channels
274------------
275
276.. kernel-doc:: kernel/dma.c
277 :export:
278
279Resources Management
280--------------------
281
282.. kernel-doc:: kernel/resource.c
283 :internal:
284
285.. kernel-doc:: kernel/resource.c
286 :export:
287
288MTRR Handling
289-------------
290
3ed1d012 291.. kernel-doc:: arch/x86/kernel/cpu/mtrr/mtrr.c
baca8a0c
MCC
292 :export:
293
baca8a0c
MCC
294Security Framework
295==================
296
297.. kernel-doc:: security/security.c
298 :internal:
299
300.. kernel-doc:: security/inode.c
301 :export:
302
303Audit Interfaces
304================
305
306.. kernel-doc:: kernel/audit.c
307 :export:
308
309.. kernel-doc:: kernel/auditsc.c
310 :internal:
311
312.. kernel-doc:: kernel/auditfilter.c
313 :internal:
314
315Accounting Framework
316====================
317
318.. kernel-doc:: kernel/acct.c
319 :internal:
320
321Block Devices
322=============
323
324.. kernel-doc:: block/blk-core.c
325 :export:
326
327.. kernel-doc:: block/blk-core.c
328 :internal:
329
330.. kernel-doc:: block/blk-map.c
331 :export:
332
333.. kernel-doc:: block/blk-sysfs.c
334 :internal:
335
336.. kernel-doc:: block/blk-settings.c
337 :export:
338
339.. kernel-doc:: block/blk-exec.c
340 :export:
341
342.. kernel-doc:: block/blk-flush.c
343 :export:
344
345.. kernel-doc:: block/blk-lib.c
346 :export:
347
348.. kernel-doc:: block/blk-tag.c
349 :export:
350
351.. kernel-doc:: block/blk-tag.c
352 :internal:
353
354.. kernel-doc:: block/blk-integrity.c
355 :export:
356
357.. kernel-doc:: kernel/trace/blktrace.c
358 :internal:
359
360.. kernel-doc:: block/genhd.c
361 :internal:
362
363.. kernel-doc:: block/genhd.c
364 :export:
365
366Char devices
367============
368
369.. kernel-doc:: fs/char_dev.c
370 :export:
371
baca8a0c
MCC
372Clock Framework
373===============
374
375The clock framework defines programming interfaces to support software
376management of the system clock tree. This framework is widely used with
377System-On-Chip (SOC) platforms to support power management and various
378devices which may need custom clock rates. Note that these "clocks"
379don't relate to timekeeping or real time clocks (RTCs), each of which
380have separate frameworks. These :c:type:`struct clk <clk>`
381instances may be used to manage for example a 96 MHz signal that is used
382to shift bits into and out of peripherals or busses, or otherwise
383trigger synchronous state machine transitions in system hardware.
384
385Power management is supported by explicit software clock gating: unused
386clocks are disabled, so the system doesn't waste power changing the
387state of transistors that aren't in active use. On some systems this may
388be backed by hardware clock gating, where clocks are gated without being
389disabled in software. Sections of chips that are powered but not clocked
390may be able to retain their last state. This low power state is often
391called a *retention mode*. This mode still incurs leakage currents,
392especially with finer circuit geometries, but for CMOS circuits power is
393mostly used by clocked state changes.
394
395Power-aware drivers only enable their clocks when the device they manage
396is in active use. Also, system sleep states often differ according to
397which clock domains are active: while a "standby" state may allow wakeup
398from several active domains, a "mem" (suspend-to-RAM) state may require
399a more wholesale shutdown of clocks derived from higher speed PLLs and
400oscillators, limiting the number of possible wakeup event sources. A
401driver's suspend method may need to be aware of system-specific clock
402constraints on the target sleep state.
403
404Some platforms support programmable clock generators. These can be used
405by external chips of various kinds, such as other CPUs, multimedia
406codecs, and devices with strict requirements for interface clocking.
407
408.. kernel-doc:: include/linux/clk.h
409 :internal:
764f8079
PM
410
411Synchronization Primitives
412==========================
413
414Read-Copy Update (RCU)
415----------------------
416
417.. kernel-doc:: include/linux/rcupdate.h
764f8079
PM
418
419.. kernel-doc:: include/linux/rcupdate_wait.h
764f8079
PM
420
421.. kernel-doc:: include/linux/rcutree.h
764f8079
PM
422
423.. kernel-doc:: kernel/rcu/tree.c
764f8079
PM
424
425.. kernel-doc:: kernel/rcu/tree_plugin.h
764f8079
PM
426
427.. kernel-doc:: kernel/rcu/tree_exp.h
764f8079
PM
428
429.. kernel-doc:: kernel/rcu/update.c
764f8079
PM
430
431.. kernel-doc:: include/linux/srcu.h
764f8079
PM
432
433.. kernel-doc:: kernel/rcu/srcutree.c
764f8079
PM
434
435.. kernel-doc:: include/linux/rculist_bl.h
764f8079
PM
436
437.. kernel-doc:: include/linux/rculist.h
764f8079
PM
438
439.. kernel-doc:: include/linux/rculist_nulls.h
764f8079
PM
440
441.. kernel-doc:: include/linux/rcu_sync.h
764f8079
PM
442
443.. kernel-doc:: kernel/rcu/sync.c