About This Manual

This manual discusses topics related to writing kernel modules for computer systems running the Compaq Tru64TM UNIX (formerly DIGITAL UNIX) operating system.

Audience

This manual is intended for systems engineers who:

This manual assumes that you have a strong background in operating systems based on the UNIX operating system. It also assumes that you have a strong background in systems and C programming. In addition, the manual assumes that you have no source code licenses.

New and Changed Features

The following list summarizes changes and additions that have been made since the last release of this manual:

Scope of the Manual

This manual is for users of the Tru64 UNIX operating system on computer systems developed by Compaq Computer Corporation. It describes how to develop a kernel module and presents examples where kernel modules can be used. The manual also presents examples that show how to use routines that are for symmetric multiprocessing and kernel threads.

The manual assumes that you are new to writing kernel modules but may have experience writing device drivers or programming in the UNIX kernel.

Organization

The manual contains ten chapters and a glossary:

Chapter 1 Provides an overview of the information in this manual. Defines kernel modules, presents a high-level model for using kernel modules, presents reasons for writing a kernel module, and describes general rules for writing a kernel module.
Chapter 2 Describes how to initialize a kernel module using the configure routine.
Chapter 3 Describes setting module attributes and the module attribute table.
Chapter 4 Describes the boot timeline and how to implement callbacks in a kernel module.
Chapter 5 Describes programming capabilities available in kernel mode.
Chapter 6 Provides an overview of the SMP environment, including guidelines for selecting a locking method.
Chapter 7 Describes how to define and use simple locks in an SMP environment.
Chapter 8 Describes how to define and use complex locks in an SMP environment.
Chapter 9 Provides an introduction to multithreaded programming for kernel modules and discusses using kernel threads.
Chapter 10 Describes key steps for creating a single binary module (.mod file).
Glossary  

Related Documentation

Icons on Tru64 UNIX Printed Manuals

The printed version of the Tru64 UNIX documentation uses letter icons on the spines of the manuals to help specific audiences quickly find the manuals that meet their needs. (You can order the printed documentation from Compaq.) The following list describes this convention:

  G Manuals for general users
  S Manuals for system and network administrators
  P Manuals for programmers
  R Manuals for reference page users

Some manuals in the documentation help meet the needs of several audiences. For example, the information in some system manuals is also used by programmers. Keep this in mind when searching for information on specific topics.

The Documentation Overview provides information on all of the manuals in the Tru64 UNIX documentation set.

Writing kernel modules is a complex task; writers require knowledge in a variety of areas. One way to acquire this knowledge is to have at least the following categories of documentation available:

The following sections list the documentation for each of these categories.

Hardware Documentation

If your kernel module is a device driver, have the hardware manual available for the device whose module you are coding. Also have access to the manual that describes the architecture for the CPU on which the driver operates, for example, the Alpha Architecture Reference Manual.

Bus-Specific Device Driver Documentation

Writing Device Drivers is the core manual for developing device driver kernel modules on the Tru64 UNIX Version 5.1A operating system. It contains information needed to develop modules on any bus that operates on Compaq platforms.

Reference Pages, Section 9r, Device Drivers (Volume 1) and Reference Pages, Section 9s, 9u, and 9v, Device Drivers (Volume 2) describe the routines, data structures, and global variables that device drivers use.

The following manuals provide information about writing device drivers for a specific bus:

Operating System Overview Documentation

See the Technical Overview for a technical introduction to the Tru64 UNIX operating system.

This manual provides a technical overview of the Tru64 UNIX system, focusing on the networking subsystem, the file system, virtual memory, and the development environment. This manual does not supersede the Software Product Description (SPD), which is the definitive description of the Tru64 UNIX system.

Programming Tools Documentation

To create your kernel modules, you use a number of programming development tools. Make sure that you have on hand the manuals that describe how to use these tools. The following manuals provide information related to programming tools that are used in the Tru64 UNIX operating system environment:

System Management Documentation

See the System Administration manual for information about building a kernel and for general information on system administration.

This manual describes how to configure, use, and maintain the Tru64 UNIX operating system. It includes information on general day-to-day activities and tasks, changing your system configuration, and locating and eliminating sources of trouble. This manual is for the system administrators who are responsible for managing the operating system. It assumes a knowledge of operating system concepts, commands, and configurations.

Reader's Comments

Compaq welcomes any comments and suggestions you have on this and other Tru64 UNIX manuals.

You can send your comments in the following ways:

Please include the following information along with your comments:

The Tru64 UNIX Publications group cannot respond to system problems or technical support inquiries. Please address technical questions to your local system vendor or to the appropriate Compaq technical support office. Information provided with the software media explains how to send problem reports to Compaq.

Conventions

This manual uses the following conventions:


.
.
.

A vertical ellipsis indicates that a portion of an example that would normally be present is not shown.

. . .

In syntax definitions, a horizontal ellipsis indicates that the preceding item can be repeated one or more times.

file

Italic type indicates variable values, placeholders, and function argument names.

buf

In function definitions and syntax definitions used in module configuration, this typeface indicates names that you must type exactly as shown.

[ ]

In formal parameter declarations in function definitions and in structure declarations, brackets indicate arrays. Brackets also specify ranges for device minor numbers and device special files in file fragments. However, for syntax definitions, these brackets indicate items that are optional.

|

Vertical bars that separate items in syntax definitions indicate that you choose one item from among those listed.