Translation Information

Project website docs.freebsd.org/en
Translation process
  • Translations can be made directly.
  • Translation suggestions can be made.
  • Only chosen users can contribute.
  • The translation uses bilingual files.
Translation license BSD 2-Clause "Simplified" License
Filemask documentation/content/*/books/arch-handbook/sysinit/chapter.po
Translation file Download documentation/content/zh_CN/books/arch-handbook/sysinit/chapter.po
Note that `SI_SUB_FOO` and `SI_ORDER_FOO` need to be in the `sysinit_sub_id` and `sysinit_elem_order` enum's as mentioned above. Either use existing ones or add your own to the enum's. You can also use math for fine-tuning the order a SYSINIT will run in. This example shows a SYSINIT that needs to be run just barely before the SYSINIT's that handle tuning kernel parameters.
注意,<literal>SI_SUB_FOO</literal>和<literal>SI_ORDER_FOO</literal>应当分别在上面提到的枚举<literal>sysinit_sub_id</literal>和<literal>sysinit_elem_order</literal>之中。既可以使用已有的枚举项,也可以将自己的枚举项添加到这两个枚举的定义之中。你可以使用数学表达式微调SYSINIT的执行顺序。以下的例子示例了一个需要刚好要在内核参数调整的SYSINIT之前执行的SYSINIT。
yesterday
New contributor yesterday
The `SYSINIT()` macro creates the necessary SYSINIT data in SYSINIT's startup data set for SYSINIT to sort and dispatch a function at system startup and module load. `SYSINIT()` takes a uniquifier that SYSINIT uses to identify the particular function dispatch data, the subsystem order, the subsystem element order, the function to call, and the data to pass the function. All functions must take a constant pointer argument.
>宏<literal>SYSINIT()</literal>在SYSINIT启动数据集合中建立一个SYSINIT数据项,以便SYSINIT在系统启动或模块加载时排序并执行其中的函数。<literal>SYSINIT()</literal>有一个参数uniquifier,SYSINIT用它来标识数据项,随后是子系统顺序号、子系统元素顺序号、待调用函数、传递给函数的数据。所有的函数必须有一个恒量指针参数。
yesterday
New contributor yesterday
SYSINIT(uniquifier, subsystem, order, func, ident)
SYSUNINIT(uniquifier, subsystem, order, func, ident)
SYSINIT(uniquifier, subsystem, order, func, ident)
SYSUNINIT(uniquifier, subsystem, order, func, ident)
yesterday
New contributor yesterday
There are currently two uses for SYSINIT. Function dispatch at system startup and kernel module loads, and function dispatch at system shutdown and kernel module unload. Kernel subsystems often use system startup SYSINIT's to initialize data structures, for example the process scheduling subsystem uses a SYSINIT to initialize the run queue data structure. Device drivers should avoid using `SYSINIT()` directly. Instead drivers for real devices that are part of a bus structure should use `DRIVER_MODULE()` to provide a function that detects the device and, if it is present, initializes the device. It will do a few things specific to devices and then call `SYSINIT()` itself. For pseudo-devices, which are not part of a bus structure, use `DEV_MODULE()`.
有两种时刻需要使用SYSINIT:系统启动或内核模块加载时,系统析构或内核模块卸载时。内核子系统通常在系统启动时使用SYSINIT的定义项以初始化数据结构。例如,进程调度子系统使用一个SYSINIT定义项来初始化运行队列数据结构。设备驱动程序应避免直接使用<literal>SYSINIT()</literal>,对于总线结构上的物理真实设备应使用<literal>DRIVER_MODULE()</literal>调用的函数先侦测设备的存在,如果存在,再进行设备的初始化。这一系统过程中,会做一些专门针对设备的事情,然后调用<literal>SYSINIT()</literal>本身。对于非总线结构一部分的虚设备,应改用<literal>DEV_MODULE()</literal>。
yesterday
New contributor yesterday
SYSINIT relies on the ability of the linker to take static data declared at multiple locations throughout a program's source and group it together as a single contiguous chunk of data. This linker technique is called a "linker set". SYSINIT uses two linker sets to maintain two data sets containing each consumer's call order, function, and a pointer to the data to pass to that function.
SYSINIT要依靠链接器获取遍布整个程序源代码多处申明的静态数据并把它们组成一个彼此相邻的数据块。这种链接方法被称为<quote>链接器集合</quote>(linker set)。SYSINIT使用两个链接器集合以维护两个数据集合,包含每个数据条目的调用顺序、函数、一个会被提交给该函数的数据指针。
yesterday
New contributor yesterday
Browse all translation changes

Statistics

Percent Strings Words Chars
Total 34 645 4,506
Translated 32% 11 39 269
Needs editing 17% 6 424 2,704
Failing checks 17% 6 424 2,704

Last activity

Last change April 11, 2021, 12:47 p.m.
Last author Anonymous

Daily activity

Daily activity

Weekly activity

Weekly activity